<p>That is how it works, you need to look up the previous transaction where that output exists in order to get the value. The equivalent call using <code>bitcoin-cli</code> is:</p>

<pre><code>$ bitcoin-cli getrawtransaction 9de8923855b2c56bc903c39418298fa8c185e5feb99cb32bfa31b9d06700ced8 2
</code></pre>

<p>then you can find the <code>vout</code> with index 1.</p>

CC BY-SA 4.0
2018-11-12T19:27:39.037Z
Great, and thanks. @JBaczuk do you know of a way to implement a python script to do this for all transactions.
SantiClaus
CC BY-SA 4.0
2018-11-12T19:31:53.997Z
NP, that's a pretty broad question are you asking me to code it for you? You can call that RPC endpoint using http and then parse the results. There are plenty of python wrapper modules out there for bitcoin-core RPC.
JBaczuk
CC BY-SA 4.0
2018-11-12T19:34:50.290Z
great. yeah it is a broad question but just want to make sure its possible. Do you know of any helpful links? Not asking you to code it.
SantiClaus
CC BY-SA 4.0
2018-11-12T20:40:02.823Z
I'd just search for python bitcoin rpc, i haven't personally used any of them myself.
JBaczuk
CC BY-SA 4.0
2018-11-12T18:39:31.463Z
2018-11-12T18:39:31.463Z
JBaczuk
<p>Why when I use this public Bitcoin Api to practice a command, the input value of BTC does not show up? </p>

<p>API Call can be found here:</p>

<p><a href="http://chainquery.com/bitcoin-api/getrawtransaction/1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86/1" rel="nofollow noreferrer">API Website</a></p>

<p>Transaction from block explorer can be found here:</p>

<p><a href="https://blockexplorer.com/tx/1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86" rel="nofollow noreferrer">Explorer Tx</a></p>

<pre><code>{
    "result": {
        "txid": "1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86",
        "hash": "bf43137e355def3d6292c296c864d9f6a9da353db6e4bd40c55e7cc4df245774",
        "version": 2,
        "size": 249,
        "vsize": 168,
        "locktime": 0,
        "vin": [
            {
                "txid": "9de8923855b2c56bc903c39418298fa8c185e5feb99cb32bfa31b9d06700ced8",
                "vout": 1,
                "scriptSig": {
                    "asm": "00140b67d98b0069797e0b5c94964f94d69476bea509",
                    "hex": "1600140b67d98b0069797e0b5c94964f94d69476bea509"
                },
                "txinwitness": [
                    "30440220625b6fd7299cfd14e6bdaa63cef809da54d4016c6caf5d268fc80c48d7fb41cc02200da35a319d63926112aa26952933ce590e67023993072ab10ab2bfb44f55704f01",
                    "03c97015da537daded1ac5fd4b5f9cfe55d1d77aed63da77da097d2af087361339"
                ],
                "sequence": 4294967295
            }
        ],
        "vout": [
            {
                "value": 1.99550000,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 b0fe30da6628923202cbf6e877405ea6d484e9eb OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914b0fe30da6628923202cbf6e877405ea6d484e9eb88ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "1H8rSFYmaZoSbdsXjF4Q5zb53FHNYAdTLj"
                    ]
                }
            },
            {
                "value": 82.88960000,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_HASH160 fe7dfeeb1cbf6330590bc7ee2c47a2de593f1920 OP_EQUAL",
                    "hex": "a914fe7dfeeb1cbf6330590bc7ee2c47a2de593f192087",
                    "reqSigs": 1,
                    "type": "scripthash",
                    "addresses": [
                        "3QteVcFbTqoS8fSFYgwuet1yWD8YGfuas4"
                    ]
                }
            }
        ],
        "hex": "02000000000101d8ce0067d0b931fa2bb39cb9fee585c1a88f291894c303c96bc5b2553892e89d01000000171600140b67d98b0069797e0b5c94964f94d69476bea509ffffffff0230e4e40b000000001976a914b0fe30da6628923202cbf6e877405ea6d484e9eb88ac007e0fee0100000017a914fe7dfeeb1cbf6330590bc7ee2c47a2de593f192087024730440220625b6fd7299cfd14e6bdaa63cef809da54d4016c6caf5d268fc80c48d7fb41cc02200da35a319d63926112aa26952933ce590e67023993072ab10ab2bfb44f55704f012103c97015da537daded1ac5fd4b5f9cfe55d1d77aed63da77da097d2af08736133900000000",
        "blockhash": "0000000000000000000dfeca4aac6372aa5aff5beb3bd13105eedb2269375723",
        "confirmations": 103,
        "time": 1541981822,
        "blocktime": 1541981822
    },
    "error": null,
    "id": null
}
</code></pre>

<bitcoin-core><api>
Why is input number non-existent in bitcoin API?
SantiClaus
# Why is input number non-existent in bitcoin API?

(Asked by: username_0 on 2018-11-12)

Why when I use this public Bitcoin Api to practice a command, the input value of BTC does not show up?

API Call can be found here:

[API Website](http://chainquery.com/bitcoin-api/getrawtransaction/1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86/1)

Transaction from block explorer can be found here:

[Explorer Tx](https://blockexplorer.com/tx/1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86)

```
{
    "result": {
        "txid": "1e12864a9852ebd2b71a743752cc1561b000663f47bd71bc383b0cacad614d86",
        "hash": "bf43137e355def3d6292c296c864d9f6a9da353db6e4bd40c55e7cc4df245774",
        "version": 2,
        "size": 249,
        "vsize": 168,
        "locktime": 0,
        "vin": [
            {
                "txid": "9de8923855b2c56bc903c39418298fa8c185e5feb99cb32bfa31b9d06700ced8",
                "vout": 1,
                "scriptSig": {
                    "asm": "00140b67d98b0069797e0b5c94964f94d69476bea509",
                    "hex": "1600140b67d98b0069797e0b5c94964f94d69476bea509"
                },
                "txinwitness": [
                    "30440220625b6fd7299cfd14e6bdaa63cef809da54d4016c6caf5d268fc80c48d7fb41cc02200da35a319d63926112aa26952933ce590e67023993072ab10ab2bfb44f55704f01",
                    "03c97015da537daded1ac5fd4b5f9cfe55d1d77aed63da77da097d2af087361339"
                ],
                "sequence": 4294967295
            }
        ],
        "vout": [
            {
                "value": 1.99550000,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 b0fe30da6628923202cbf6e877405ea6d484e9eb OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914b0fe30da6628923202cbf6e877405ea6d484e9eb88ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "1H8rSFYmaZoSbdsXjF4Q5zb53FHNYAdTLj"
                    ]
                }
            },
            {
                "value": 82.88960000,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_HASH160 fe7dfeeb1cbf6330590bc7ee2c47a2de593f1920 OP_EQUAL",
                    "hex": "a914fe7dfeeb1cbf6330590bc7ee2c47a2de593f192087",
                    "reqSigs": 1,
                    "type": "scripthash",
                    "addresses": [
                        "3QteVcFbTqoS8fSFYgwuet1yWD8YGfuas4"
                    ]
                }
            }
        ],
        "hex": "02000000000101d8ce0067d0b931fa2bb39cb9fee585c1a88f291894c303c96bc5b2553892e89d01000000171600140b67d98b0069797e0b5c94964f94d69476bea509ffffffff0230e4e40b000000001976a914b0fe30da6628923202cbf6e877405ea6d484e9eb88ac007e0fee0100000017a914fe7dfeeb1cbf6330590bc7ee2c47a2de593f192087024730440220625b6fd7299cfd14e6bdaa63cef809da54d4016c6caf5d268fc80c48d7fb41cc02200da35a319d63926112aa26952933ce590e67023993072ab10ab2bfb44f55704f012103c97015da537daded1ac5fd4b5f9cfe55d1d77aed63da77da097d2af08736133900000000",
        "blockhash": "0000000000000000000dfeca4aac6372aa5aff5beb3bd13105eedb2269375723",
        "confirmations": 103,
        "time": 1541981822,
        "blocktime": 1541981822
    },
    "error": null,
    "id": null
}

```

**Tags:** bitcoin-core, api


---

## 1 answers

### Answer by username_1 on 2018-11-12. Score: 0 | Accepted answer

That is how it works, you need to look up the previous transaction where that output exists in order to get the value. The equivalent call using `bitcoin-cli` is:

```
$ bitcoin-cli getrawtransaction 9de8923855b2c56bc903c39418298fa8c185e5feb99cb32bfa31b9d06700ced8 2

```

then you can find the `vout` with index 1.

> **Comments:**
> **username_0**: Great, and thanks. @username_1 do you know of a way to implement a python script to do this for all transactions.  
> **username_1**: NP, that's a pretty broad question are you asking me to code it for you? You can call that RPC endpoint using http and then parse the results. There are plenty of python wrapper modules out there for bitcoin-core RPC.  
> **username_0**: great. yeah it is a broad question but just want to make sure its possible. Do you know of any helpful links? Not asking you to code it.  
> **username_1**: I'd just search for python bitcoin rpc, i haven't personally used any of them myself.  

---

