LearnBitcoin

Bitcoin Dev Archive 2017

Transaction Replacement by Fee

4 messages, 12 to 28 Jan 2017. Started by Amir Taaki.

Amir Taaki, Greg Sanders, Peter Todd, Andrew

Permalink Original thread on gnusha.org

Amir Taaki permalink original

Hello,

Where can I find the rules on transaction replacement?

For instance what are the valid ranges for the sequence values in transaction inputs? Normally I set this value to MAX_UINT32, and the locktime to 0.

Can I change the outputs? Can I add more inputs to pay a higher fee?

Just looking for clarity on this aspect of Bitcoin. Any resources would be much appreciated.

Thanks.

Greg Sanders in reply to Amir Taaki permalink original

BIP125 is the standard way to signal: https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki

Should explain everything you need.

On Thu, Jan 12, 2017 at 9:02 AM, Police Terror via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (19 lines)
> Hello,
>
> Where can I find the rules on transaction replacement?
>
> For instance what are the valid ranges for the sequence values in
> transaction inputs? Normally I set this value to MAX_UINT32, and the
> locktime to 0.
>
> Can I change the outputs? Can I add more inputs to pay a higher fee?
>
> Just looking for clarity on this aspect of Bitcoin. Any resources would
> be much appreciated.
>
> Thanks.
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Peter Todd in reply to Greg Sanders permalink original

On Thu, Jan 12, 2017 at 09:13:23AM -0500, Greg Sanders via bitcoin-dev wrote:

Quoted text (4 lines)
> BIP125 is the standard way to signal:
> https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki
>
> Should explain everything you need.

Additionally some miners mine full replace-by-fee, which has no limitations on nSequence. My implementation (for v0.13.2) is here:

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

and is identical to Bitcoin Core modulo the nSequence stuff being removed, and a special service bit added to allow full-rbf nodes to preferentially peer with each other to make sure replacement transactions get propagated.

In practice full-RBF works fairly well, so while it's even faster to use the nSequence signalling specified in BIP-125, doing so is not mandatory so long as you can et your replacement transaction to a full-RBF node.

Andrew in reply to Peter Todd permalink original

Hi, recently been trying to get RBF working on a multisig input. I set the nSequence to 0, but script didn't verify (used python-bitcoinlib). Should it work for this type of transaction? I am using the SignatureHash(...) method of signing, not rpc.signrawtransaction(...).

Thanks

On Thu, Jan 12, 2017 at 7:58 PM, Peter Todd via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (27 lines)
> On Thu, Jan 12, 2017 at 09:13:23AM -0500, Greg Sanders via bitcoin-dev wrote:
>> BIP125 is the standard way to signal:
>> https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki
>>
>> Should explain everything you need.
>
> Additionally some miners mine full replace-by-fee, which has no limitations on
> nSequence. My implementation (for v0.13.2) is here:
>
>     https://github.com/petertodd/bitcoin/tree/replace-by-fee-v0.13.2
>
> and is identical to Bitcoin Core modulo the nSequence stuff being removed, and
> a special service bit added to allow full-rbf nodes to preferentially peer with
> each other to make sure replacement transactions get propagated.
>
> In practice full-RBF works fairly well, so while it's even faster to use the
> nSequence signalling specified in BIP-125, doing so is not mandatory so long as
> you can et your replacement transaction to a full-RBF node.
>
> --
> https://petertodd.org 'peter'[:-1]@petertodd.org
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>