Bitcoin Forum
April 26, 2024, 05:14:20 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Sending a raw transaction generated by bitcoin-qt  (Read 1606 times)
keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 16, 2014, 09:51:55 AM
 #1

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!

"The difference between a castle and a prison is only a question of who holds the keys."
1714151660
Hero Member
*
Offline Offline

Posts: 1714151660

View Profile Personal Message (Offline)

Ignore
1714151660
Reply with quote  #2

1714151660
Report to moderator
1714151660
Hero Member
*
Offline Offline

Posts: 1714151660

View Profile Personal Message (Offline)

Ignore
1714151660
Reply with quote  #2

1714151660
Report to moderator
1714151660
Hero Member
*
Offline Offline

Posts: 1714151660

View Profile Personal Message (Offline)

Ignore
1714151660
Reply with quote  #2

1714151660
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714151660
Hero Member
*
Offline Offline

Posts: 1714151660

View Profile Personal Message (Offline)

Ignore
1714151660
Reply with quote  #2

1714151660
Report to moderator
1714151660
Hero Member
*
Offline Offline

Posts: 1714151660

View Profile Personal Message (Offline)

Ignore
1714151660
Reply with quote  #2

1714151660
Report to moderator
keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 16, 2014, 09:57:08 AM
 #2

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! Smiley

"The difference between a castle and a prison is only a question of who holds the keys."
keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 16, 2014, 06:56:15 PM
 #3

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!

"The difference between a castle and a prison is only a question of who holds the keys."
keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 16, 2014, 10:03:14 PM
 #4

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.

"The difference between a castle and a prison is only a question of who holds the keys."
keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 16, 2014, 10:15:37 PM
 #5

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?

"The difference between a castle and a prison is only a question of who holds the keys."
bitpop
Legendary
*
Offline Offline

Activity: 2912
Merit: 1060



View Profile WWW
January 17, 2014, 01:09:10 PM
 #6

I think you are not escaping your json

keystroke (OP)
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1014


advocate of a cryptographic attack on the globe


View Profile
January 20, 2014, 12:28:59 PM
 #7

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?

"The difference between a castle and a prison is only a question of who holds the keys."
bitpop
Legendary
*
Offline Offline

Activity: 2912
Merit: 1060



View Profile WWW
January 20, 2014, 12:32:33 PM
 #8

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

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!