<p>A transaction consists of a number of inputs and a number of outputs. Outputs define a <a href="https://en.bitcoin.it/wiki/Script" rel="noreferrer">script</a> that need to be executed to be able to spend the coins in the output. Inputs provide data to enter into an output script to make it execute successfully and to spend the coins in it.</p>

<p>So, a transaction input must be able to reference the output it is willing to spend. Outputs in a transaction are ordered, so an output can be referred to by specifying the transaction ID of the transaction it has been defined in, and the index it has in the list of specified outputs in that transaction.</p>

<p>The <code>prev_out</code> field is the transaction hash (txid) and the <code>n</code> is the index of the output.</p>

<p>It's not true that every transaction contains exactly one <code>prev_out</code> value. However, many transactions do. This is because many transactions have only one input. You must know, though, that it is possible to have multiple inputs.</p>

CC BY-SA 3.0
2014-03-24T10:41:33.027Z
2014-03-24T10:41:33.027Z
Steven Roose
<p>A typical bitcoin transaction is made up of inputs and outputs. Unspent coins from previous outputs are reference by the inputs. These coins are pooled, then redistributed to the outputs, which now represent the same number of unspent coins (minus fees).</p>

<p>The inputs reference the unspent coins by the transaction hash and the index of the output that's being redeemed.</p>

<p>Although you can have as many inputs and outputs as you want -- in theory, you could write a transaction that references every coin in existence, and redistributes it to ten million new addresses -- in practice, most transactions only have one output (the recipient) or two outputs (the recipient and the "change" address), so "n" is usually -- but not always -- 0 or 1.</p>

<p>For example, if you look at <a href="https://blockchain.info/tx/017ee876b7078170066da40894b291e496dc09b7fb3edff4e2e7e8262545c7b1?format=json" rel="nofollow">https://blockchain.info/tx/017ee876b7078170066da40894b291e496dc09b7fb3edff4e2e7e8262545c7b1?format=json</a> you can see the "n" value in the sole "prev_out" dictionary is 170. That's because this transaction is spending coins that came from a prior transaction with 170 or more outputs.</p>

CC BY-SA 3.0
2014-03-25T08:17:22.730Z
2014-03-25T08:17:22.730Z
Richard Kiss
<p>Previous tx is a hash of a previous transaction. Index is the specific output in the referenced transaction. see: <a href="https://en.bitcoin.it/wiki/Transactions" rel="nofollow">https://en.bitcoin.it/wiki/Transactions</a></p>

CC BY-SA 3.0
2014-03-23T22:04:05.390Z
2014-03-23T22:04:05.390Z
xmlDave
<p>When getting information about transactions with blockchain.info's API, every transaction contains exactly one "prev_out" object, and within that object "n" is always equal to either 0 or 1.</p>

<p>What do these things stand for/mean?</p>

<transactions><blockchain><blockchain.info>
What does "prev_out" and "n" mean in blockchain.info's API data?
zombio
# What does "prev_out" and "n" mean in blockchain.info's API data?

(Asked by: username_0 on 2013-11-30)

When getting information about transactions with blockchain.info's API, every transaction contains exactly one "prev\_out" object, and within that object "n" is always equal to either 0 or 1.

What do these things stand for/mean?

**Tags:** transactions, blockchain, blockchain.info


---

## 3 answers

### Answer by username_1 on 2014-03-24. Score: 6

A transaction consists of a number of inputs and a number of outputs. Outputs define a [script](https://en.bitcoin.it/wiki/Script) that need to be executed to be able to spend the coins in the output. Inputs provide data to enter into an output script to make it execute successfully and to spend the coins in it.

So, a transaction input must be able to reference the output it is willing to spend. Outputs in a transaction are ordered, so an output can be referred to by specifying the transaction ID of the transaction it has been defined in, and the index it has in the list of specified outputs in that transaction.

The `prev_out` field is the transaction hash (txid) and the `n` is the index of the output.

It's not true that every transaction contains exactly one `prev_out` value. However, many transactions do. This is because many transactions have only one input. You must know, though, that it is possible to have multiple inputs.


---

### Answer by username_2 on 2014-03-25. Score: 1

A typical bitcoin transaction is made up of inputs and outputs. Unspent coins from previous outputs are reference by the inputs. These coins are pooled, then redistributed to the outputs, which now represent the same number of unspent coins (minus fees).

The inputs reference the unspent coins by the transaction hash and the index of the output that's being redeemed.

Although you can have as many inputs and outputs as you want -- in theory, you could write a transaction that references every coin in existence, and redistributes it to ten million new addresses -- in practice, most transactions only have one output (the recipient) or two outputs (the recipient and the "change" address), so "n" is usually -- but not always -- 0 or 1.

For example, if you look at <https://blockchain.info/tx/017ee876b7078170066da40894b291e496dc09b7fb3edff4e2e7e8262545c7b1?format=json> you can see the "n" value in the sole "prev\_out" dictionary is 170. That's because this transaction is spending coins that came from a prior transaction with 170 or more outputs.


---

### Answer by username_3 on 2014-03-23. Score: -1

Previous tx is a hash of a previous transaction. Index is the specific output in the referenced transaction. see: <https://en.bitcoin.it/wiki/Transactions>


---

