Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: keystroke on January 16, 2014, 09:51:55 AM



Title: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 16, 2014, 09:51:55 AM
I generated a transaction using the GUI of bitcoin-qt offline.
I then did a getrawtransaction <trans id> using the raw debug interface.

I then took the hex string and put that into another machine which was online and did sendrawtransaction.
But then I get a TX rejected code -22.

What am I doing wrong?

Thanks!


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 16, 2014, 09:57:08 AM
I generated a transaction using the GUI of bitcoin-qt offline.
I then did a getrawtransaction <trans id> using the raw debug interface.

I then took the hex string and put that into another machine which was online and did sendrawtransaction.
But then I get a TX rejected code -22.

What am I doing wrong?

Thanks!

You didn't signed the raw transaction
Use signrawtransaction then sendrawtransaction.

Whoops! Thanks! :)


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 16, 2014, 06:56:15 PM
I generated a transaction using the GUI of bitcoin-qt offline.
I then did a getrawtransaction <trans id> using the raw debug interface.

I then took the hex string and put that into another machine which was online and did sendrawtransaction.
But then I get a TX rejected code -22.

What am I doing wrong?

Thanks!

You didn't signed the raw transaction
Use signrawtransaction then sendrawtransaction.
I used signrawtransaction offline. Then I tried to use sendrawtransaction using a fresh install of the qt client client. I am still getting TX rejected (code -22). What am I doing wrong?

I can use decoderawtransaction and I see scriptSig with two hex blobs after asm.

Thanks!


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 16, 2014, 10:03:14 PM
https://github.com/bitcoin/bitcoin/blob/master/src/rpcprotocol.h#L34 here is the rpc error codes and it seems that you are getting -22 which is a
Code:
RPC_DESERIALIZATION_ERROR       = -22, // Error parsing or validating structure in raw format

So you are not creating the correct structure of the raw format.
I managed to push the transaction. I signed it again though so it has a new transaction ID, right? This makes my second transaction fail as it was based on the first which is no longer the one the network sees.


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 16, 2014, 10:15:37 PM
PS The transaction in the wallet is now invalid as a new one was broadcast. Is there an easy way to clear it and sync up with the new one?


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: bitpop on January 17, 2014, 01:09:10 PM
I think you are not escaping your json


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: keystroke on January 20, 2014, 12:28:59 PM
https://github.com/bitcoin/bitcoin/blob/master/src/rpcprotocol.h#L34 here is the rpc error codes and it seems that you are getting -22 which is a
Code:
RPC_DESERIALIZATION_ERROR       = -22, // Error parsing or validating structure in raw format

So you are not creating the correct structure of the raw format.
I managed to push the transaction. I signed it again though so it has a new transaction ID, right? This makes my second transaction fail as it was based on the first which is no longer the one the network sees.

Signing does not change the tx id, the tx id is a hash of your transaction so it shouldn't change unless an output or something like that has changed.

PS The transaction in the wallet is now invalid as a new one was broadcast. Is there an easy way to clear it and sync up with the new one?

Try -reindex that should fix this issue.

That won't delete the old transaction from my wallet though, right?


Title: Re: Sending a raw transaction generated by bitcoin-qt
Post by: bitpop on January 20, 2014, 12:32:33 PM
https://github.com/bitcoin/bitcoin/blob/master/src/rpcprotocol.h#L34 here is the rpc error codes and it seems that you are getting -22 which is a
Code:
RPC_DESERIALIZATION_ERROR       = -22, // Error parsing or validating structure in raw format

So you are not creating the correct structure of the raw format.
I managed to push the transaction. I signed it again though so it has a new transaction ID, right? This makes my second transaction fail as it was based on the first which is no longer the one the network sees.

Signing does not change the tx id, the tx id is a hash of your transaction so it shouldn't change unless an output or something like that has changed.

PS The transaction in the wallet is now invalid as a new one was broadcast. Is there an easy way to clear it and sync up with the new one?

Try -reindex that should fix this issue.

That won't delete the old transaction from my wallet though, right?

No