- 内部ネットワーク用のノード情報などを格納するディレクトリを作成する。
$ mkdir /home/bushidoyasu/test_e - ジェネシスブロックを定義したファイルを作成する。ファイル名は「myjenesis.json」とする。
{ "config": { "chainId": 15, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "nonce": "0x00006d6f7264656e", "difficulty": "0x200", "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578", "coinbase": "0x0000000000000000000000000000000000000000", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x", "gasLimit": "0x2FEFD8", "alloc": { } }
- ブロックチェーン情報を初期化する。
$ geth --datadir /home/bushidoyasu/test_e init /home/bushidoyasu/test_e/genesis.json - Peerを起動する。
$ geth --datadir /home/bushidoyasu/test_e --networkid 15 console
あとは、2人分のアカウントを作成して、送金してみる。
■1人目の作成
> personal.newAccount("bushitya")
INFO [06-26|22:39:33] New wallet appeared url=keystore:///home/bushidoyasu/te… status=Locked
"0xd550f995919d10ca17c40f0ea217038ee4df7580"
■2人目の作成
> personal.newAccount("masako")
"0xf7d4f230533737e67d4489f789b71dd89b784d93"
> INFO [06-26|22:43:49] New wallet appeared url=keystore:///home/bushidoyasu/te… status=Locked
■アカウントの確認
> eth.accounts
["0xd550f995919d10ca17c40f0ea217038ee4df7580", "0xf7d4f230533737e67d4489f789b71dd89b784d93"]
■発掘の開始
※1人目のユーザに報酬が蓄積されていく
> miner.start()
■アカウントのアンロック
※タイムアウト時間は300秒。
> personal.unlockAccount(eth.accounts[0])
Unlock account 0xd550f995919d10ca17c40f0ea217038ee4df7580
Passphrase:
true
■資産の確認
> eth.getBalance(eth.accounts[0])
5000000000000000000
> eth.getBalance(eth.accounts[1])
0
■送金
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(1, "ether")})
■1人目の作成
> personal.newAccount("bushitya")
INFO [06-26|22:39:33] New wallet appeared url=keystore:///home/bushidoyasu/te… status=Locked
"0xd550f995919d10ca17c40f0ea217038ee4df7580"
■2人目の作成
> personal.newAccount("masako")
"0xf7d4f230533737e67d4489f789b71dd89b784d93"
> INFO [06-26|22:43:49] New wallet appeared url=keystore:///home/bushidoyasu/te… status=Locked
■アカウントの確認
> eth.accounts
["0xd550f995919d10ca17c40f0ea217038ee4df7580", "0xf7d4f230533737e67d4489f789b71dd89b784d93"]
■発掘の開始
※1人目のユーザに報酬が蓄積されていく
> miner.start()
■アカウントのアンロック
※タイムアウト時間は300秒。
> personal.unlockAccount(eth.accounts[0])
Unlock account 0xd550f995919d10ca17c40f0ea217038ee4df7580
Passphrase:
true
■資産の確認
> eth.getBalance(eth.accounts[0])
5000000000000000000
> eth.getBalance(eth.accounts[1])
0
■送金
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(1, "ether")})
0 件のコメント:
コメントを投稿