Difference between revisions of "NLocktime and nSequence"

Line 7: Line 7:
 
'''nLockTime''' is a parameter applied to each transaction, that, if any input mandates a minimal time (specified in either unix time or block height), before which the transaction cannot be accepted into a block. If all inputs in a transaction have nSequence equal to UINT_MAX, then nLockTime is ignored.
 
'''nLockTime''' is a parameter applied to each transaction, that, if any input mandates a minimal time (specified in either unix time or block height), before which the transaction cannot be accepted into a block. If all inputs in a transaction have nSequence equal to UINT_MAX, then nLockTime is ignored.
  
If nLockTime < 500000000, the integer is interpreted as the block height after which this transaction can be accepted. Otherwise the integer is interpreted as the UNIX timestamp after which this transaction can be included in a block.
+
If nLockTime < 500,000,000, the integer is interpreted as the block height after which this transaction can be accepted. Otherwise the integer is interpreted as the UNIX timestamp after which this transaction can be included in a block.
  
 
==Use in Payment Channels==
 
==Use in Payment Channels==
 
In transactions where nLockTime is set in the future, and any inputs have nSequence number fields less than 0xFFFFFFFF they are considered non-final and held in a [[Transaction Pools|transaction pool]] until either nLockTime expires or all inputs have their nSequence finalised. Non-final transactions are replaceable with transactions that include the same inputs with a higher nSequence number. This function can be used to build payment channels allowing dynamic exchange of data between parties in a peer to peer manner.
 
In transactions where nLockTime is set in the future, and any inputs have nSequence number fields less than 0xFFFFFFFF they are considered non-final and held in a [[Transaction Pools|transaction pool]] until either nLockTime expires or all inputs have their nSequence finalised. Non-final transactions are replaceable with transactions that include the same inputs with a higher nSequence number. This function can be used to build payment channels allowing dynamic exchange of data between parties in a peer to peer manner.

Revision as of 05:37, 21 January 2020

nLocktime and nSequence are interlocks that can be applied to Bitcoin Transactions.

nSequence

nSequence is a parameter applied to each input of a transaction. If a transaction's nLocktime interlock is active, a transaction which has inputs where nSequence is less than UINT_MAX cannot be accepted into a block.

nLocktime

nLockTime is a parameter applied to each transaction, that, if any input mandates a minimal time (specified in either unix time or block height), before which the transaction cannot be accepted into a block. If all inputs in a transaction have nSequence equal to UINT_MAX, then nLockTime is ignored.

If nLockTime < 500,000,000, the integer is interpreted as the block height after which this transaction can be accepted. Otherwise the integer is interpreted as the UNIX timestamp after which this transaction can be included in a block.

Use in Payment Channels

In transactions where nLockTime is set in the future, and any inputs have nSequence number fields less than 0xFFFFFFFF they are considered non-final and held in a transaction pool until either nLockTime expires or all inputs have their nSequence finalised. Non-final transactions are replaceable with transactions that include the same inputs with a higher nSequence number. This function can be used to build payment channels allowing dynamic exchange of data between parties in a peer to peer manner.