Closed SFzxc closed 6 years ago
@azuchi -san, Looking forward to your help, please forgive the tag
Bitcoin::P::Tx.new
accepts only raw binary. So you should write
Bitcoin::P::Tx.new('0100000000010146da16c6900cb47696feebc60860984399d1bb0c21e4be8912aa40a107ef0d450100000017160014c1d3f92a55e6506422c6550434615f2e34265ae7ffffffff0280a4bf07000000001976a91467120445f4ffdd1b9ca95b8dcd343611d65f6fb788ace2a2744c2c00000017a9144db63f2ce3412854d0718bbf0bc3e80e8a24d0de8702483045022100b6c18b7b3a3cf0689e806b2eb1dba6811d37fa152f461f60a3b1d9ec439c2aaa0220184465e4c16219f4582f48a2fcd0a214d8d56607896e86f86ffa07188807014c01210358ea03d324d68fe8164dff922a5502c297a7e91d6a97381c81d8ed121113084800000000'.htb)
thanks @azuchi -san, but is there anyway to let me keep import from hash by Bitcoin::P::Tx.from_hash(tx_hash)
?!
i followed this tutorial https://github.com/lian/bitcoin-ruby#create-transactions In step
prev_tx = Bitcoin::P::Tx.from_json(open("http://test.webbtc.com/tx/#{prev_hash}.json"))
http://test.webbtc.com/tx
is no longer can use so i usedblockcypher api
orBlockchain.transaction(tx_id)
instead.i fetched prev_tx infor
then i parsed:
but because a above hash dont have any keys such as
['previous_transaction_hash']
or['prev_out']
https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin/protocol/txin.rb#L99 then i got errorDo we have any solutions for this problems.
I also tried import from hex transaction string but sometime this way is not work should i do like this way.
https://testnet.blockchain.info/tx/0ed5e5794ed9378037e76b18a92b8e562fee61fb3cbb538e42c7def1f605e442?format=hex
Bitcoin::P::Tx.new('0100000000010146da16c6900cb47696feebc60860984399d1bb0c21e4be8912aa40a107ef0d450100000017160014c1d3f92a55e6506422c6550434615f2e34265ae7ffffffff0280a4bf07000000001976a91467120445f4ffdd1b9ca95b8dcd343611d65f6fb788ace2a2744c2c00000017a9144db63f2ce3412854d0718bbf0bc3e80e8a24d0de8702483045022100b6c18b7b3a3cf0689e806b2eb1dba6811d37fa152f461f60a3b1d9ec439c2aaa0220184465e4c16219f4582f48a2fcd0a214d8d56607896e86f86ffa07188807014c01210358ea03d324d68fe8164dff922a5502c297a7e91d6a97381c81d8ed121113084800000000')
I dont like hex_transaction solution then looking for a help for above issue, thanks you so much