奇亚(Chia, XCH) 接口之根据转账事物 hash 查询转账具体信息,使用的路径为 /get_transaction
。
要注意端口号,钱包的端口号一般为 9256
该接口只需要一个参数:转账事物 hash
transaction_id
转账事物 hash
参数以 JSON 格式发送,参数样例如下
{"transaction_id":"0xc8d812e271ed70a6da6bf2e5b357e37c1e21d9aa3809a830024cb62b1f285711"}
请求示例
curl --insecure --cert ~/.chia/mainnet/config/ssl/full_node/private_full_node.crt --key ~/.chia/mainnet/config/ssl/full_node/private_full_node.key -d '{"transaction_id":"0xc8d812e271ed70a6da6bf2e5b357e37c1e21d9aa3809a830024cb62b1f285711"}' -H "Content-Type: application/json" -X POST https://localhost:9256/get_transaction | python3 -m json.tool
返回结果如下
{ "success": true, "transaction": { "additions": [ { "amount": 100, "parent_coin_info": "0x13945f519fb83c363c9ab1cd57a84c247f047d26cdeed55e524e380646e83dfd", "puzzle_hash": "0x2a6739b1d7765269102e047393e69b14c03136ff81e3ed416288fdf237190342" }, { "amount": 9999999900, "parent_coin_info": "0x13945f519fb83c363c9ab1cd57a84c247f047d26cdeed55e524e380646e83dfd", "puzzle_hash": "0xc178192b6a769ad895e6da2e6d8045b0ca0ead2a84df09bf44444054212da769" } ], "amount": 100, "confirmed": true, "confirmed_at_height": 331864, "created_at_time": 1621903747, "fee_amount": 0, "name": "0xc8d812e271ed70a6da6bf2e5b357e37c1e21d9aa3809a830024cb62b1f285711", "removals": [ { "amount": 10000000000, "parent_coin_info": "0x448e7073a631bb12eb88d869937027edc23cf2e15d1e3d2da13b21a541778e2f", "puzzle_hash": "0x2a6739b1d7765269102e047393e69b14c03136ff81e3ed416288fdf237190342" } ], "sent": 1, "sent_to": [ [ "c2e9f5687eccc3213e2514d82d7193c12f73cf4391c43af949df755f32dac672", 1, null ] ], "spend_bundle": { "aggregated_signature": "0x8a960a5edaa0ce06bf78696ad7cf990adb051afd461e5d45c239736ce42261839d1129b3e3ddb95b423ac57d23c3d02f0f350206df805f6049665c7557a0300ad87141717a7dbfcb16129cc0c432055842c666b915b174ed94771b2bb8009f38", "coin_solutions": [ { "coin": { "amount": 10000000000, "parent_coin_info": "0x448e7073a631bb12eb88d869937027edc23cf2e15d1e3d2da13b21a541778e2f", "puzzle_hash": "0x2a6739b1d7765269102e047393e69b14c03136ff81e3ed416288fdf237190342" }, "puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0a0cd89ed8b993596b931451c8c96abf2f4041167b35f762360dc9e135db9e8300e56fecef70ae9eb279626008f394b9bff018080", "solution": "0xff80ffff01ffff33ffa02a6739b1d7765269102e047393e69b14c03136ff81e3ed416288fdf237190342ff6480ffff33ffa0c178192b6a769ad895e6da2e6d8045b0ca0ead2a84df09bf44444054212da769ff8502540be39c80ffff3cffa01137d6024eef23690b9605554f5772122d67ca0f74ac420ca2f95af410c5f6d28080ff8080" } ] }, "to_puzzle_hash": "0x2a6739b1d7765269102e047393e69b14c03136ff81e3ed416288fdf237190342", "trade_id": null, "type": 1, "wallet_id": 1 }, "transaction_id": "0xc8d812e271ed70a6da6bf2e5b357e37c1e21d9aa3809a830024cb62b1f285711" }
如果事物 hash 失败,返回的值为
{ "error": "non-hexadecimal number found in fromhex() arg at position 63", "success": false }
error
指示了哪个字段错误
如果正确返回,那返回结果里的参数太多了,这个的返回结果和 /send_transaction
的返回结果是一样的。
里面有几个参数很重要
success
如果返回true
则说明转账成功,返回false
则转账失败transaction/additions
指示了 UXTO 的资金流向transaction/amount
指示了这次转账金额,mojo
为单位transaction/confirmed
指示了这次转账是否已经记录,也就是打包了transaction/confirmed_at_height
指示了这次转账打包的块高大小transaction/fee_amoun
指示了该次转账的手续费大小,金额以mojo
为单位transaction/removals
指示了使用了哪条 UXTOtransaction_id
这是当前转账事物 hash
目前尚无回复