EOSIO cleos 命令大全(八)—— sign
EOSIO cleos 命令大全(八)—— sign
EOSIO版本:EOSIO Dawn 3.0
最后更新日期:2018-04-21
说明:以下所有命令均为实际操作结果。
将 nodeos 和 cleos 加入到环境变量并运行nodeos:
# export PATH=$PATH:/alidata1/eos/build/programs/nodeos
# nodeos
# export PATH=$PATH:/alidata1/eos/build/programs/cleos
cleos sign:返回 cleos sign 顺位项和可选参数
# cleos sign
运行结果:
顺位项说明:
transaction TEXT //需要签名的事务, JSON 格式
可选参数:
-k,--private-key TEXT //用于签名的私钥
-p,--push-transaction //签名后推送事务
cleos sign transaction:签署事务不带私钥
# cleos sign '{"transaction_id": "f6e43207694bb65eef053f39acef86f42a4b606d3bd832f0faaa768269126676", "processed": {"status": "executed", "kcpu_usage": 105, "net_usage_words": 32, "id": "f6e43207694bb65eef053f39acef86f42a4b606d3bd832f0faaa768269126676", "action_traces": [{"receiver": "eosio.token", "context_free": false, "cpu_usage": 5570, "act": {"account": "eosio.token", "name": "issue", "authorization": [{"actor": "wengyingfeng", "permission": "active"}], "data": {"to": "wengyingfeng", "quantity": "300000000.0000 WYF", "memo": "issue WYF"}, "hex_data": "c0a65a6c3acfa6e20030ef7dba020000045759460000000009697373756520575946"}, "console": "issue", "data_access": [{ "type": "write", "code": "eosio.token", "scope": "........ctgpb", "sequence": 1},{"type": "write", "code": "eosio.token", "scope": "wengyingfeng", "sequence": 0}], "_profiling_us": 299}], "deferred_transaction_requests": [], "read_locks": [], "write_locks": [{"account": "eosio.token", "scope": "........ctgpb"},{"account": "eosio.token", "scope": "wengyingfeng"}], "cpu_usage": 107520, "net_usage": 256, "packed_trx_digest": "5cb966eaac2c81b7da4664214db7322be7eff0bae1da973cba4f608f4137ad47", "region_id": 0, "cycle_index": 1, "shard_index": 0, "_profiling_us": 352, "_setup_profiling_us": 126}}'
运行结果:
备注:此命令没有带私钥参数,需分步执行。输入命令后系统会提示输入私钥,私钥不会明文显示,较为安全,实际操作建议使用此方法。
cleos sign transaction -k privateKey:签署事务带私钥
cleos sign '{"transaction_id": "f6e43207694bb65eef053f39acef86f42a4b606d3bd832f0faaa768269126676", "processed": {"status": "executed", "kcpu_usage": 105, "net_usage_words": 32, "id": "f6e43207694bb65eef053f39acef86f42a4b606d3bd832f0faaa768269126676", "action_traces": [{"receiver": "eosio.token", "context_free": false, "cpu_usage": 5570, "act": {"account": "eosio.token", "name": "issue", "authorization": [{"actor": "wengyingfeng", "permission": "active"}], "data": {"to": "wengyingfeng", "quantity": "300000000.0000 WYF", "memo": "issue WYF"}, "hex_data": "c0a65a6c3acfa6e20030ef7dba020000045759460000000009697373756520575946"}, "console": "issue", "data_access": [{ "type": "write", "code": "eosio.token", "scope": "........ctgpb", "sequence": 1},{"type": "write", "code": "eosio.token", "scope": "wengyingfeng", "sequence": 0}], "_profiling_us": 299}], "deferred_transaction_requests": [], "read_locks": [], "write_locks": [{"account": "eosio.token", "scope": "........ctgpb"},{"account": "eosio.token", "scope": "wengyingfeng"}], "cpu_usage": 107520, "net_usage": 256, "packed_trx_digest": "5cb966eaac2c81b7da4664214db7322be7eff0bae1da973cba4f608f4137ad47", "region_id": 0, "cycle_index": 1, "shard_index": 0, "_profiling_us": 352, "_setup_profiling_us": 126}}' -k 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
运行结果:
备注:此命令带私钥,一步执行。私钥会在控制台明文显示,不建议使用此种方法。
EOSIO cleos 命令大全(一) —— version