Bit-Wasp / bitcoin-lib-php

PHP libraries implementing bitcoin key functions, as well as BIP32 and electrum.
The Unlicense
136 stars 86 forks source link

decode fails to read a vout #110

Closed in3rsha closed 8 years ago

in3rsha commented 8 years ago

The RawTransaction::decode function works for almost every transaction, but it doesn't seem to be read the vout for this transaction.

TXID: 54bbfc96996328578a1617fe7642d2a4d64a3cb373fa9af086e5242fab5a145e

Raw Transaction Data:

010000002517f6a08b306e052502c0a368f8e922bb26695ce1f60732d3cffa4e0def032160000000006b4830450221008330651d4af55b632adad4be63f45228eb68447252046ceceacd40aa41f459800220696467edc565a7779ea4f5f9def585bdcdc8e1d9f7e88de5d35f26274e2c38fb0121039f9d13867a2071f3d90d00b1385cc192764d0c30965e5e48576b9589901ac070ffffffff3bdb51fb949e3ea4dd394db8b1e2413e24a3d4b03d348e961c385330a597155c010000006b483045022037c53fe3d0b39769a358910cd8fbc14ccd5a32ff0c1b297b78803ea405803e3e022100afedb753906df597a63d29db8bb050e8eeef668b4cb1b3452baab47042f06c55012102fcffafac2cb3494565f15841036757b0f857abeb8b1363e345779e037ad86146ffffffff1d1a19198da4c3adacf86938b452e9f2d6390418960e086e27768be50cd6937d000000008a4730440220128ba33e187194306fe5df48166401a43696d8386400a7afb2a80b3a4aec09fb02206d97b598cc729bfc58b2e98ad60b16da1ff436570a45fda50de4cc1080d1c24a01410451de83274ce471f83a70de99688700b9d5ab0af61444d2c6721a76a03e255e254b4d31baac418aa87ed3c5a98e5962bf79512eea35186715ad8f468407143b09ffffffffa3c4806c28bda643ba4ac313d4be0f9d2c4a866bee4eeac98df3a276eb13d8a2000000006c493046022100d64662a938c69155b3d7fc8f0c4aee3236d5cbbfad9fadb66e2ca9f7b49a54e9022100a312c83c2ee8c0183f111af3e45300ec6abc3dc411f3bc51113f6a0bf33ac8aa01210354a3a83a884e90c214cb4b9529ff4d0d0829d751b6ca8446beda1a7d0b16731effffffff1a50052257406d00737bc0001455dad29de1180a4b4788de5348988edb6ad9bf000000006c493046022100f439846181579c226a528c129d152562f746f2c4620dccbf13309924b8891a1c022100c30ba3428dc7da613c022c021a76ba864aabae9e6a890019856a4396667740ab012103120061a53f20e412d9a56efd353e99e33ba7d646004496afa54996c7d402406affffffff683befea423a6d32c9c7da7b7ece84c7aaaa5eb8f7e797a752a2e81e4c4390fd010000008a4730440220569457e5897a4d9f3473f277f821b04b0508b703895003edd45f4b45e445d64a0220379423a8a0845a2a6eb4b2aaaa5956c7224363cd108cb07319ab911d7f5a7e8501410446217dd51e03af8791ec5dba4d2906f43840d00d01b9946de2546c1a6afaadcbc514879661ae0a0f3fd0cb831de0c27425a4a8b7f49710d01dbabd2ea661f8a9ffffffff3af8cb8239126deeb0a70ec9c89930940f6e1db09593e859f8fea480fc21a7c0010000006b483045022100d82a8ed5b7a5adf152a85cecc76051d26b73da19ac8ad5c54ff77b546843a5ae022071a2edff3b80597de15ce4ad4e673eb2827f6af5dc498ebfa52debb96ed0028f012102395dccfbd1f7fad6998538ce808a3fc80cb9fc2d6f86b254ebbc2af8c3189079ffffffffd6d05cac22487ddc63fa361c998fff5e48f6fe54504f39db3f650092ef8bb9fc000000006a4730440220262823164a9855317ec291323ef672a59210f26e1c6543dcc6faa51e89be2a750220019c243d5ecfea9950b2550079b2dc73d92c237c9d4e2af541e704715132fa96012102f047bb510c212c6542f3a413a6065e1e734fc376f88555cd674ea21a802bc094ffffffff21a4f0dc066745a1f77ff3e0156e99e63c18875000df926d91c32b933b21f237000000008a47304402206fa058beca6b5b59abe2646b7710a2a25b0287ae205068add7c6a93d1d43f0280220663707ccfbfc8873f904b376106e6b24cbafb742a927a2855ecfa275b9b799ab01410430a2e01923be91dac058e4baceea06a5ba96c601fa52ecb2d7c5d089a36d99b403104701e3dc22e620c9563f4455326d8e8b7b62bf7dc8aa775512a522f7e90affffffff8397db5ff8e6973c6d08b0c8bac1013614b48199d1aa1016cb57ce68019b252b000000008b483045022026a703bbc446e0bfaad33dda82bd0ace5190adbbb79e317ba62f2f71139d8bca022100f3fab4480ab83de0c229f8403549035a399735c91dee0be4fb04922bdaeb3bea01410407bdde4dc34aff3daca7a3e7e98551fb64ff443355941990219f01ece841214b73dda16055a30986c9edfca17da7546bbce2b63219516c01dc1f25f61bd9df36ffffffff0e4e074728236acf1f3c0e6174143d60c09252dedb5fecb0e87734dd152bcf70000000006b48304502207afaa77d29fb51642a9d72ac8aa681917699612f0a3185d14ae382998a563b3c022100907509951ed1ae3fd5fba0e398ef7cc933ad5e11d516fe835cad98793d2359f0012103ed079150248f74210f43359a424c28aba617e96ef950fe24f522e0e9e3349618ffffffffe30ac821b47bd95f641d476dd38b8a372a9e6f37ac78cf8ebdff4d1f5aff0916000000006a47304402201b2e4c7a9c8e6bfd3b2f2cb1b4995f3dabca1e91faec1c171940570eb4ba364102206f94dff28ab31ec65aadabca7d7c710d6f0d6d4ad325a69547386a76a02a6363012102dd0ae2b35804c72ed0f6e1244eb81d4982f5f946ae6c058d72edfc67b0410f30ffffffffd2bc614391d79861cd36c150db96b3d63fabcfb025e76eacf396acf9e505c16f000000006a473044022044d59e4199a12ddb0423517e5b546b1ba7c87baaa9fd1799a9c01f74476cda4702207bec9e5c64dc40193c7fd71f62008f3e500bde7d830701aff310e7bb157b288c0121037cfe7724bc1ab30061b2624e3618aab8bff1fc70a02880526057fc74d6fc49b6ffffffff4372f4eb4c67da16dbaadaf1076ed68a2277b1cc4086e388e5628545860d41b9000000006b483045022100e1268ffcb6c8a29510262b3f814a3b4ad6e2bff2d636a86ebee46de7aa6bfc4002203900b77eef0bd00ac28e96b4908e80d00a38d887e9a4453d9558fed1e70b8d6c012103694b201eae72e12290ddcf19c034d634bf6d8564d5fabbd0a691982cd90490c6ffffffff56c9d5696a21b05d7986d69e0c84dfa3ec375b52a0d7ef64b019cddd66b24996000000006c4930460221008c5159a8faeb58db2c923552f212e661313263a5c46ea50a265f89a9a522bf820221008a6b4b48a99acca0dc4e94eecb9bc1a6e6f9311938d935f9433d1d5445565f9c0121030252aa037db753e45ee71e9369f9a788cf2eae054e5c75416895dc9957bd815fffffffff0f3e0d1b4fe0630ba01feba46a9a5ae6d6d8e8b57bf870802e42df169413646c010000006a47304402207aae319cf9e18668a016300b6e90645a30b34fd8a879eedaa9a32b43e44db5d402202966d1334d9e85ded13a625f84ebf9d37ce9980c2d06875426acfa1e6c5ea9d901210373578c49c3945d8b687937af189f6058183ac99ecc6f70316b2bd4d30b9a3f96fffffffff07c7ebb7052b6c1c4abf5eabdda56b48c172ab82d73fc7a0babf7ed3519c70e010000006c493046022100a060739cb9da5f7fefdfc6c570f6b22952faf72b45ba00ca6998d711543478d9022100dff478b7d76085e166b44ea72a1c8cd2db4415c19d40d2133464ade1a629af7e012103743e5a8a8b3388c1a11165a7c28e5243bdaebfa380b893a44faaee3c0bb3c56affffffff00ad7c9a03472a62a21cd8a341cb3d3c0daea71806ec64733c4248b1178ba445000000006b48304502207dec28c2148b70e9ec807281a23c5dcae25a1b6989fe84b0e714e11248d99165022100d6ebe6a00508868913f1f2758495bda4b77bf7ca7f7eb1fd8d079f4f61d273b0012102d0e38e4847dc3cfd76b5205e2a361f1493ad21219b617e7114ae6db0cd7b6525ffffffff6bbe809162565056f85776763b9bda0d7b28c1e6c2c64702b68196331743a243000000006b4830450220675d8b3920aa8045a7c75c8a29334c3b70bada5aa3ca98eb6cc2bb97eccfa030022100df365ede37f208c663bb0b818aa93ab348556fd143b8c35fe0ba698db8b2ca96012103e75a15fcbbacb79d0705654a14b787168ec5d3f5ddd1f007c2108dbc582a8144ffffffff252778f0c2befa0ce65fc703656237a995d992b82529a017e2118360d6ac3abd010000006b48304502202bb9a871578b80aa6eea606f2d0f306dc400300662df61792c02927e9409e5d4022100b5c009c79dea1c1f162d6e9ba0f913c9c447f497eddc6367d931d866c1993ed701210360088e7df0fe9744fa708cf631dadb51616054a886d75d0893e10175adf5cb35ffffffff83a35f5de7f1d3894786e13c57e0cee3e52e00c6d0384bb67a8cfa434534bc90000000006b483045022100abca773d0e60243f2388f6ac48a2b0830ec842af56030726bc6f11045e791c42022010743b718e2172e45b0ac83cbd7c8c3c268fbbbd7f5d9ba17be6c577e5b0a6b0012102d58135da77e54604bbfd01729e60e5405a0070cbed6b979435ba164940d0ffc1ffffffffd999794b56b61029e4a4b9033ccf11424dfbee3467baae57f6f48e4e551e92cd010000008b483045022100dfec4c450067e907e4d6c0f29479e13b07eeca40176ee811c3e7aebaa4cbea78022051d458bf7d8699508a9f35c1f538c8fe5264ca255485dc9e5644b6affba90f7301410458fa61860e956860468f4353d2b2a9d9944b651986da2b1e207715595d567a60520e524ec8f384b659c524aa4a5247a703d5ac27c1c3b7f1a1392058f7ae435effffffff0af87fb4576870138c746e17f5c5ab71a443c54d730ec1f3d84caa69d2e1135c000000006b483045022100c41f6535f99935fbfa9495209907a90bcba8baedeb04b62276ea65d3df7aa572022052c153c8e5762fb7d9ff0f8c639b7d7c5e05be31dccbfdb3f23f27e73603307d012103026443604b26a3e6118f0eacdcbf9b783c6b35955aa1c4436bdcf51905cb58b5ffffffffef2a308999f8f0f871b0e5b84af5e3155365c48dbe26b5638ad1498615f6a6a5010000006a4730440220758eef701004d265a78963eb32eaba5d56f504feccda5b3b9ba7e6389144a87a02206c40dbe8f8f53c4f1bca24a62f015ce6d0afddb3b33da4a569c00e60c4accfba012103457f47babe657b9512661a8685051eb8524c08aa4a86a583483b80c06628a26dfffffffff0eb14ef95a2fe4a980687da94b635d689be2c620e3585fc7cf05235ba7c82df010000006c4930460221008315fa79f15c8c3f597a663261baf469003636cb6ca77f52c77f2f6d4e62c5dc022100d55dcfdd97ba20d9ed5280b47361f5ef089f97ec76999f186651a6d057adc0bf012103f94800cdc3a143e15d9e61aef7bb0053a82ccd3e8b78a76e79634a90cf6707e0ffffffffdac89205ab608955825312319554580fb15ad66558a121fce3bb4d27fa405165010000006b483045022027ca3e04869357ba075db07e8e6d400817683be0acc2d8a0278f5ecf609da86e022100e41299c046b9315b8bee9f070110d070fbfefc439ba0f7ad3766f68b0b8922b3012103483c0e962c743e8eb89b252a0af03b31162115d56a9e8010ca5e0465eda83958fffffffffc70e9016a059463b262a43310033e891900e809afd994d82e9e618080ce201f010000006a47304402202c5e2badf3c890c16a43852c0840afe54c55f61706fcfaacdfbc920a4762cafb0220757f50eb80cfb0f928aca360a3a876832f87aec028b0559f29669780f59110f7012102a2f029560433a73cbe6a0614edb7a4d9cd42ff252e7c621425c57d2dc6cedf19ffffffff739c76d2cfd5d542da93b897fc9e85b04156e0d06eff2c5092c75eccdd607ffe000000006b483045022014c20b0394c76e36b95b3ff10de57c8ba90de8ae073782202ecdb73d281cdb7f022100fb3cc6285dd2e4cf299fae22c3740e3f9829e69429ce92848200133c988381a901210244cb96c6878c6c617ebca08e7bdcb5507ca7e83f8f64bfa4e8542c02e5828afaffffffff106ad19eefa49ec472c8ceebe960e4c04e3579ceaf5113b9d49e0694dac65c0c010000006a4730440220367f63d41fc29c0d806aa86df4f74dab161db356cf118787dd404bf91d08317b02203ecdacf7f0cc17c1256a42fd3ec82e572c487298b7d6ce557d15201519d2147c0121024d5adc05c1b5fbcf962e16085906fded83f069579ebf33ae96d34bde55ba9bd1ffffffffb1d5c8ccc27d8ccb1eb32dec38dff486db58d55e0dab5154e44ac4099834d9b6000000006b48304502202b7adbf7798df05707197b2aedb2200d62c4bb252b2696bea213edc78d2de9a7022100f27e4d8de0854b155a61845a4b9d4b3f398c553bd91f9394d12710386df3076c01210240d59ce2e53ae4bd9de3082e51cfe24342aaa5976ab8710b4a7d8b3ca737251cffffffff476b2fe3e8bbec292e5d0f98d591ea6a777523f4e6dfa1c1cf22cada8deae122010000006b483045022066a71161089c96d75fed907cdf75cce4ca98c50b2ebe6c56e54d8b4bbcd0267f0221009efb58d4b04472bc10975a6f60bbf3d8d503e14f6dcff5192b17f24d981ea463012102321fb21f34f1e1ad333d28f6cfb1e0f630e0e716f6edb2669f4ee445468b6439ffffffff3c54e0b0ca84757bc8c6a3a2325ae6bc0d36c6641e67f272b5c4a684d14def08000000008b483045022026dd833ba1dca09b2bfd250684e62b4a8a2bcd87ddf0d7f72784976baeb657b0022100cb58f298ecfb46318aaa865de091f25d23c62106478b5d62f2e88b661ec64678014104d31fc3a7137d961775fea0d69d10a5f19ce705839092c77c2e96e704918dfe496d2d02507f2e3d3f2e63badb95b3a82f07290f764a0d891290e7ade9d906f08fffffffff5f5f1ba68cb174bde44e9a980c1853152ed4796036b2e285710479ccb42edc51010000008c4930460221009df2af2dc9e804ee3d9165e67fd02b6c18a0561ea461f8542f71ae2ead2ed2ed022100c0bc24f2e88ef93cd6a271f3a6493dc86cd75ad098fcc9475369f7ee177887b10141047c8a2a881f7be338b0f0f232ca645b6bb7bf9944727d95ce72048d2370aa742465cceffbe86101c195c8364967885c6f603d11a0eaa972864ac0773ff2b10825ffffffff023cd4ab7e9c7aebae09abac93565cce40bf6b34d03ef878256d46cec772afc5010000006b483045022024f715b0f538a743238fae0db383311ab308b605ff967909dc0dc7581b628f99022100e05354d8295e5353baf42e7a4c0e4b339ecc1c88b9624d7b3c9be889f8def1b80121027892ec4eb9c8ddfa7465f244a8cd5f31b6f9cf7730d061f06926f6c733a58e8effffffff56e2e7b06316a5c8755ae09573c66363b4c2634241d93de3cf321c1c08c46789010000006a4730440220607171bdf81a7b59a04511ab95cfe51a1672d927f83e8c37ff1012891c8c9a990220768a54057e0ee64c6ae95769d41e861c49ce9b3aebf38ba4582f627a415c5886012103a2a6e3770e8b8035bc09e0ef611e1bb41e0fa54403d88ea25308d3f8ac499daaffffffff86ae2246b8f8f3b33dcb9d8dc2b0a9b5e084473e94b4d01d9bc58a9c9cbe7d23000000006b48304502205397f969bdb9fc0ea57e9a53620cadf36543bbf6beafcb4185579d77a0362cb60221008f271266fafa4206935c360f66e7e3a2ad6c130d0afb71e72f1dcde82d4c0d720121026a39d80b09e32b55e921845b90a15ed48165a14bdde39ed7f5953b0c134ef838ffffffffe0256c13fcb7c09de05a2b48677643a9f10e6174b094c2f2c7d65763d38dd32c000000008a473044022028908ed5a30971d34f04694faebe9f6bccf4bf3fdfc472605a8498dda3a4e6590220227c9af82f663b804cd7f2107ba3670766ae90ef3adb66cb766dc6901c51a2c0014104c2ca92f5ef8d25d8e0f673b754153b206d67e7f0017691ef256b3140171cc2dd92b4e535299b74aa7cf69c9deccdd470a22332867dfd9f8dc67e1437974b9483ffffffff01405652066b0000001976a914724ca9d8cf7c2cae27e6e6ba159e0af6183780dc88ac00000000

The results of bitcoin-cli decoderawtransaction are able to pick up the vout:

http://learnmeabitcoin.com/explorer/transaction/54bbfc96996328578a1617fe7642d2a4d64a3cb373fa9af086e5242fab5a145e

I can't figure out why it's failing. The transaction data doesn't seem unusual.

EDIT:

More examples: TXID: 44d9919f4ec5579351073de20ac5117cda9989f31a6556c9d0ec8eb61c0a45c5 TXID: 4a56c1161f3ae25c90e0e6adef4a514c3e532fd71bd99e74717058a7394e0649

afk11 commented 8 years ago

Strangely this works for me, although I know there are older versions that struggled if the output script's length was greater than ~256 bytes. If it was a recent version I'd take a quick look if you have an error, but I suggest you move to bitwasp/bitcoin https://github.com/Bit-Wasp/bitcoin-php as it's more complete and actively maintained.

in3rsha commented 8 years ago

Yep, I believe I was using an older version of this script (installed using composer). Thank you.