sign_transfer - 转账签名
sign_transfer
签名一个只读钱包创建的交易。无别名。
输入参数
- unsigned_txset:未签名交易字符串,transfer或transfer_split返回
- export_raw:是否返回原始的交易数据,boolean,可选,默认值:false
输出结果
- signed_txset:用于提交转账的签名交易集,string
- tx_hash_list:交易哈希字符串数组
- tx_raw_list:裸交易数组
示例代码
首先生成未签名的转账交易:
curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer","params":{"destinations":[{"amount":1000000000000,"address":"7BnERTpvL5MbCLtj5n9No7J5oE5hHiB3tVCK5cjSvCsYWD2WRJLFuWeKTLiXo5QJqt2ZwUaLy2Vh1Ad51K7FNgqcHgjW85o"}],"account_index":0,"subaddr_indices":[0],"priority":0,"ring_size":7,"do_not_relay":true,"get_tx_hex":true}}' -H 'Content-Type: application/json'
响应结果:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"amount": 1000000000000,
"fee": 15202740000,
"multisig_txset": "",
"tx_blob": "...long_hex...",
"tx_hash": "c648ba0a049e5ce4ec21361dbf6e4b21eac0f828eea9090215de86c76b31d0a4",
"tx_key": "",
"tx_metadata": "",
"unsigned_txset": "...long_hex..."
}
}
接下来签名:
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sign_transfer","params":{"unsigned_txset":...long_hex..."}}' -H 'Content-Type: application/json'
响应结果:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"signed_txset": "...long_hex...",
"tx_hash_list": ["ff2e2d49fbfb1c9a55754f786576e171c8bf21b463a74438df604b7fa6cebc6d"]
}
}