<blockquote>
<p>Don’t know what this is:</p>
<p><strong>02</strong></p>
</blockquote>
<p>It's the number of outputs in the transaction.</p>

CC BY-SA 4.0
2018-05-20T20:44:11.237Z
2018-05-20T20:44:11.237Z
2020-06-16T11:10:03.350Z
Ava Chow
<p>The bolded byte in the following raw transaction is the number of outputs (two in this transaction):</p>

<blockquote>
  <p>0100000001186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779000000008b483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adfffffffff<strong>02</strong>60e31600000000001976a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788acd0ef8000000000001976a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac00000000</p>
</blockquote>

<p>The Bitcoin.org Developer Documentation has an extended description of the <a href="https://bitcoin.org/en/developer-reference#raw-transaction-format" rel="noreferrer">raw transaction format</a> if you'd like more information.</p>

CC BY-SA 4.0
2018-05-20T16:12:54.967Z
2018-05-20T16:12:54.967Z
David A. Harding
<p><strong>Complete example:</strong></p>

<blockquote>
  <p>0100000001186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779000000008b483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adfffffffff<strong>02</strong>60e31600000000001976a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788acd0ef8000000000001976a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac00000000</p>
</blockquote>

<hr>

<p><strong>Breakdown:</strong></p>

<p>Version (4-byte):</p>

<p><strong>01000000</strong></p>

<hr>

<p>Number of inputs (variable size but in this case it is 1-byte):</p>

<p><strong>01</strong></p>

<hr>

<p>Previous transaction ID byte swapped (32-byte):</p>

<p><strong>186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779</strong></p>

<hr>

<p>prev_out_index (4-byte):</p>

<p><strong>00000000</strong></p>

<hr>

<p>scriptSig length (variable size but in this case it is 2-byte which represents 139-bytes for the following scrtiptSig):</p>

<p><strong>8b</strong></p>

<hr>

<p>scriptSig (variable size but in this case it’s 139-byte):</p>

<p><strong>483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf</strong></p>

<hr>

<p>Sequence number: (4-byte):</p>

<p><strong>ffffffff</strong></p>

<hr>

<p>Don’t know what this is:</p>

<p><strong>02</strong></p>

<hr>

<p>Value to send (8-byte byte-swapped):</p>

<p><strong>60e3160000000000</strong></p>

<hr>

<p>Output 1 – Receiving address for amount above:</p>

<p><strong>19 76 a9 14ab68025513c3dbd2f7b92a94e0581f5d50f654e7 88 ac</strong></p>

<hr>

<p>Value for change (8-byte byte-swapped)</p>

<p><strong>d0ef800000000000</strong></p>

<hr>

<p>Output 2- Change address for amount above:</p>

<p><strong>19 76 a9 147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 88 ac</strong></p>

<hr>

<p>LockTime (4-byte):</p>

<p><strong>00000000</strong></p>

<hr>

<p><strong>Question:</strong></p>

<p>The bit where I wrote <code>Don’t know what this is</code>, which has the value <code>02</code>.  I don't know what the purpose of that value is.  What's the purpose of that value?</p>

<hash><raw-transaction><bitcoin-cli><createrawtransaction><raw>
Breaking down a raw transaction:
oshirowanen
# Breaking down a raw transaction:

(Asked by: username_0 on 2018-05-20)

**Complete example:**

> 0100000001186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779000000008b483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adfffffffff**02**60e31600000000001976a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788acd0ef8000000000001976a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac00000000

---

**Breakdown:**

Version (4-byte):

**01000000**

---

Number of inputs (variable size but in this case it is 1-byte):

**01**

---

Previous transaction ID byte swapped (32-byte):

**186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779**

---

prev\_out\_index (4-byte):

**00000000**

---

scriptSig length (variable size but in this case it is 2-byte which represents 139-bytes for the following scrtiptSig):

**8b**

---

scriptSig (variable size but in this case it’s 139-byte):

**483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf**

---

Sequence number: (4-byte):

**ffffffff**

---

Don’t know what this is:

**02**

---

Value to send (8-byte byte-swapped):

**60e3160000000000**

---

Output 1 – Receiving address for amount above:

**19 76 a9 14ab68025513c3dbd2f7b92a94e0581f5d50f654e7 88 ac**

---

Value for change (8-byte byte-swapped)

**d0ef800000000000**

---

Output 2- Change address for amount above:

**19 76 a9 147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 88 ac**

---

LockTime (4-byte):

**00000000**

---

**Question:**

The bit where I wrote `Don’t know what this is`, which has the value `02`. I don't know what the purpose of that value is. What's the purpose of that value?

**Tags:** hash, raw-transaction, bitcoin-cli, createrawtransaction, raw


---

## 2 answers

### Answer by username_2 on 2018-05-20. Score: 8 | Accepted answer

The bolded byte in the following raw transaction is the number of outputs (two in this transaction):

> 0100000001186f9f998a5aa6f048e51dd8419a14d8a0f1a8a2836dd734d2804fe65fa35779000000008b483045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e381301410484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adfffffffff**02**60e31600000000001976a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788acd0ef8000000000001976a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac00000000

The Bitcoin.org Developer Documentation has an extended description of the [raw transaction format](https://bitcoin.org/en/developer-reference#raw-transaction-format) if you'd like more information.


---

### Answer by username_1 on 2018-05-20. Score: 1

> Don’t know what this is:
>
> **02**

It's the number of outputs in the transaction.


---

