geth 起動方法、contractデプロイ

geth 起動方法

# port指定する
$ geth --datadir ./myDataDir --networkid 1114 -port 7545 --rpc console 2>> myEth.log

# ログ見るために
$ tail -f myEth.log
# アカウント作成
> personal.newAccount("<YOUR_PASSPHRASE>")
# Check your default account, type
> eth.coinbase
# To set your default account, type 
> miner.setEtherbase(web3.eth.accounts[0])
# Check your balance with 
> eth.getBalance(eth.coinbase)
# Run
> miner.start()
# end mining
> miner.stop()

command(geth上)

# 初期化 初回のみ 18000sアカウントを解除
personal.unlockAccount("0xb76be8f5914ca4ece4527ef7f065e64739aa52eb","<YOUR_PASSPHRASE>", 18000)

command(truffleディレクトリ)

# インストール 初回のみ
npm install --save truffle
# 初期化 初回のみ
$ truffle init
# contracts フォルダにcontract記述しておくことー
# contract compile
$ truffle compile
# build/contractsにファイル出来る。
# migrationファイル作成する。
$ truffle migrate --devlopment --rpc

設定ファイル

# truffle.js
# gasの量が少ないとデプロイ出来ない
module.exports = {
   networks: {
   development: {
   host: "localhost",
   port: 7545,
   network_id: 1114, // Match any network id
   gas: 2500000
  }
 }
};

イベント通知

参考

minerの方法

go ethereum - Deploy contract on private blockchain using Geth - Ethereum Stack Exchange