Testnet

了解 zmq 通知輸出

  • December 29, 2021

我為我的測試網節點編寫了一個區塊鏈監聽程序。它工作正常,新交易的輸出大小與blockchain.com監控的輸出大小相匹配。輸出如下所示:

No: 476
Size: 225
Data: 01000000011DCA0ACF3854FA8B03CD0B9E10EF69D7FF1B3725D1DD6D4AC3365027D04A5657010000006A47304402200EC0C827EF1801492A645BE3820BF6122C4342FDEA09DDCB731B2983FE008BF6022047B3B75FB886CC90DE60384F406552043C4F62512FE8185C063E07B67548A4010121026798EB524F5268DC37590FA0ED5F509D9D6B88DFE09466C8C47C8D1C9BDA19D5FFFFFFFF02789B0100000000001976A914C24E08BD18DB9CE6F2148518A81C455AD7E55A4A88ACD7EA0800000000001976A9145783A390A2E04AB2816F8AE5055CEF872E1F227288AC00000000
No: 477
Size: 222
Data: 02000000013A1CB309CFAB5EFB30861D656D7B82D0674BB2ADB709D2F1AF140220038AEDE5010000006A4730440220445BF7AE1E0218D6B81EE383285953A028A44D6EA282320BB6110AF043B841DB02206440A5F513C7F77951B04A1B1E280DA9F69E846689920AD1CB43A2B03C64780001210200549AECDEE1C04D37E48C255786738DCCEF4B252F4FC17B68B84BDE64314EBAFDFFFFFF0257330300000000001600143E203C210D7938F0F8DABF41A572C8A1A5234ED5F8200F00000000001976A914281C085496BA216418F2E7FD40E5512289A9E94388AC508E2000
No: 478
Size: 935
Data: 010000000001068073E1EB87FC0C458DCFDCC7F10293403738FCA5C4D7EDBDF3EC65B591E8E8620100000000FFFFFFFF619AFFEC74DF56716E63413EB0A63473C606C5E9815D26E78F9F44A89F0DA6A00000000000FFFFFFFFEA7CB92F1EDFA383A9C6CAD1F62FA316822904E201403373358D266F8A69B0410000000000FFFFFFFF58BD97129A5CAA544C4C5C440C5DD367C6FD82860EDBB319D155F3DFA680AE400000000000FFFFFFFF90B4EC9BDBF6D1F0A43BF2579285C8A83CCA18B7809334E15950DAB0DCA58C080000000000FFFFFFFFBD31ABF2269DEB9184AC0A8AA84C79907339909564AD7231C2834002180629BD0000000000FFFFFFFF017696D3000000000016001421E1CFF726A01E72B23A8F4E84CD5C61CB33E9FB0247304402200EFADD24CC2540BCA4BA4A89B1EB43041E81022FDB655ABCBECF38FD811C86DA022036F6D35249CE42DB7AECA736BD5A43AA062A8014F8EB0FBAB13975E374024C670121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD602473044022024BFD3938300D063FF846EA567CF7335096DD08E47EAC20259E251A4A3A756B8022073B148D8187F1E852B0EE4748A5DAF9A4FB185D63C4E9412B3757DD4B92866670121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD602483045022100DFE53FD95F906C3CFC245FD5AF068D4FFBCF25850871A42906A60D1DB2E8139E02205665BA413D0022231FC6E115183C67DE43895711AB8773462B273530471E408E0121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD602483045022100812A858E8652D76BCB67CC37C1CDF927566D1C76964D1051F4EAED87C1F14179022026A3552420DF5DD447D527D12740F4B04AAAEBCBDC65CB0F2F94608889FBAA290121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD602483045022100AAF4D2BCEB00FC345682C262B05DA986EC2AB912B55ABA3E5EE090E4BF2CCE36022066757EDB4E42A2DA9EB8539895E6B757E5EED49AD5B5E908492886183207ABB10121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD602483045022100C303103A72F9DC44696DF905D76428220E921EDDF351702D52EA63C6BC8FC2280220240CF0B2EAF2D11037577A73F24FCEF350CDB929BFE9BC7C59ADFE67DC6825680121020DA6D6F38A51EA00616A03D82A07EB210ACE916B0023BE16F3DA1E661C0B4BD600000000
No: 479
Size: 226
Data: 0100000000010139E9F58DD4CE6B54D026EFDBCBA76352D15421308470ACCBDDA0E16AC76FE80E0000000000FFFFFFFF02D9990100000000001976A914BB278B9DF7442D732ABAB5E786168DFED909AE8C88AC8056200000000000160014D8FFEA4A74B66AB030894C40DD9D959AA17F63B102483045022100DF56898C1195458404504C5577ADE338B30857B3ED8A7A7C5595B5AAB2532FB902200157CBA35B5EF1FF84D4D16E8CA0A6531C539E6637658E5298943DCC164FD4EF0121024C95D2D15CC7A5F75030B3499497B9FE6F3558A753BD9EE7DF8711336CD6886400000000

但是我對“數據”輸出很好奇。它肯定是一個十六進製字元串,但是當我嘗試解碼範例中的最後一個十六進製字元串時bitcoin-cli decodescript,我得到了奇怪的結果:

{
 "asm": "0 0 0 0 1 e9f58dd4ce6b54d026efdbcba76352d15421308470accbdda0e16ac76fe80e0000000000ffffffff02d9990100000000001976a914bb278b9d OP_UNKNOWN 2d732abab5e786168dfed909ae8c88ac8056200000000000160014d8ffea4a74b66ab030894c40dd9d959aa17f63b102483045022100df56898c1195458404504c5577ad OP_UNKNOWN b30857b3ed8a7a7c5595b5aab2532fb902200157cba35b5ef1ff84d4d16e8ca0a6531c539e6637658e5298943dcc164fd4ef0121024c95d2 OP_UNKNOWN 12 OP_UNKNOWN OP_WITHIN OP_UNKNOWN OP_RESERVED [error]",
 "type": "nonstandard",
 "p2sh": "2MzWPh52MLEvKBn1xeXF13vzeM2C55CKTWA",
 "segwit": {
   "asm": "0 d59640c342c73e645f9f927b1ef82e33dc4f1c6453cf619982582529608a1d4e",
   "hex": "0020d59640c342c73e645f9f927b1ef82e33dc4f1c6453cf619982582529608a1d4e",
   "address": "tb1q6ktyps6zculxghuljfa3a7pwx0wy78ry208krxvztqjjjcy2r48quc58ve",
   "type": "witness_v0_scripthash",
   "p2sh-segwit": "2N5mTE37pyN3zoH5AbbdEdG5ycj29jENiyu"
 }
}

我沒有得到什麼?“數據”究竟代表什麼

您收到的是原始交易,因此您應該使用decoderawtransaction它們來解碼它們。然後最後一個十六進製字元串解碼為此(在測試網上):

{
 "txid": "6e31ffc1e39ae5fa3b47a8885125e91089ba05d9fb6fc3e33e5f63bdf02f8b80",
 "hash": "60c3a6dfe8a16c6c22cf051aa2e8c8174598a6a5df5327d73d7d58672fbee49d",
 "version": 1,
 "size": 226,
 "vsize": 144,
 "weight": 574,
 "locktime": 0,
 "vin": [
   {
     "txid": "0ee86fc76ae1a0ddcbac7084302154d15263a7cbdbef26d0546bced48df5e939",
     "vout": 0,
     "scriptSig": {
       "asm": "",
       "hex": ""
     },
     "txinwitness": [
       "3045022100df56898c1195458404504c5577ade338b30857b3ed8a7a7c5595b5aab2532fb902200157cba35b5ef1ff84d4d16e8ca0a6531c539e6637658e5298943dcc164fd4ef01",
       "024c95d2d15cc7a5f75030b3499497b9fe6f3558a753bd9ee7df8711336cd68864"
     ],
     "sequence": 4294967295
   }
 ],
 "vout": [
   {
     "value": 0.00104921,
     "n": 0,
     "scriptPubKey": {
       "asm": "OP_DUP OP_HASH160 bb278b9df7442d732abab5e786168dfed909ae8c OP_EQUALVERIFY OP_CHECKSIG",
       "hex": "76a914bb278b9df7442d732abab5e786168dfed909ae8c88ac",
       "address": "mxaY2b2LRSYBvJ2RZTeyvp6Jpk3c2wqGHy",
       "type": "pubkeyhash"
     }
   },
   {
     "value": 0.02119296,
     "n": 1,
     "scriptPubKey": {
       "asm": "0 d8ffea4a74b66ab030894c40dd9d959aa17f63b1",
       "hex": "0014d8ffea4a74b66ab030894c40dd9d959aa17f63b1",
       "address": "tb1qmrl75jn5ke4tqvyff3qdm8v4n2sh7ca3sm9gxw",
       "type": "witness_v0_keyhash"
     }
   }
 ]
}

引用自:https://bitcoin.stackexchange.com/questions/111492