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

Transaction from block explorer can be found here:

Explorer Tx

{
    "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
}
up vote 0 down vote accepted

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.

  • Great, and thanks. @JBaczuk do you know of a way to implement a python script to do this for all transactions. – SantiClaus Nov 12 at 19:27
  • 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 Nov 12 at 19:31
  • 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 Nov 12 at 19:34
  • I'd just search for python bitcoin rpc, i haven't personally used any of them myself. – JBaczuk Nov 12 at 20:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.