owned this note
owned this note
Published
Linked with GitHub
evm-lite solo 模式測試
===
### 官方evm-lite測試結果 - 失敗
```bash=
./demo.sh ../deploy/terraform/local/ips.dat
{ _: [],
ips: '172.17.0.2,172.17.0.4,172.17.0.3,172.17.0.5',
port: 8080,
contract: 'crowd-funding.sol',
keystore: '../deploy/conf/babble/conf/keystore',
pwd: '../deploy/conf/eth/pwd.txt' }
/home/junwei/Documents/Babble/evm-lite/demo/nodejs/node_modules/solc/soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readF
Error: ENOENT: no such file or directory, scandir '../deploy/conf/babble/conf/keystore'
at Object.fs.readdirSync (fs.js:904:18)
at readKeyStore (/home/junwei/Documents/Babble/evm-lite/demo/nodejs/demo.js:95:16)
at init (/home/junwei/Documents/Babble/evm-lite/demo/nodejs/demo.js:75:25)
at Object.<anonymous> (/home/junwei/Documents/Babble/evm-lite/demo/nodejs/demo.js:317:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
```
於是我先用 Babble consensus 部署過一次 emv-lite,再重新部署 solo 模式,但結果仍然失敗。
```bash=
./demo.sh ../deploy/terraform/local/ips.dat
{ _: [],
ips: '172.17.0.2,172.17.0.5,172.17.0.3,172.17.0.4',
port: 8080,
contract: 'crowd-funding.sol',
keystore: '../deploy/conf/babble/conf/keystore',
pwd: '../deploy/conf/eth/pwd.txt' }
STEP 1) Get ETH Accounts
PRESS ENTER TO CONTINUE
Getting Accounts
GET 172.17.0.2:8080/accounts
node1 accounts: {"accounts":[{"address":"0x9a59dA63fb57Ff4fc0B2037b7dFAaeeB27Bf483D","balance":1337000000000000000000,"nonce":0}]}
GET 172.17.0.5:8080/accounts
node2 accounts: {"accounts":[{"address":"0xcB78eD1D8b91aD8BCe8fA416Ef261C2F95961f53","balance":1337000000000000000000,"nonce":0}]}
GET 172.17.0.3:8080/accounts
node3 accounts: {"accounts":[{"address":"0x6896718f7A42115C9915f4562d5A26A9CF74A587","balance":1337000000000000000000,"nonce":0}]}
GET 172.17.0.4:8080/accounts
node4 accounts: {"accounts":[{"address":"0xDd875f820800730cA79C1fB0673E509387041B94","balance":1337000000000000000000,"nonce":0}]}
EXPLANATION:
Each node controls one account which allows it to send and receive Ether.
The private keys reside directly on the evm-babble nodes. In a production
setting, access to the nodes would be restricted to the people allowed to
sign messages with the private key. We also keep a local copy of all the private
keys to demonstrate client-side signing.
STEP 2) Send 500 wei (10^-18 ether) from node1 to node2
PRESS ENTER TO CONTINUE
Sending Transfer Tx: {"from":"0x9a59dA63fb57Ff4fc0B2037b7dFAaeeB27Bf483D","to":"0xcB78eD1D8b91aD8BCe8fA416Ef261C2F95961f53","value":500}
POST 172.17.0.2:8080/tx
Response: {"txHash":"0x62fdf2b0a9dc549d8acefbfbc0b7c9cd5c581be9bed57b96000fc97a918e3a10"}
EXPLANATION:
We created an EVM transaction to send 500 wei from node1 to node2. The
transaction was sent to node1 which controls the private key for the sender.
EVM-Babble converted the transaction into raw bytes, signed it and submitted
it to Babble for consensus ordering. Babble gossiped the raw transaction to
the other Babble nodes which ran it through the consensus algorithm until they
were each ready to commit it back to EVM-BABBLE. So each node received and
processed the transaction. They each applied the same changes to their local
copy of the ledger.
STEP 3) Check balances again
PRESS ENTER TO CONTINUE
Getting Accounts
GET 172.17.0.2:8080/accounts
node1 accounts: {"accounts":[{"address":"0x9a59dA63fb57Ff4fc0B2037b7dFAaeeB27Bf483D","balance":1336999999999999999500,"nonce":1}]}
GET 172.17.0.5:8080/accounts
node2 accounts: {"accounts":[{"address":"0xcB78eD1D8b91aD8BCe8fA416Ef261C2F95961f53","balance":1337000000000000000000,"nonce":0}]}
GET 172.17.0.3:8080/accounts
node3 accounts: {"accounts":[{"address":"0x6896718f7A42115C9915f4562d5A26A9CF74A587","balance":1337000000000000000000,"nonce":0}]}
GET 172.17.0.4:8080/accounts
node4 accounts: {"accounts":[{"address":"0xDd875f820800730cA79C1fB0673E509387041B94","balance":1337000000000000000000,"nonce":0}]}
EXPLANATION:
Notice how the balances of node1 and node2 have changed.
STEP 4) Send raw signed transaction
PRESS ENTER TO CONTINUE
GET 172.17.0.3:8080/account/0xE1c105CcD6840A201A43a0d3411cf11b4c922234
account: {"address":"0xE1c105CcD6840A201A43a0d3411cf11b4c922234","balance":0,"nonce":0}
signed tx Promise {
{ messageHash: '0x7a21cb5e5207decfb9f29e44fbe7238dbab3e73d41bd3ee958a6130cdd29fee0',
v: '0x25',
r: '0x4ca1262482176c6a64355a200e535b9348b0475fa1096d8172859248a17417dc',
s: '0x114c492984f7bdf9089db2b48a0039f8db5fe6cfb696e3668f5dec942dd08944',
rawTransaction: '0xf8628080830f424094f56e918c8aca15b618a1ae00e97c05242976f5638201f48025a04ca1262482176c6a64355a200e535b9348b0475fa1096d8172859248a17417dca0114c492984f7bdf9089db2b48a0039f8db5fe6cfb696e3668f5dec942dd08944' } }
POST 172.17.0.3:8080/rawtx
Response: insufficient balance for transfer
[object Object]
```
### 失敗原因 :
```
GET 172.17.0.3:8080/account/0xE1c105CcD6840A201A43a0d3411cf11b4c922234
account: {"address":"0xE1c105CcD6840A201A43a0d3411cf11b4c922234","balance":0,"nonce":0}
...
Response: insufficient balance for transfer
```
根據錯誤訊息推斷可能是 Demo Scripts 的問題,因為 Address : 0xE1c105CcD6840A201A43a0d3411cf11b4c922234 並沒有出現在 Accounts List 中,猜測是寫死在 Scripts 中的。
---
### 10 月 30 日更新 - 成功
```bash=
./demo.sh ../terraform/local/ips.dat ../conf/solo/conf/keystore/ ../conf/eth/pwd.txt
```