Blocktrail比特币API收到付款

时间:2016-06-13 19:35:49

标签: payment bitcoin blockchain

在我创建了一个地址,一个webhook(在该地址[address-transactions]上),并将BTC发送到该地址后,我收到了一个回调。

我如何获得付款目的地址(收货地址)?

我怎么能确定?

以下回调:

  

{"网络":" TBTC"" EVENT_TYPE":"地址-交易""数据" :{"原料":"""散列":" f7e57a938f1e1cb0edf3f32d3af1aeb5d97b6fed2cbcd13f72f31e3c49f9c299"" first_seen_at":&#34 ; 2016-06-13T 19:15:45 + 0000"" last_seen_at":" 2016-06-13T19:15:45 + 0000"" block_height":870128, " block_time":" 2016-06-13T20:41:54 + 0000"" block_hash":" 00000000002fc98e5a4b655daef4d609ecc64f3f4bd74220cc516e83e2359d30""确认":1," is_coinbase":假," estimated_value":400000," total_input_value":4460000," total_output_value":4456190 " total_fee":3810," estimated_change":4056190," estimated_change_address":" 2MyCrfyKKb7LMsx5F4mmDVbwQSfEMspaopx"" HIGH_PRIORITY&#34 ;:假," enough_fee":假," contains_dust":假,"输入":[{"指数":0," output_hash":" cadf9d987418db53779cbf2959f936f65ad8ef48e67fba9a2682a927132cb406"" output_index":0,"值":4460000,"地址":" 2N4ufH2284xz1BEFnpi4rU2KZk9YUmtzTtT& #34;"类型":" scripthash"" multisig":空," multisig_addresses":空," script_签名":" 00483045022100b244d43adb41687aa1382a8839e5ed71ead23b85e0080f19eb00842bfddf183b022052c48e9345a060224b6b73066556b1e7af8e6304e9aab4b580477ec6b5ea50d501473044022065b019ba879a361082990e466c74adce23dbe04f73bf5f8b24e68740a39779c6022023d3e0170a420032d25e84c02d4c37f14f83f644ef46f3d3fc71aa86cc937da8014c69522102e395f291278488ba971b94ce7ddef42020c351e7e6066ae0d031215fdaa20a6521035966e7947541ccd494bef89f2035bdddb9ecd74c7865fa5180acbeefedc151e62103820f089836a6a19d1a1c3a9e4a1d6532d2721ffad373fcf8093926c01097945253ae"}],"输出":[{"指数":0,"值":400000,& #34;地址":" 2MsUxzFCWuiJJSouCHko2BkV9u3Md5q9D8T""类型":" scripthash"" multisig":空," multisig_addresses":空,"脚本":" OP_HASH160   02994d31fb6c69f0a0399b879a7713130c75b894   OP_EQUAL"" script_hex":" a91402994d31fb6c69f0a0399b879a7713130c75b89487"" spent_hash":空," spent_index":0},{&#34 ;索引":1,"值":4056190,"地址":" 2MyCrfyKKb7LMsx5F4mmDVbwQSfEMspaopx""类型":" scripthash"" multisig":空," multisig_addresses":空,"脚本":" OP_HASH160   415e211a35874aad3561c72f79d36655bf1829fa   OP_EQUAL"" script_hex":" a914415e211a35874aad3561c72f79d36655bf1829fa87"" spent_hash":空," spent_index":0}]},&# 34; RETRY_COUNT":" 6""地址" {" 2N4ufH2284xz1BEFnpi4rU2KZk9YUmtzTtT": - 4460000}}

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:1)

最后一行(在您的示例中)中的地址部分具有地址。它是一个键,因此您可以使用.keys()并选择第一个。以下是我如何使用python解析它的示例:

data = json.loads(request.body)
address = data['addresses'].keys()[0]
amount = data['addresses'][address]
confirmations = data['data']['confirmations']