Bitcoin Forum
April 22, 2021, 12:24:51 AM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoin-cli decoderawtransaction  (Read 156 times)
zoltanb
Member
**
Offline Offline

Activity: 164
Merit: 23


View Profile
December 06, 2020, 07:30:51 PM
Merited by LoyceV (6), ETFbitcoin (2), o_e_l_e_o (2)
 #1

So, I have a signed raw transaction with 1 input and 1 output.
If somebody gets this signed raw transaction the only thing he can do with it is to broadcast the transaction (if it is not yet broadcasted), right?

So, even if the input is signed nobody can alter the transaction to send the input to other output(s), right?

In other words:
- inputs are locked
- outputs are locked
- amounts are locked
- nobody will be able to spend the specific txid and vout to another output(s)
- nobody can find out the private key of my spending addresses

If this is true (and I assume it is), what is the safest way to check that all inputs are signed and the transaction can be broadcasted and it won't generate an error? Can I test the transaction will go through without broadcasting it?

Thanks in advance for all your comments.
1619051091
Hero Member
*
Offline Offline

Posts: 1619051091

View Profile Personal Message (Offline)

Ignore
1619051091
Reply with quote  #2

1619051091
Report to moderator
1619051091
Hero Member
*
Offline Offline

Posts: 1619051091

View Profile Personal Message (Offline)

Ignore
1619051091
Reply with quote  #2

1619051091
Report to moderator
1619051091
Hero Member
*
Offline Offline

Posts: 1619051091

View Profile Personal Message (Offline)

Ignore
1619051091
Reply with quote  #2

1619051091
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1619051091
Hero Member
*
Offline Offline

Posts: 1619051091

View Profile Personal Message (Offline)

Ignore
1619051091
Reply with quote  #2

1619051091
Report to moderator
1619051091
Hero Member
*
Offline Offline

Posts: 1619051091

View Profile Personal Message (Offline)

Ignore
1619051091
Reply with quote  #2

1619051091
Report to moderator
LoyceV
Legendary
*
Offline Offline

Activity: 2198
Merit: 7835


Thick-Skinned Gang Leader


View Profile WWW
December 06, 2020, 07:39:00 PM
 #2

In other words:
- inputs are locked
- outputs are locked
- amounts are locked
- nobody will be able to spend the specific txid and vout to another output(s)
- nobody can find out the private key of my spending addresses
All of this has to be true, otherwise anyone could do the same right after you broadcast the transaction (which also makes it public).

Quote
what is the safest way to check that all inputs are signed and the transaction can be broadcasted and it won't generate an error? Can I test the transaction will go through without broadcasting it?
I would use coinb.in after downloading it and copying to an offline air-gapped system running from a Linux LIVE DVD.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 2450
Merit: 3727


Just writing some code


View Profile WWW
December 06, 2020, 08:11:50 PM
Merited by LoyceV (4), o_e_l_e_o (2), malevolent (1), ETFbitcoin (1)
 #3

Can I test the transaction will go through without broadcasting it?
You can use the testmempoolaccept command.

zoltanb
Member
**
Offline Offline

Activity: 164
Merit: 23


View Profile
December 07, 2020, 08:52:11 AM
 #4

Can I test the transaction will go through without broadcasting it?
You can use the testmempoolaccept command.

Thanks. testmempoolaccept is the command I was looking for. According to https://bitcoincore.org/en/doc/0.20.0/rpc/rawtransactions/testmempoolaccept/ the result can be true or false.
I checked with a transaction that was already broadcasted and obviously it returned as false because the inputs are not present anymore.

{
    "txid": "c77c...042b",
    "allowed": false,
    "reject-reason": "missing-inputs"
}

If a transaction is not broadcasted yet, does this also check if the inputs are signed or not?
Or, what are all the "reject-reason"-s messages I can receive? Couldn't find it anywhere.
ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2752


NotYourKeys.org - Not Your Keys, Not Your Bitcoin


View Profile
December 07, 2020, 10:05:34 AM
 #5

Can I test the transaction will go through without broadcasting it?
You can use the testmempoolaccept command.

Does it test against default bitcoin core configuration or your own bitcoin core configuration?

achow101
Moderator
Legendary
*
Offline Offline

Activity: 2450
Merit: 3727


Just writing some code


View Profile WWW
December 07, 2020, 04:44:50 PM
Merited by ETFbitcoin (1)
 #6

If a transaction is not broadcasted yet, does this also check if the inputs are signed or not?
Yes. It does every check that would occur if the transaction were broadcast. It is the exact same code paths as the actual mempool acceptance logic, minus the part where it is added to the mempool.

Or, what are all the "reject-reason"-s messages I can receive? Couldn't find it anywhere.
All possible validation results can be found in the TxValidationResult enum at https://github.com/bitcoin/bitcoin/blob/master/src/consensus/validation.h#L24

Does it test against default bitcoin core configuration or your own bitcoin core configuration?
It tests against whatever is currently running.

zoltanb
Member
**
Offline Offline

Activity: 164
Merit: 23


View Profile
December 08, 2020, 06:59:17 AM
 #7

Thank you achow101. You have been of great help.
zoltanb
Member
**
Offline Offline

Activity: 164
Merit: 23


View Profile
February 25, 2021, 12:42:58 PM
 #8

Can I test the transaction will go through without broadcasting it?
You can use the testmempoolaccept command.

Is there a way to use the testmempoolaccept cli command to not return false information if one of the inputs are not yet included in a block?
I tried the testmempoolaccept with 2 inputs, one has several hundreds of confirmations, the other one is not included yet in a block (is a zeroconf input).

"allowed": false,
"reject-reason": "missing-inputs"

I assume it rejects the transaction because I am trying to spend an input that is not yet confirmed. However, what if I want to spend that input on a CPFP transaction to broadcast the original transaction faster?
nc50lc
Legendary
*
Offline Offline

Activity: 1302
Merit: 1765


Self-proclaimed Genius ㊙️


View Profile
February 25, 2021, 03:05:05 PM
Merited by LoyceV (1)
 #9

I assume it rejects the transaction because I am trying to spend an input that is not yet confirmed. However, what if I want to spend that input on a CPFP transaction to broadcast the original transaction faster?
It should return "true" even if the inputs aren't included in a block.
It's probably because the parent is currently "not in memory pool", using sendrawtransaction to the parent before attempting to use testmempoolaccept to the child should work.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 2450
Merit: 3727


Just writing some code


View Profile WWW
February 25, 2021, 06:20:20 PM
 #10

Is there a way to use the testmempoolaccept cli command to not return false information if one of the inputs are not yet included in a block?
I tried the testmempoolaccept with 2 inputs, one has several hundreds of confirmations, the other one is not included yet in a block (is a zeroconf input).

"allowed": false,
"reject-reason": "missing-inputs"

I assume it rejects the transaction because I am trying to spend an input that is not yet confirmed. However, what if I want to spend that input on a CPFP transaction to broadcast the original transaction faster?
testmempoolaccept should work if an input is in the mempool. Your input may not be in the mempool, you can check this by using getmempoolentry with the txid.

Currently testmempoolaccept also does not allow you to provide the child transaction either, but there is ongoing work to support that.

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!