What does the sequence in a transaction input mean?
Following a transaction input:
What is the meaning of the sequence number? What does the 4294967295 tell me?
transactions sequence input
add a comment |
Following a transaction input:
What is the meaning of the sequence number? What does the 4294967295 tell me?
transactions sequence input
add a comment |
Following a transaction input:
What is the meaning of the sequence number? What does the 4294967295 tell me?
transactions sequence input
Following a transaction input:
What is the meaning of the sequence number? What does the 4294967295 tell me?
transactions sequence input
transactions sequence input
asked 5 hours ago
MichaelMichael
283
283
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
My search on this website did not reveal a single answer that comprehensively explores nSequence
and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate.
Original meaning of nSequence in transactions
nSequence
is a 4 byte input level feature. The original meaning of nSequence
was to allow modification of transactions in the mempool. So, if the nSequence value of the input was less than 0xFFFFFFFF
(4294967295
in decimal), it indicated a transaction that was not yet finalized. Such a transaction would be held in the mempool until it was replaced by another transaction spending the same inputs with a higher nSequence value. Once a transaction was received whose inputs had an nSequence value of 0xFFFFFFFF
it would be considered finalized and mined. In that implementation, replacement transactions did not have to pay additional fees, so there was no direct incentive for miners to include the replacement. Also, no built-in rate limiting prevented overuse of relay node bandwidth. Hence, this feature was disabled later as it was possible for an attacker to use up all the bandwidth among full nodes at only a small cost to himself, creating a denial-of-service vulnerability. This made it difficult for spenders to adjust their previously sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.
Opt-in Full Replace-by-Fee Signaling
Then came the proposal for Opt-in Full Replace-by-Fee Signaling
. It considered a transaction to have opted in to allow replacement of itself, if any of its inputs have an nSequence number less than 0xFFFFFFFE
. It also required higher fee than the previous relayed transaction
Absolute and Relative Locktime
Transaction with nLockTime
is used to prevent the mining of a transaction until a certain date (specified in block no. or time). BIP 68 activation defined the meaning of sequence numbers for transactions with an nVersion >=2
. nSequence
was repurposed as a relative locktime. That means it prevents mining of a transaction until the input that the transaction is spending has reached a certain age in blocks or timespan. If nSequence > 0xEFFFFFFF
then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. If nSequence <= 0xEFFFFFFF
, it implies relative locktime.
If nSequence <=0xEFFFFFFF
, then the sequence's 22nd bit determines if the relative lock-time is time-based or block based. If the bit is 1, the relative lock-time specifies a timespan in units of 512 seconds granularity. If the bit is not set (i.e. it is 0), the relative lock-time specifies a number of blocks. The value of the relative locktime, is then interpreted from the first 16 bits of the nSequence
. The below figure shows how nSequence is evaluated.
Currently, if nSequence = 0xFFFFFFFF
, the sequence number has no effect on the transaction. If nSequence = 0xFFFFFFFE
, then it implies that the transaction uses locktime but does not opt-in replace-by-fee
. Plain vanilla transactions created from Bitcoin Core uses nSequence=0xFFFFFFFE
, because they want to use nLocktime
to prevent miners from pulling the transactions forward. For more information on Locktime refer here.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "308"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f87372%2fwhat-does-the-sequence-in-a-transaction-input-mean%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
My search on this website did not reveal a single answer that comprehensively explores nSequence
and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate.
Original meaning of nSequence in transactions
nSequence
is a 4 byte input level feature. The original meaning of nSequence
was to allow modification of transactions in the mempool. So, if the nSequence value of the input was less than 0xFFFFFFFF
(4294967295
in decimal), it indicated a transaction that was not yet finalized. Such a transaction would be held in the mempool until it was replaced by another transaction spending the same inputs with a higher nSequence value. Once a transaction was received whose inputs had an nSequence value of 0xFFFFFFFF
it would be considered finalized and mined. In that implementation, replacement transactions did not have to pay additional fees, so there was no direct incentive for miners to include the replacement. Also, no built-in rate limiting prevented overuse of relay node bandwidth. Hence, this feature was disabled later as it was possible for an attacker to use up all the bandwidth among full nodes at only a small cost to himself, creating a denial-of-service vulnerability. This made it difficult for spenders to adjust their previously sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.
Opt-in Full Replace-by-Fee Signaling
Then came the proposal for Opt-in Full Replace-by-Fee Signaling
. It considered a transaction to have opted in to allow replacement of itself, if any of its inputs have an nSequence number less than 0xFFFFFFFE
. It also required higher fee than the previous relayed transaction
Absolute and Relative Locktime
Transaction with nLockTime
is used to prevent the mining of a transaction until a certain date (specified in block no. or time). BIP 68 activation defined the meaning of sequence numbers for transactions with an nVersion >=2
. nSequence
was repurposed as a relative locktime. That means it prevents mining of a transaction until the input that the transaction is spending has reached a certain age in blocks or timespan. If nSequence > 0xEFFFFFFF
then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. If nSequence <= 0xEFFFFFFF
, it implies relative locktime.
If nSequence <=0xEFFFFFFF
, then the sequence's 22nd bit determines if the relative lock-time is time-based or block based. If the bit is 1, the relative lock-time specifies a timespan in units of 512 seconds granularity. If the bit is not set (i.e. it is 0), the relative lock-time specifies a number of blocks. The value of the relative locktime, is then interpreted from the first 16 bits of the nSequence
. The below figure shows how nSequence is evaluated.
Currently, if nSequence = 0xFFFFFFFF
, the sequence number has no effect on the transaction. If nSequence = 0xFFFFFFFE
, then it implies that the transaction uses locktime but does not opt-in replace-by-fee
. Plain vanilla transactions created from Bitcoin Core uses nSequence=0xFFFFFFFE
, because they want to use nLocktime
to prevent miners from pulling the transactions forward. For more information on Locktime refer here.
add a comment |
My search on this website did not reveal a single answer that comprehensively explores nSequence
and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate.
Original meaning of nSequence in transactions
nSequence
is a 4 byte input level feature. The original meaning of nSequence
was to allow modification of transactions in the mempool. So, if the nSequence value of the input was less than 0xFFFFFFFF
(4294967295
in decimal), it indicated a transaction that was not yet finalized. Such a transaction would be held in the mempool until it was replaced by another transaction spending the same inputs with a higher nSequence value. Once a transaction was received whose inputs had an nSequence value of 0xFFFFFFFF
it would be considered finalized and mined. In that implementation, replacement transactions did not have to pay additional fees, so there was no direct incentive for miners to include the replacement. Also, no built-in rate limiting prevented overuse of relay node bandwidth. Hence, this feature was disabled later as it was possible for an attacker to use up all the bandwidth among full nodes at only a small cost to himself, creating a denial-of-service vulnerability. This made it difficult for spenders to adjust their previously sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.
Opt-in Full Replace-by-Fee Signaling
Then came the proposal for Opt-in Full Replace-by-Fee Signaling
. It considered a transaction to have opted in to allow replacement of itself, if any of its inputs have an nSequence number less than 0xFFFFFFFE
. It also required higher fee than the previous relayed transaction
Absolute and Relative Locktime
Transaction with nLockTime
is used to prevent the mining of a transaction until a certain date (specified in block no. or time). BIP 68 activation defined the meaning of sequence numbers for transactions with an nVersion >=2
. nSequence
was repurposed as a relative locktime. That means it prevents mining of a transaction until the input that the transaction is spending has reached a certain age in blocks or timespan. If nSequence > 0xEFFFFFFF
then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. If nSequence <= 0xEFFFFFFF
, it implies relative locktime.
If nSequence <=0xEFFFFFFF
, then the sequence's 22nd bit determines if the relative lock-time is time-based or block based. If the bit is 1, the relative lock-time specifies a timespan in units of 512 seconds granularity. If the bit is not set (i.e. it is 0), the relative lock-time specifies a number of blocks. The value of the relative locktime, is then interpreted from the first 16 bits of the nSequence
. The below figure shows how nSequence is evaluated.
Currently, if nSequence = 0xFFFFFFFF
, the sequence number has no effect on the transaction. If nSequence = 0xFFFFFFFE
, then it implies that the transaction uses locktime but does not opt-in replace-by-fee
. Plain vanilla transactions created from Bitcoin Core uses nSequence=0xFFFFFFFE
, because they want to use nLocktime
to prevent miners from pulling the transactions forward. For more information on Locktime refer here.
add a comment |
My search on this website did not reveal a single answer that comprehensively explores nSequence
and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate.
Original meaning of nSequence in transactions
nSequence
is a 4 byte input level feature. The original meaning of nSequence
was to allow modification of transactions in the mempool. So, if the nSequence value of the input was less than 0xFFFFFFFF
(4294967295
in decimal), it indicated a transaction that was not yet finalized. Such a transaction would be held in the mempool until it was replaced by another transaction spending the same inputs with a higher nSequence value. Once a transaction was received whose inputs had an nSequence value of 0xFFFFFFFF
it would be considered finalized and mined. In that implementation, replacement transactions did not have to pay additional fees, so there was no direct incentive for miners to include the replacement. Also, no built-in rate limiting prevented overuse of relay node bandwidth. Hence, this feature was disabled later as it was possible for an attacker to use up all the bandwidth among full nodes at only a small cost to himself, creating a denial-of-service vulnerability. This made it difficult for spenders to adjust their previously sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.
Opt-in Full Replace-by-Fee Signaling
Then came the proposal for Opt-in Full Replace-by-Fee Signaling
. It considered a transaction to have opted in to allow replacement of itself, if any of its inputs have an nSequence number less than 0xFFFFFFFE
. It also required higher fee than the previous relayed transaction
Absolute and Relative Locktime
Transaction with nLockTime
is used to prevent the mining of a transaction until a certain date (specified in block no. or time). BIP 68 activation defined the meaning of sequence numbers for transactions with an nVersion >=2
. nSequence
was repurposed as a relative locktime. That means it prevents mining of a transaction until the input that the transaction is spending has reached a certain age in blocks or timespan. If nSequence > 0xEFFFFFFF
then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. If nSequence <= 0xEFFFFFFF
, it implies relative locktime.
If nSequence <=0xEFFFFFFF
, then the sequence's 22nd bit determines if the relative lock-time is time-based or block based. If the bit is 1, the relative lock-time specifies a timespan in units of 512 seconds granularity. If the bit is not set (i.e. it is 0), the relative lock-time specifies a number of blocks. The value of the relative locktime, is then interpreted from the first 16 bits of the nSequence
. The below figure shows how nSequence is evaluated.
Currently, if nSequence = 0xFFFFFFFF
, the sequence number has no effect on the transaction. If nSequence = 0xFFFFFFFE
, then it implies that the transaction uses locktime but does not opt-in replace-by-fee
. Plain vanilla transactions created from Bitcoin Core uses nSequence=0xFFFFFFFE
, because they want to use nLocktime
to prevent miners from pulling the transactions forward. For more information on Locktime refer here.
My search on this website did not reveal a single answer that comprehensively explores nSequence
and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate.
Original meaning of nSequence in transactions
nSequence
is a 4 byte input level feature. The original meaning of nSequence
was to allow modification of transactions in the mempool. So, if the nSequence value of the input was less than 0xFFFFFFFF
(4294967295
in decimal), it indicated a transaction that was not yet finalized. Such a transaction would be held in the mempool until it was replaced by another transaction spending the same inputs with a higher nSequence value. Once a transaction was received whose inputs had an nSequence value of 0xFFFFFFFF
it would be considered finalized and mined. In that implementation, replacement transactions did not have to pay additional fees, so there was no direct incentive for miners to include the replacement. Also, no built-in rate limiting prevented overuse of relay node bandwidth. Hence, this feature was disabled later as it was possible for an attacker to use up all the bandwidth among full nodes at only a small cost to himself, creating a denial-of-service vulnerability. This made it difficult for spenders to adjust their previously sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.
Opt-in Full Replace-by-Fee Signaling
Then came the proposal for Opt-in Full Replace-by-Fee Signaling
. It considered a transaction to have opted in to allow replacement of itself, if any of its inputs have an nSequence number less than 0xFFFFFFFE
. It also required higher fee than the previous relayed transaction
Absolute and Relative Locktime
Transaction with nLockTime
is used to prevent the mining of a transaction until a certain date (specified in block no. or time). BIP 68 activation defined the meaning of sequence numbers for transactions with an nVersion >=2
. nSequence
was repurposed as a relative locktime. That means it prevents mining of a transaction until the input that the transaction is spending has reached a certain age in blocks or timespan. If nSequence > 0xEFFFFFFF
then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. If nSequence <= 0xEFFFFFFF
, it implies relative locktime.
If nSequence <=0xEFFFFFFF
, then the sequence's 22nd bit determines if the relative lock-time is time-based or block based. If the bit is 1, the relative lock-time specifies a timespan in units of 512 seconds granularity. If the bit is not set (i.e. it is 0), the relative lock-time specifies a number of blocks. The value of the relative locktime, is then interpreted from the first 16 bits of the nSequence
. The below figure shows how nSequence is evaluated.
Currently, if nSequence = 0xFFFFFFFF
, the sequence number has no effect on the transaction. If nSequence = 0xFFFFFFFE
, then it implies that the transaction uses locktime but does not opt-in replace-by-fee
. Plain vanilla transactions created from Bitcoin Core uses nSequence=0xFFFFFFFE
, because they want to use nLocktime
to prevent miners from pulling the transactions forward. For more information on Locktime refer here.
answered 3 hours ago
Ugam KamatUgam Kamat
1,109121
1,109121
add a comment |
add a comment |
Thanks for contributing an answer to Bitcoin Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f87372%2fwhat-does-the-sequence-in-a-transaction-input-mean%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown