Download Geth よりダウンロードしてインストール
実行
毎回unlockは面倒だから,2つのアカウントはpasswordファイルでunlockして起動。passwordファイルは1行づつ
geth --unlock 0,1 --password c:\gethdata\pass.txt --mine --minerthreads 1 --identity "sampleNode" --rpc --rpcport 8545 --rpcapi "web3,eth,net,personal" --rpccorsdomain "*" --rpcaddr "0.0.0.0" --datadir "C:\gethdata" --nodiscover --networkid 10 console 2>> C:\gethdata\geth.log
アカウント作成
personal.newAccount("test1")
アカウント一覧
eth.accounts
マイニングするアカウントの確認
eth.coinbase
送金
eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(100,"ether")})
アンロック アンロックの時間はデフォルト300秒
personal.unlockAccount(アドレス, "パスワード", "アンロックの時間(秒)") personal.unlockAccount(アドレス)
トランザクション確認 #送金でトランザクションIDが表示されている
eth.getTransaction('トランザクションID')
bootstrapとsessionはどうでもいいけど、いつもつかっているので。
meteor add twbs:bootstrap meteor add ethereum:web3 meteor add ethereum:accounts meteor add ethereum:blocks meteor add session
1番目のアカウントの名前
EthAccounts.find().fetch()[0].name
1番目のアカウントのアドレス
EthAccounts.find().fetch()[0].address
1番目のアカウントのEtherの残高
EthAccounts.find().fetch()[0].balance
最新のブロック番号
EthBlocks.latest.number
最新ブロックのハッシュ値
EthBlocks.latest.hash
最新ブロックを採掘した採掘者のアドレス
EthBlocks.latest.miner
web3.eth.hashrateとかどんなのがあるかみたい時に。
Web3 JavaScript app API for 0.2x.x
ブロックチェーンの基本的な仕組み
git
[Japanese] Meteorを使ってDappを作ろう