文档链接=>https://hyperledger.github.io/burrow/
github链接=>https://github.com/hyperledger/burrow/
接前文《体验Hyperledger-Burrow-1》,启动4个节点如下:
1 2 3 4 5 6
| ➜ script ps aux | grep burrow USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND will 21409 2.1 0.8 133268 66036 pts/1 SNl 08:52 1:02 ./burrow start --config=burrow000.toml will 21410 1.9 0.7 133268 59212 pts/1 SNl 08:52 0:56 ./burrow start --config=burrow001.toml will 21411 2.0 0.8 133268 65924 pts/1 SNl 08:52 0:59 ./burrow start --config=burrow002.toml will 21416 2.0 0.7 133268 63416 pts/1 SNl 08:52 1:01 ./burrow start --config=burrow003.toml
|
制作增加节点的配置文件
1
| ./burrow spec -v1 | ./burrow configure -s- > burrow_add.toml
|
运行完成后,增加公私钥文档如下:
1 2 3 4 5 6 7 8
| ➜ data pwd /home/will/documents/burrow/script/.keys/data ➜ data cat 035B1B192A16FF8086C36304024010502CEB2DE0.json {"CurveType":"ed25519","Address":"5ECA9967F5D363F21C4606CC971710200A64C5BC","PublicKey":"4F3530024CF75A7AFC4D168CF2975C285D03CEBB1CBE82E21AD9C76531A63128","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"486059FB274248423F92B7522D5A237AB99B38C80F84D46F720EAE1506D8E2DF4F3530024CF75A7AFC4D168CF2975C285D03CEBB1CBE82E21AD9C76531A63128"}} ➜ names pwd /home/will/documents/burrow/script/.keys/names ➜ names cat Validator_0 035B1B192A16FF8086C36304024010502CEB2DE0
|
修改burrow_add.toml配置:
1.删除GenesisDoc的内容,因为genesis.json中已经包含了节点们的GenesisDoc;
2.增加PersistentPeers,PersistentPeers在burrow000.toml中可以找到;
3关闭grpc端口,关闭rpc.info等,否则会跟已有的4个节点端口冲突
发出增加validator的Tx
制作增加validator Tx 交易的文件:
1 2 3 4 5 6
| jobs: - name: AddValidator update-account: target: 4F3530024CF75A7AFC4D168CF2975C285D03CEBB1CBE82E21AD9C76531A63128 power: 222222 permissions: [root, send, call, createContract, createAccount, bond, name, proposal, input, batch, identify, hasBase, setBase, unsetBase, setGlobal, hasRole, addRole, removeRole]
|
其中4F3530024CF75A7AFC4D168CF2975C285D03CEBB1CBE82E21AD9C76531A63128
是新节点的publickey。
执行交易命令(DCF0F3BD45EA59B2D471729EC22838DF7B119012
是增加节点前已经启动的4个节点中的Full Account节点。),即在已经启动的节点上执行本交易:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| ./burrow deploy -c 127.0.0.1:10997 --mempool-signing=true --address=DCF0F3BD45EA59B2D471729EC22838DF7B119012 deploy.yaml log_channel=Info message="Using chain" Chain=127.0.0.1:10997 Signer= log_channel=Info message="Loading Playbook File." log_channel=Info message="Loading playbook file" path=/home/will/documents/burrow/script filename=/home/will/documents/burrow/script/deploy.yaml log_channel=Info message="*****Executing Job*****" JobName=defaultAddr Type=Account log_channel=Info message="Setting Account" account=DCF0F3BD45EA59B2D471729EC22838DF7B119012 log_channel=Info message="*****Executing Job*****" JobName=AddValidator Type=UpdateAccount log_channel=Info message=GovTx account="unsupported value type" log_channel=Info message="Using mempool signing since no keyClient set, pass --keys to sign locally or elsewhere" log_channel=Info message="Using mempool signing" log_channel=Info message="Tx Return" TransactionHash=5a1a57e975e5ead5079c12c63c473e1c04c59cf82fe9974f191faaf1d8aeb8b8 BlockHeight=18 log_channel=Info message="Job Vars" name=input value=DCF0F3BD45EA59B2D471729EC22838DF7B119012 log_channel=Info message="Job Vars" name=native value= log_channel=Info message="Job Vars" name=power value=222222 log_channel=Info message="Job Vars" name=sequence value= log_channel=Info message="Job Vars" name=address value= log_channel=Info message="Job Vars" name=publicKey value=D90E05FAD677699B4FEE56B567F85D3A90438B4B627C27CED0D4C850BDC97876 log_channel=Info message="Writing to current directory" output=/home/will/documents/burrow/script/deploy.output.json log_channel=Info message="JOBS THAT SUCCEEEDED" count=1 log_channel=Info message="Playbook result" jobNo=0 file=deploy.yaml time=230.744184ms
|
注意:新创建的validator没有余额。
启动新增加的节点
1
| ./burrow start --config=burrow_add.toml --genesis=genesis.json --address=5ECA9967F5D363F21C4606CC971710200A64C5BC
|
5ECA9967F5D363F21C4606CC971710200A64C5BC
是被增加节点的地址(address)。
1 2 3 4 5 6 7
| ➜ script ps aux | grep burrow USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND will 21409 2.1 0.8 133268 66036 pts/1 SNl 08:52 1:02 ./burrow start --config=burrow000.toml will 21410 1.9 0.7 133268 59212 pts/1 SNl 08:52 0:56 ./burrow start --config=burrow001.toml will 21411 2.0 0.8 133268 65924 pts/1 SNl 08:52 0:59 ./burrow start --config=burrow002.toml will 21416 2.0 0.7 133268 63416 pts/1 SNl 08:52 1:01 ./burrow start --config=burrow003.toml will 21505 2.2 0.7 133268 58864 pts/1 Sl+ 08:55 1:01 ./burrow start --config=burrow_add.toml --genesis=genesis.json --address=DCF0F3BD45EA59B2D471729EC22838DF7B119012
|
ed25519是tendermint选择的加密曲线,secp256k1是ethereum选择的加密曲线。
两者都可以在./burrow keys list
中看到账户地址和名称。在web3.getAccounts中只能够看到secp256k1曲线下生成的账户地址,metamask和remix也是如此。
burrow keys gen -n -t secp256k1 --name zhuang
如果不指定 -n
的话,需要输入密码。
发送转账交易
创建转账交易 deploy_sendToken.yaml
1 2 3 4 5
| jobs: - name: sendTxTest1 send: destination: 0DE8C14FE07FA693D3A6F65D826647D39E9A3BB0 amount: 2000
|
发起
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| ➜ script ./burrow keys gen -n -t secp256k1 --name zhuang1 0DE8C14FE07FA693D3A6F65D826647D39E9A3BB0 ➜ script ./burrow deploy --address CCC93802D38A33B636D8B2B74218021A571CF252 deploy_sendToken.yaml log_channel=Info message="Using chain" Chain=127.0.0.1:10997 Signer= log_channel=Info message="Loading Playbook File." log_channel=Info message="Loading playbook file" path=/home/will/documents/burrow/script filename=/home/will/documents/burrow/script/deploy_sendToken.yaml log_channel=Info message="*****Executing Job*****" JobName=defaultAddr Type=Account log_channel=Info message="Setting Account" account=CCC93802D38A33B636D8B2B74218021A571CF252 log_channel=Info message="*****Executing Job*****" JobName=sendTxTest1 Type=Send log_channel=Info message="Sending Transaction" source=CCC93802D38A33B636D8B2B74218021A571CF252 destination=0DE8C14FE07FA693D3A6F65D826647D39E9A3BB0 amount=2000 log_channel=Info message=SendTx send="unsupported value type" log_channel=Info message="Using mempool signing since no keyClient set, pass --keys to sign locally or elsewhere" log_channel=Info message="Using mempool signing" log_channel=Info message="Tx Return" TransactionHash=a0abda87ea4751beaeae04d5ac67c35114b9f068720db6e1795ec7083c4a872e BlockHeight=27 log_channel=Info message="Writing to current directory" output=/home/will/documents/burrow/script/deploy_sendToken.output.json log_channel=Info message="JOBS THAT SUCCEEEDED" count=1 log_channel=Info message="Playbook result" jobNo=0 file=deploy_sendToken.yaml time=347.234362ms
|