加密货币:检查交易是否可行,主节点输出

时间:2018-08-25 20:27:30

标签: rpc bitcoin cryptocurrency

我正在开发类似于https://gincoin.io的用于主节点自动化的工具。

我正在尝试找出如何对主节点进行事务解码。

据我所知,该交易必须满足以下条件才能成为可行的主节点候选人:

  • 每个硬币规格的发送金额必须与主节点的发送金额完全相同(例如,完全为1000.0个硬币)
  • 这些硬币都不应该花费
  • 交易必须由足够的同行进行验证
  • 发送和返回地址必须匹配(必须是您自己的交易)

从我收集到的情况来看,启用了getrawtransaction的{​​{1}}呼叫客户端是提供准确交易信息的唯一工具,因为txindex仅用于钱包内部使用。

例如

我通过gettransaction的收款地址向我自己进行了以下交易:

enter image description here

执行时

yPNYZoqKHMM49z1JzvCFAzrSTJpKmVmMio

返回有关交易详细信息的以下信息:

$ dash-cli -testnet getrawtransaction dd4011a1892a49d9109c299cad6a902ea60aff5a76f49c7d43f1a28861d0a8d3 1

{ "hex": "01000000027d0511a068dc2b978f840d761c64760307c3eea44eecddbac3d458ed4848b8af000000006a47304402206d040ff0825fa11af1fa497f9e9ca52218b7576e61679ce73475a899d1d005420220572d6104cab20d1abc77eec0e8d50b78f20ad0aaa5d7720878664a38af90a0c00121030613391de767cf19d8dd1fd3275ce661f5ff1e341e0130d7ade004b4a37c0607feffffff7d0511a068dc2b978f840d761c64760307c3eea44eecddbac3d458ed4848b8af010000006a4730440220296f0c7f8a8a538613e10644454c2146cc978509963a5bfe2211c8126c19c03502207c3310582e08585a2e9329cd14687589da58c3ff730ad75a0bba06a846de0caf01210393b4249c1d422cda439e9629ecb80c23aa0586082c5473ae509c94b395d0d061feffffff028b9e7851000000001976a9146be245a75e9e2b49f3392d260a06249de2396d3388ac00e87648170000001976a914217e65d7d68fc632e1ae63b7536c900021fa927288acd93b0300", "txid": "dd4011a1892a49d9109c299cad6a902ea60aff5a76f49c7d43f1a28861d0a8d3", "size": 372, "version": 1, "locktime": 211929, "vin": [ { "txid": "afb84848ed58d4c3baddec4ea4eec3070376641c760d848f972bdc68a011057d", "vout": 0, "scriptSig": { "asm": "304402206d040ff0825fa11af1fa497f9e9ca52218b7576e61679ce73475a899d1d005420220572d6104cab20d1abc77eec0e8d50b78f20ad0aaa5d7720878664a38af90a0c0[ALL] 030613391de767cf19d8dd1fd3275ce661f5ff1e341e0130d7ade004b4a37c0607", "hex": "47304402206d040ff0825fa11af1fa497f9e9ca52218b7576e61679ce73475a899d1d005420220572d6104cab20d1abc77eec0e8d50b78f20ad0aaa5d7720878664a38af90a0c00121030613391de767cf19d8dd1fd3275ce661f5ff1e341e0130d7ade004b4a37c0607" }, "sequence": 4294967294 }, { "txid": "afb84848ed58d4c3baddec4ea4eec3070376641c760d848f972bdc68a011057d", "vout": 1, "scriptSig": { "asm": "30440220296f0c7f8a8a538613e10644454c2146cc978509963a5bfe2211c8126c19c03502207c3310582e08585a2e9329cd14687589da58c3ff730ad75a0bba06a846de0caf[ALL] 0393b4249c1d422cda439e9629ecb80c23aa0586082c5473ae509c94b395d0d061", "hex": "4730440220296f0c7f8a8a538613e10644454c2146cc978509963a5bfe2211c8126c19c03502207c3310582e08585a2e9329cd14687589da58c3ff730ad75a0bba06a846de0caf01210393b4249c1d422cda439e9629ecb80c23aa0586082c5473ae509c94b395d0d061" }, "sequence": 4294967294 } ], "vout": [ { "value": 13.66859403, "valueSat": 1366859403, "n": 0, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 6be245a75e9e2b49f3392d260a06249de2396d33 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9146be245a75e9e2b49f3392d260a06249de2396d3388ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "yW9tDPWry4F4Yoh2ejVpdvMtjawBpNq2jV" ] } }, { "value": 1000.00000000, "valueSat": 100000000000, "n": 1, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 217e65d7d68fc632e1ae63b7536c900021fa9272 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914217e65d7d68fc632e1ae63b7536c900021fa927288ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "yPNYZoqKHMM49z1JzvCFAzrSTJpKmVmMio" ] } } ] } 部分特别确认了确实1000.0个硬币已按照请求的vout发送到该地址:

yPNYZoqKHMM49z1JzvCFAzrSTJpKmVmMio

但是我该如何检查自己是否一笔交易,以及那1000个硬币中没有一个被用完?

注意。这与特定的加密货币无关,并且可以在启用了masternode的任何通用rpc钱包客户端上使用。

0 个答案:

没有答案