<p>It points to the output 'n' in the transaction which that input spends from, not the spending one.</p>

CC BY-SA 3.0
2016-08-23T13:25:31.457Z
ok, since everything is stored as transaction, this makes a whole lot sense. Thanks. Just please clarify whether *It* here refers to vin['vout'] OR vin ['n'] ?
gyaani_guy
CC BY-SA 3.0
2016-08-23T12:49:20.363Z
2016-08-23T12:49:20.363Z
Pieter Wuille
<p>This is a slightly modified version of a transaction. (privacy reasons)</p>

<p>Edit: Sorry, but turns out there is another tx besides this tx:</p>

<pre><code>"txid": "485579924ce684df7aa7a9861abb4b858a8d917aa1df94bf3a234368a250516",
            "version": 1,
            "locktime": 0,
            "vin": [
                {
                    "coinbase": "033934050d00456c69676975730054ca7075fabe6d6de7cbb1e6f6ca2ed785b50b0bea44f69887952d5e359f5f7478ff677e2e9064f2400000000000000002f737333382f0050dd79739f7f000094fe0a00",
                    "sequence": 4294967295,
                    "n": 0
                }
            ],
            "vout": [
             .
             .
             .
             73 =&gt; [
              EXPECTED VALUE!
             ]
</code></pre>

<p>Now I am thoroughly confused :( . Please feel free to link to some relevant reading materials..</p>

<pre><code>{
    "txid": "a831a97917a3ae8a3c0cd700ed7ef0529b8218d3f71ed16152c7898c3d909e",
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "txid": "485579924ce684df7aa7a9861abb4b858a8d917aa1df94bfa234368a250516",
            "vout": 73,
            "sequence": 4294967295,
            "n": 0,
            "scriptSig": {
                "hex": "48304502210098fa80b386bfc99d5aed9bd09ff41b0b7a92c92025c44f60ef6319d3e3421a02204a838cff88cfa0bece496d65d21811f873a21fbb36a955bbe30264830a3ee5f0012102c651a011009e2c7e7b3ed2068857ca0a47cba35b73e06c32e3c06ef3aa67621d",
                "asm": "304502210098fa80b386bfc99d5aed9bd09ff41b0b7a92c92025c44f60ef6319d3e3421a02204a838cff88cfa0bece496d65d21811f873a21fbb36a955bbe30264830a3ee5f0[ALL] 02c651a011009e2c7e7b3ed2068857ca0a47cba35b73e06c32e3c06ef3aa67621d"
            },
            "addr": "1GWFxtwWmNVqotUPcKVL2mUKpshuJYo",
            "valueSat": 1552750,
            "value": 0.0155275,
            "doubleSpentTxID": null
        }
    ],
    "vout": [
        {
            "value": "0.01551750",
            "n": 0,
            "scriptPubKey": {
                "hex": "76a9141ed14f2bc369ac010e3c9c29347c60c15ff688ac",
                "asm": "OP_DUP OP_HASH160 18ed14f2bc386ac010e39c29347cec60c15ff6 OP_EQUALVERIFY OP_CHECKSIG",
                "addresses": [
                    "13GoELcets2qtNo3nQdEYdSWfTk9p8K4F"
                ],
                "type": "pubkeyhash"
            },
            "spentTxId": "51f6dc1bd22094f32903a3c7e9d4ffcd7bfa35ca0290eb123e62dcc225127f",
            "spentIndex": 0,
            "spentHeight": 346296
        }
    ],
    "blockhash": "000000000000000002a1c66c63d178919fb8cb029a8012b8d95f6fff6a7d9",
    "blockheight": 341650,
    "confirmations": 84845,
    "time": 1422892529,
    "blocktime": 1422892529,
    "valueOut": 0.0155175,
    "size": 192,
    "valueIn": 0.0155275,
    "fees": 0.00001
}
</code></pre>

<p>Questions:</p>

<p>vin['vout'] equals 73 here. Why is this, considering that there is only 1 vout element ?
 I have the impression that the value of vout (in vin) points to the index of the vout (vout['n']). Is that wrong ? If so what does it point to</p>

<p>Also what does vin['n'] points to exactly ?</p>

<p>P.S: I have read <a href="https://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list">In getrawtransaction, what is the vout integer in the vin list?</a> - which explains transactions in great detail.. but I couldn't figureout from there what vin['vout'] integer value is precisely</p>

<transactions><development><raw-transaction>
Value of `vout` in vin exceeds number of vout elements. Why?
gyaani_guy
# Value of `vout` in vin exceeds number of vout elements. Why?

(Asked by: username_0 on 2016-08-23)

This is a slightly modified version of a transaction. (privacy reasons)

Edit: Sorry, but turns out there is another tx besides this tx:

```
"txid": "485579924ce684df7aa7a9861abb4b858a8d917aa1df94bf3a234368a250516",
            "version": 1,
            "locktime": 0,
            "vin": [
                {
                    "coinbase": "033934050d00456c69676975730054ca7075fabe6d6de7cbb1e6f6ca2ed785b50b0bea44f69887952d5e359f5f7478ff677e2e9064f2400000000000000002f737333382f0050dd79739f7f000094fe0a00",
                    "sequence": 4294967295,
                    "n": 0
                }
            ],
            "vout": [
             .
             .
             .
             73 => [
              EXPECTED VALUE!
             ]

```

Now I am thoroughly confused :( . Please feel free to link to some relevant reading materials..

```
{
    "txid": "a831a97917a3ae8a3c0cd700ed7ef0529b8218d3f71ed16152c7898c3d909e",
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "txid": "485579924ce684df7aa7a9861abb4b858a8d917aa1df94bfa234368a250516",
            "vout": 73,
            "sequence": 4294967295,
            "n": 0,
            "scriptSig": {
                "hex": "48304502210098fa80b386bfc99d5aed9bd09ff41b0b7a92c92025c44f60ef6319d3e3421a02204a838cff88cfa0bece496d65d21811f873a21fbb36a955bbe30264830a3ee5f0012102c651a011009e2c7e7b3ed2068857ca0a47cba35b73e06c32e3c06ef3aa67621d",
                "asm": "304502210098fa80b386bfc99d5aed9bd09ff41b0b7a92c92025c44f60ef6319d3e3421a02204a838cff88cfa0bece496d65d21811f873a21fbb36a955bbe30264830a3ee5f0[ALL] 02c651a011009e2c7e7b3ed2068857ca0a47cba35b73e06c32e3c06ef3aa67621d"
            },
            "addr": "1GWFxtwWmNVqotUPcKVL2mUKpshuJYo",
            "valueSat": 1552750,
            "value": 0.0155275,
            "doubleSpentTxID": null
        }
    ],
    "vout": [
        {
            "value": "0.01551750",
            "n": 0,
            "scriptPubKey": {
                "hex": "76a9141ed14f2bc369ac010e3c9c29347c60c15ff688ac",
                "asm": "OP_DUP OP_HASH160 18ed14f2bc386ac010e39c29347cec60c15ff6 OP_EQUALVERIFY OP_CHECKSIG",
                "addresses": [
                    "13GoELcets2qtNo3nQdEYdSWfTk9p8K4F"
                ],
                "type": "pubkeyhash"
            },
            "spentTxId": "51f6dc1bd22094f32903a3c7e9d4ffcd7bfa35ca0290eb123e62dcc225127f",
            "spentIndex": 0,
            "spentHeight": 346296
        }
    ],
    "blockhash": "000000000000000002a1c66c63d178919fb8cb029a8012b8d95f6fff6a7d9",
    "blockheight": 341650,
    "confirmations": 84845,
    "time": 1422892529,
    "blocktime": 1422892529,
    "valueOut": 0.0155175,
    "size": 192,
    "valueIn": 0.0155275,
    "fees": 0.00001
}

```

Questions:

vin['vout'] equals 73 here. Why is this, considering that there is only 1 vout element ?
I have the impression that the value of vout (in vin) points to the index of the vout (vout['n']). Is that wrong ? If so what does it point to

Also what does vin['n'] points to exactly ?

P.S: I have read [In getrawtransaction, what is the vout integer in the vin list?](https://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list) - which explains transactions in great detail.. but I couldn't figureout from there what vin['vout'] integer value is precisely

**Tags:** transactions, development, raw-transaction


---

## 1 answers

### Answer by username_1 on 2016-08-23. Score: 2

It points to the output 'n' in the transaction which that input spends from, not the spending one.

> **Comments:**
> **username_0**: ok, since everything is stored as transaction, this makes a whole lot sense. Thanks. Just please clarify whether *It* here refers to vin['vout'] OR vin ['n'] ?  

---

