Blockstream / esplora

Explorer for Bitcoin and Liquid
MIT License
997 stars 398 forks source link

Unable to Decode valid TX #111

Closed moeadham closed 5 years ago

moeadham commented 5 years ago

Hi,

We noticed that your API fails to decode seemingly valid transactions. Here is a Testnet Example: curl -X POST -d "0100000001e5235d990ceb8b801379c4f2270b5d2acdd605d6875f22409a2b31cae62adc9601000000fd5e0100483045022100eea12c57b49ea629dd5cc63557bc1c4680fa839d614aed7891940e40aff878640220169ccaf0d0af507c730335a36f51b60f933e76c6624ab9822a6c3cb333dbb1ea0148304502210097fadb88639f668b5fc8936b977a6b40dc95207055517bf5899c323845657f39022042088222523d76e2386cb83943a249cd1be40dde152927969149d0967f22e7ba014cc95241048aa0d470b7a9328889c84ef0291ed30346986e22558e80c3ae06199391eae21308a00cdcfb34febc0ea9c80dfd16b01f26c7ec67593cb8ab474aca8fa1d7029d4104cf54956634c4d0bdaf00e6b1871c089b7a892d0fecc077f03b91e8d4d146861b0a4fdd237891a9819c878984d4b123f6fe92d9bbc05873a1bb4fe510145bf369410471843c33b2971e4944c73d4500abd6f61f7edf9ec919c408cbe12a6c9132d2cb8ebed8253322760d5ec6081165e0ab68900683de503f1544f03816d47fec699a53aeffffffff02383f0200000000001976a9147eea3e5a31f763618380947b5212b28b28999caa88ac490e31010000000017a9145629021f7668d4ec310ac5e99701a6d6cf95eb8f87000000002bb634010000000017a9145629021f7668d4ec310ac5e99701a6d6cf95eb8f87" https://blockstream.info/testnet/api/tx

Response: sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed"}

But, this is indeed a valid transaction. Example: https://coinb.in/#verify or https://live.blockcypher.com/bcy/decodetx/

shesek commented 5 years ago

This error is coming straight from bitcoind. I'm getting the same error from a local bitcoind instance.

It seems like the transaction has a few extra bytes at the end: 2b b6 34 01 00 00 00 00 17 a9 14 56 29 02 1f 76 68 d4 ec 31 0a c5 e9 97 01 a6 d6 cf 95 eb 8f 87. If you remove them, the transaction format becomes valid and fails with Missing inputs instead (meaning that the inputs were already spent).

coinbin and blockcypher are apparently ignoring extraneous trailing bytes, which is not the correct behavior.