在推送交易之前,您首先需要对其进行签名。为此,您需要像这样组装您的事务对象:
{
"code": "eosio.token",
"action": "transfer",
"args": {
"from": "fromaccount",
"to": "toaccount",
"quantity": "1.0000 EOS",
"memo": "memo"
}
}
然后使用上述负载调用abi_json_to_bin 端点,它将返回一个像这样的 json 对象:
{
"binargs": "0000000000ea305500000000487a2b9d102700000000000004454f53000000001163726561746564206279206e6f70726f6d"
}
你可以构造你的push_transaction对象,它看起来像这样:
{
"compression": "none",
"transaction": {
"expiration": "2018-08-01T06:11:23",
"ref_block_num": 10855,
"ref_block_prefix": 473148127,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
"account": "eosio.token",
"name": "transfer",
"authorization": [{
"actor": "fromaccount",
"permission": "active"
}],
"data": "0000000000ea305500000000487a2b9d102700000000000004454f53000000001163726561746564206279206e6f70726f6d"
}],
"transaction_extensions": [],
"signatures": null,
"context_free_data": []
},
"signatures": ["SIG_K1_JwLVG5pRdhvLfJGWkDEBPa7wdLbNeqeRFdvFrKDEryahSwCRpPb75m4auZh8frq6cXsm3dHit8GMbmuuBWxEjH"]
}
您可以更深入地阅读它here.