<p>The sequence number is always 4 bytes, it is a fixed size, little endian, 32 bit integer which makes it always 4 bytes.</p>

<p>What you are missing is the <code>scriptSig</code>. The <code>scriptSig</code> always begins with the size of the script (as a compact size unsigned integer). If the <code>scriptSig</code> is empty, then the size must still be there to say that it is a 0 length byte. So the first byte of your "sequence" is actually the length byte for the <code>scriptSig</code> that says it is of length 0.</p>

CC BY-SA 4.0
2019-11-10T22:55:20.933Z
2019-11-10T22:55:20.933Z
Ava Chow
<p>When I look at the following raw transaction from: <a href="https://blockstream.info/tx/a175425ee2f3c01acc97ef32ab1082db14eaa94e5af4c54f02f3b01dec72558e?expand" rel="nofollow noreferrer">https://blockstream.info/tx/a175425ee2f3c01acc97ef32ab1082db14eaa94e5af4c54f02f3b01dec72558e?expand</a></p>

<pre><code>020000000001018e5572ec1db0f3024fc5f45a4ea9ea14db8210ab32ef97cc1ac0f3e25e4275a100000000**00cf050000**01d2ddbc0000000000160014b82d832b2e5c0d80c771b06ce0da50fbccf12f3e0347304402204a54d94068512c22847cc07fa85f2b93feaf758411920a9b20ce9b85831e8aa5022005924cb82c331c5173e21477a4d8298eb25c0d967ace065b883455f2537c3d0a01004d632103f96d73ffe138690f032e97408af933a71782ad27a28df66a750b48c56b2d7fa96702cf05b275210304f332f50363cd01b679d9fb50fb8691fb0fb638737867bd02f06850c6191a2268ac00000000
</code></pre>

<p>When I parse it manually, specifically at this section: <code>a100000000**00cf050000**01...</code></p>

<p><code>a1</code> is the last byte of the input tx (in little endian), </p>

<p><code>00000000</code> is the output index (4-bytes), </p>

<p>and at the end the <code>01</code> is the tx_out_count. </p>

<p>But that would make the sequence number <strong><code>00cf050000</code></strong>, which is longer than 4 bytes? What am I missing here?</p>

<raw-transaction><sequence><checksequenceverify>
How many bytes long should nSequence be?
Darius
# How many bytes long should nSequence be?

(Asked by: username_0 on 2019-11-10)

When I look at the following raw transaction from: https://blockstream.info/tx/a175425ee2f3c01acc97ef32ab1082db14eaa94e5af4c54f02f3b01dec72558e?expand
020000000001018e5572ec1db0f3024fc5f45a4ea9ea14db8210ab32ef97cc1ac0f3e25e4275a100000000**00cf050000**01d2ddbc0000000000160014b82d832b2e5c0d80c771b06ce0da50fbccf12f3e0347304402204a54d94068512c22847cc07fa85f2b93feaf758411920a9b20ce9b85831e8aa5022005924cb82c331c5173e21477a4d8298eb25c0d967ace065b883455f2537c3d0a01004d632103f96d73ffe138690f032e97408af933a71782ad27a28df66a750b48c56b2d7fa96702cf05b275210304f332f50363cd01b679d9fb50fb8691fb0fb638737867bd02f06850c6191a2268ac00000000

When I parse it manually, specifically at this section: a100000000**00cf050000**01...
a1 is the last byte of the input tx (in little endian), 
00000000 is the output index (4-bytes), 
and at the end the 01 is the tx_out_count. 
But that would make the sequence number 00cf050000, which is longer than 4 bytes? What am I missing here?

**Tags:** raw-transaction, sequence, checksequenceverify


---

## 1 answers

### Answer by username_1 on 2019-11-10. Score: 1 | Accepted answer

The sequence number is always 4 bytes, it is a fixed size, little endian, 32 bit integer which makes it always 4 bytes.

What you are missing is the `scriptSig`. The `scriptSig` always begins with the size of the script (as a compact size unsigned integer). If the `scriptSig` is empty, then the size must still be there to say that it is a 0 length byte. So the first byte of your "sequence" is actually the length byte for the `scriptSig` that says it is of length 0.


---

