LearnBitcoin

Bitcoin Dev Archive 2018

Few questions regarding ListTransaction

10 messages, 10 to 11 Apr 2018. Started by Maksim Solovjov.

Karl-Johan Alm (4), Maksim Solovjov (2), Peter Todd (2), Joseph Gleason ⑈, ZmnSCPxj

Permalink Original thread on gnusha.org

Maksim Solovjov permalink original

Hi,

I have few questions regarding ListTransaction RPC call and I hope you can help me. Documentation for the RPC call is here: https://bitcoin.org/en/developer-reference#listtransactions

1. What does it mean for a transaction ( with 0 confirmations ) to be *trusted* or not? There is such field in the response of ListTransaction As far as I know bitcoin - nothing is trusted unless there are some numbers of confirmations. How does this value is set to true or false?

2. When does *confirmations* can be -1 ( conflicted )? What does it mean to have conflicted transaction? Is it about Transaction Malleability? Double Spend? or both?

3. *walletconflicts*. What if I add watch-only address to my bitcoind process. This address will not be a part of my wallet. Now, someone will pay me to this address and someone else will make Transaction Malleability ( for the sake of example, lets assume this second one will be confirmed, not the original one ). Will I get a first transaction in *walletconflicts* array when ListTransaction will return me second transaction in the response?

Thank you in advance!

Joseph Gleason ⑈ in reply to Maksim Solovjov permalink original

2) -1 doesn't mean conflicted, it means the transaction is not only unconfirmed buy depends on another unconfirmed transaction.

1) Depends on what you mean by trusted. If you are giving the user online access to something that costs you next to nothing to revoke if there is a problem later, no problem. 0-conf is great. If you are pre-pairing shipments and will be able to pull the box from the ship stream if there is a problem, also no problem. If you are sending some other non-reversible thing like crypto, then you might want to be careful. It really depends on the value of your things and your tolerance of risk.

In my opinion, an zero-conf transaction is way way better than a credit card preauth or a check in hand.

On Tue, Apr 10, 2018 at 1:34 PM Maksim Solovjov via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (33 lines)
> Hi,
>
> I have few questions regarding ListTransaction RPC call and I hope you can
> help me.
> Documentation for the RPC call is here:
> https://bitcoin.org/en/developer-reference#listtransactions
>
> 1. What does it mean for a transaction ( with 0 confirmations ) to be
> *trusted* or not?
> There is such field in the response of ListTransaction
> As far as I know bitcoin - nothing is trusted unless there are some
> numbers of confirmations.
> How does this value is set to true or false?
>
> 2. When does *confirmations* can be -1 ( conflicted )?
> What does it mean to have conflicted transaction?
> Is it about Transaction Malleability? Double Spend? or both?
>
> 3. *walletconflicts*. What if I add watch-only address to my bitcoind
> process.
> This address will not be a part of my wallet.
> Now, someone will pay me to this address and someone else will make
> Transaction Malleability ( for the sake of example, lets assume this second
> one will be confirmed, not the original one ).
> Will I get a first transaction in *walletconflicts* array when
> ListTransaction will return me second transaction in the response?
>
> Thank you in advance!
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Karl-Johan Alm in reply to Maksim Solovjov permalink original

On Wed, Apr 11, 2018 at 5:29 AM, Maksim Solovjov via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (2 lines)
> 1. What does it mean for a transaction ( with 0 confirmations ) to be
> trusted or not?

It is trusted if (1) it is final (i.e. it can't be replaced), (2) it is not in a block that was reorged out (negative confirmation count), (3) the 'spend zero conf change' option is set, (4) it is in the mempool, and (5) all inputs are from us.

Quoted text (3 lines)
> 2. When does confirmations can be -1 ( conflicted )?
> What does it mean to have conflicted transaction?
> Is it about Transaction Malleability? Double Spend? or both?

A transaction is conflicted if a different transaction exists that spends the same inputs. A transaction gets -N confirmations if it is mined in a block, and that block is orphaned away, and a different transaction is mined in the new block so that the transaction becomes a double spend.

Karl-Johan Alm in reply to Karl-Johan Alm permalink original

Clarification on one part below:

On Wed, Apr 11, 2018 at 2:21 PM, Karl-Johan Alm <karljohan-alm@garage•co•jp> wrote:

Quoted text (9 lines)
> On Wed, Apr 11, 2018 at 5:29 AM, Maksim Solovjov via bitcoin-dev
> <bitcoin-dev@lists•linuxfoundation•org> wrote:
>> 1. What does it mean for a transaction ( with 0 confirmations ) to be
>> trusted or not?
>
> It is trusted if (1) it is final (i.e. it can't be replaced), (2) it
> is not in a block that was reorged out (negative confirmation count),
> (3) the 'spend zero conf change' option is set, (4) it is in the
> mempool, and (5) all inputs are from us.

"can't be replaced" here means it cannot be replaced through conventional means. It is always possible to replace a transaction that has not yet been confirmed, e.g. by asking a miner to mine a conflicting transaction directly.

Peter Todd in reply to Karl-Johan Alm permalink original

On Wed, Apr 11, 2018 at 02:22:42PM +0900, Karl-Johan Alm via bitcoin-dev wrote:

Quoted text (18 lines)
> Clarification on one part below:
>
> On Wed, Apr 11, 2018 at 2:21 PM, Karl-Johan Alm
> <karljohan-alm@garage•co•jp> wrote:
> > On Wed, Apr 11, 2018 at 5:29 AM, Maksim Solovjov via bitcoin-dev
> > <bitcoin-dev@lists•linuxfoundation•org> wrote:
> >> 1. What does it mean for a transaction ( with 0 confirmations ) to be
> >> trusted or not?
> >
> > It is trusted if (1) it is final (i.e. it can't be replaced), (2) it
> > is not in a block that was reorged out (negative confirmation count),
> > (3) the 'spend zero conf change' option is set, (4) it is in the
> > mempool, and (5) all inputs are from us.
>
> "can't be replaced" here means it cannot be replaced through
> conventional means. It is always possible to replace a transaction
> that has not yet been confirmed, e.g. by asking a miner to mine a
> conflicting transaction directly.

Or via full replace-by-fee, which appears to be used by a significant minority of miners:

https://github.com/petertodd/bitcoin/tree/replace-by-fee-v0.16.0

In practice transaction replacement by the sender for any transaction is very easy.

Karl-Johan Alm in reply to Peter Todd permalink original

On Wed, Apr 11, 2018 at 4:52 PM, Peter Todd <pete@petertodd•org> wrote:

Quoted text (2 lines)
> Or via full replace-by-fee, which appears to be used by a significant minority
> of miners:

I was of the impression that final transactions (sequence=0xffffffff) cannot be RBF'd.

Peter Todd in reply to Karl-Johan Alm permalink original

On Wed, Apr 11, 2018 at 05:10:43PM +0900, Karl-Johan Alm wrote:

Quoted text (6 lines)
> On Wed, Apr 11, 2018 at 4:52 PM, Peter Todd <pete@petertodd•org> wrote:
> > Or via full replace-by-fee, which appears to be used by a significant minority
> > of miners:
>
> I was of the impression that final transactions (sequence=0xffffffff)
> cannot be RBF'd.

My full-replace-by-fee tree ignores that. It also does preferential peering to ensure it's well connected with likewise peers, and thus the whole network.

ZmnSCPxj in reply to Peter Todd permalink original

Good morning Karl-Johan Alm,

To clarify:

Nothing prevents a miner from completely ignoring nSequence when putting transactions in blocks.

Unconfirmed transactions are, by definition, not recorded in blocks. So if there is a transaction 0xFFFFFFF nSequence and fee 1000 satoshi, and another conflicting transaction 0xFFFFFFF nSequence and fee 100000000 satoshi, miners can include the latter one even if the first one came to their knowledge first, regardless nSequence.

Thus, in the end "full replace-by-fee", where nSequence is IGNORED for purposes of replace-by-fee, is expected to become the norm, and we should really be designing our wallets and so on so that we only trust transactions that have confirmations.

The "nSequence=0xFFFFFFFF means opt-OUT of RBF" convention is only followed by fullnodes running standard bitcoind. Nothing prevents miners from running patched bitcoind that ignores this rule, and connecting with similar peers who also ignore this rule.

Regards, ZmnSCPxj

​Sent with ProtonMail Secure Email.​

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On April 11, 2018 5:37 PM, Peter Todd via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (26 lines)
> On Wed, Apr 11, 2018 at 05:10:43PM +0900, Karl-Johan Alm wrote:
>
> > On Wed, Apr 11, 2018 at 4:52 PM, Peter Todd pete@petertodd•org wrote:
> >
> > > Or via full replace-by-fee, which appears to be used by a significant minority
> > >
> > > of miners:
> >
> > I was of the impression that final transactions (sequence=0xffffffff)
> >
> > cannot be RBF'd.
>
> My full-replace-by-fee tree ignores that. It also does preferential peering to
>
> ensure it's well connected with likewise peers, and thus the whole network.
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> https://petertodd.org 'peter'[:-1]@petertodd.org
>
> bitcoin-dev mailing list
>
> bitcoin-dev@lists•linuxfoundation•org
>
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
Karl-Johan Alm in reply to ZmnSCPxj permalink original

Thanks for clarifying!

On Wed, Apr 11, 2018 at 6:48 PM, ZmnSCPxj <ZmnSCPxj@protonmail•com> wrote:

Quoted text (50 lines)
> Good morning Karl-Johan Alm,
>
> To clarify:
>
> Nothing prevents a miner from completely ignoring nSequence when putting transactions in blocks.
>
> Unconfirmed transactions are, by definition, not recorded in blocks.  So if there is a transaction 0xFFFFFFF nSequence and fee 1000 satoshi, and another conflicting transaction 0xFFFFFFF nSequence and fee 100000000 satoshi, miners can include the latter one even if the first one came to their knowledge first, regardless nSequence.
>
> Thus, in the end "full replace-by-fee", where nSequence is IGNORED for purposes of replace-by-fee, is expected to become the norm, and we should really be designing our wallets and so on so that we only trust transactions that have confirmations.
>
> The "nSequence=0xFFFFFFFF means opt-OUT of RBF" convention is only followed by fullnodes running standard bitcoind.  Nothing prevents miners from running patched bitcoind that ignores this rule, and connecting with similar peers who also ignore this rule.
>
> Regards,
> ZmnSCPxj
>
>
> Sent with ProtonMail Secure Email.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On April 11, 2018 5:37 PM, Peter Todd via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:
>
>> On Wed, Apr 11, 2018 at 05:10:43PM +0900, Karl-Johan Alm wrote:
>>
>> > On Wed, Apr 11, 2018 at 4:52 PM, Peter Todd pete@petertodd•org wrote:
>> >
>> > > Or via full replace-by-fee, which appears to be used by a significant minority
>> > >
>> > > of miners:
>> >
>> > I was of the impression that final transactions (sequence=0xffffffff)
>> >
>> > cannot be RBF'd.
>>
>> My full-replace-by-fee tree ignores that. It also does preferential peering to
>>
>> ensure it's well connected with likewise peers, and thus the whole network.
>>
>>
>> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> https://petertodd.org 'peter'[:-1]@petertodd.org
>>
>> bitcoin-dev mailing list
>>
>> bitcoin-dev@lists•linuxfoundation•org
>>
>> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
>
Maksim Solovjov in reply to Karl-Johan Alm permalink original

OK.

Thank you guys for clarification.

On Wed, Apr 11, 2018 at 1:00 PM, Karl-Johan Alm via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (75 lines)
> Thanks for clarifying!
>
> On Wed, Apr 11, 2018 at 6:48 PM, ZmnSCPxj <ZmnSCPxj@protonmail•com> wrote:
> > Good morning Karl-Johan Alm,
> >
> > To clarify:
> >
> > Nothing prevents a miner from completely ignoring nSequence when putting
> transactions in blocks.
> >
> > Unconfirmed transactions are, by definition, not recorded in blocks.  So
> if there is a transaction 0xFFFFFFF nSequence and fee 1000 satoshi, and
> another conflicting transaction 0xFFFFFFF nSequence and fee 100000000
> satoshi, miners can include the latter one even if the first one came to
> their knowledge first, regardless nSequence.
> >
> > Thus, in the end "full replace-by-fee", where nSequence is IGNORED for
> purposes of replace-by-fee, is expected to become the norm, and we should
> really be designing our wallets and so on so that we only trust
> transactions that have confirmations.
> >
> > The "nSequence=0xFFFFFFFF means opt-OUT of RBF" convention is only
> followed by fullnodes running standard bitcoind.  Nothing prevents miners
> from running patched bitcoind that ignores this rule, and connecting with
> similar peers who also ignore this rule.
> >
> > Regards,
> > ZmnSCPxj
> >
> >
> > Sent with ProtonMail Secure Email.
> >
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On April 11, 2018 5:37 PM, Peter Todd via bitcoin-dev <
> bitcoin-dev@lists•linuxfoundation•org> wrote:
> >
> >> On Wed, Apr 11, 2018 at 05:10:43PM +0900, Karl-Johan Alm wrote:
> >>
> >> > On Wed, Apr 11, 2018 at 4:52 PM, Peter Todd pete@petertodd•org wrote:
> >> >
> >> > > Or via full replace-by-fee, which appears to be used by a
> significant minority
> >> > >
> >> > > of miners:
> >> >
> >> > I was of the impression that final transactions (sequence=0xffffffff)
> >> >
> >> > cannot be RBF'd.
> >>
> >> My full-replace-by-fee tree ignores that. It also does preferential
> peering to
> >>
> >> ensure it's well connected with likewise peers, and thus the whole
> network.
> >>
> >>
> >> ------------------------------------------------------------
> ------------------------------------------------------------
> ---------------------------------------
> >>
> >> https://petertodd.org 'peter'[:-1]@petertodd.org
> >>
> >> bitcoin-dev mailing list
> >>
> >> bitcoin-dev@lists•linuxfoundation•org
> >>
> >> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
> >
> >
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>