Bitcoin Forum
May 25, 2024, 12:45:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with transaction pushing / encoding  (Read 172 times)
tiehm (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
June 08, 2019, 10:03:26 AM
 #1

Hello everyone!

This is my first time using bitcoin in a project and create transactioins and so on myself. I have the issue that my testnet transaction is rejected because
Code:
 'Error validating transaction: Transaction 54f6fcefa67805ce3f0bf287ea99e145562878489f0fe8c63c04c1c77847e05e orphaned, missing reference b65fec66748b0232a2b453db0aecffbc3ba0c0243953e86e26b94164956556ae.'


I want to send tBTC from 2N5463KY5F8WExmKMMcd7XfK6ZnMAJuz4Cq to 2MvvviSm2c8r9UugpvLxusB9QKRdAzqupEf (all testnet addresses) but it seems that the input is somehow not validated. I put it in with the transaction b65fec66748b0232a2b453db0aecffbc3ba0c0243953e86e26b94164956556ae and vout of 1.

I am using bitcoinjs-lib for this and my code looks like (no issue with showing WIF since it is testnet anyway):

Code:
const sender = ECPair.fromWIF('cRwYEpNL2iQYvV7BLCi1YDfzwVnWwzi6ALjXLiWUgQfnpjXehNe1', networks.testnet);
const txb = new TransactionBuilder(networks.testnet);
txb.setVersion(1);
txb.addInput('b65fec66748b0232a2b453db0aecffbc3ba0c0243953e86e26b94164956556ae', 1);
txb.addOutput('2MvvviSm2c8r9UugpvLxusB9QKRdAzqupEf', 100000);

txb.sign(0, sender);
const txHex = txb.build().toHex();
The txHex is wrong or can not be decoded / will have the error thrown posted above.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6653


Just writing some code


View Profile WWW
June 09, 2019, 08:23:12 AM
 #2

Try the byteswapped version of your txid. Txids are displayed with a byteswapped order, so if you have a txid from somewhere else, in order to put it into a transaction, you must byteswap it. Your txid byteswapped is ae5665956441b9266ee8533924c0a03bbcffec0adb53b4a232028b7466ec5fb6.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!