交易处理
HyperCli提供了交易处理相关的功能,以下是该功能的参数:
- $ ./hypercli tx --help
- NAME:
- hypercli tx - transaction related commands
- USAGE:
- hypercli tx command [command options] [arguments...]
- COMMANDS:
- send send normal transactions
- info query the transaction info by hash
- receipt query the transaction receipt by hash
- OPTIONS:
- --help, -h show help
可以看到tx命令有三个子命令,下面我们将介绍这三个命令。
发送交易
send命令可以用来发送普通的交易,以下是它的参数:
- $ ./hypercli tx send --help
- NAME:
- hypercli tx send - send normal transactions
- USAGE:
- hypercli tx send [command options] [arguments...]
- OPTIONS:
- --count value, -c value send how many transactions (default: 1)
- --namespace value, -n value specify the namespace to send transactions to (default: "global")
- --from value, -f value specify the account (default: "000f1a7a08ccc48e5d30f80850cf1cf283aa3abd")
- --to value, -t value specify the contract address
- --password value, -p value specify the password used to generate signature (default: "123")
- --amount value, -a value specify the amount to transfer (default: 0)
- --extra value, -e value specify the extra information
- --snapshot value, -s value specify the snapshot ID
- --simulate simulate execute or not
您可以用以下命令发送交易,它的意思是连续发送10笔交易:
- ./hypercli tx send -c 10
如果命令执行正确,您将看到以下输出结果:
- {"jsonrpc":"2.0","namespace":"global","id":1,"code":0,"message":"SUCCESS","result":{"version":"1.3","txHash":"0xefbc9f9b5048337fbaf64047ad5eff03c40c1c76991b0364686ba3620e2c5ea3","vmType":"EVM","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":0,"ret":"0x0","log":[]}}
- ...
- ...
- {"jsonrpc":"2.0","namespace":"global","id":1,"code":0,"message":"SUCCESS","result":{"version":"1.3","txHash":"0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d","vmType":"EVM","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":0,"ret":"0x0","log":[]}}
选取结果中的一条txHash,它之后将被用于查看交易的信息和回执。在这个例子中,我们选取这一个txHash:
- 0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d
交易信息
info命令可以用来获取交易的信息,以下是它的参数:
- ./hypercli tx info --help
- NAME:
- hypercli tx info - query the transaction info by hash
- USAGE:
- hypercli tx info [command options] [arguments...]
- OPTIONS:
- --hash value specify the tx hash used to query the detailed information
- --namespace value, -n value specify the namespace to query transaction information (default: "global")
您可以用以下命令获取交易信息,它的意思是获取某一笔指定txHash的交易信息:
- ./hypercli tx info --hash 0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d
如果命令执行正确,您将看到以下输出结果:
- {"jsonrpc":"2.0","namespace":"global","id":1,"code":0,"message":"SUCCESS","result":{"version":"1.3","hash":"0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d","blockNumber":"0xf","blockHash":"0x2592e0f3e1f156effe93325a60b1190533be2053aa102eb182bd64f95b28080a","txIndex":"0x0","from":"0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd","to":"0x6201cb0448964ac597faf6fdf1f472edf2a22b89","amount":"0x8","timestamp":1512022032747286761,"nonce":5475154203949975728,"extra":"","executeTime":"0x5","payload":"0x0"}}
交易回执
receipt命令可以用来获取交易的回执,以下是它的参数:
- $ ./hypercli tx receipt --help
- NAME:
- hypercli tx receipt - query the transaction receipt by hash
- USAGE:
- hypercli tx receipt [command options] [arguments...]
- OPTIONS:
- --hash value specify the tx hash used to query the transaction receipt
- --namespace value, -n value specify the namespace to query transaction receipt (default: "global")
您可以用以下命令获取交易回执,它的意思是获取某一笔指定txHash的交易回执:
- ./hypercli tx receipt --hash 0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d
如果命令执行正确,您将看到以下输出结果:
- {"jsonrpc":"2.0","namespace":"global","id":1,"code":0,"message":"SUCCESS","result":{"version":"1.3","txHash":"0xc47b64ddad2be542bfdc5164d447317f5152142ac7961c88332b25f04b31783d","vmType":"EVM","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":0,"ret":"0x0","log":[]}}
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .