gettxout - Zcash

This method returns information about a specific transparent unspent transaction output (UTXO). Returns null if the output has already been spent or doesn't exist. Note that this method covers transparent outputs only — shielded outputs are private by design and cannot be enumerated via this RPC.

Parameters

ParameterTypeRequiredDescription
txidstringYesTransaction ID containing the output
nintegerYesOutput index (0-based) within the transaction
include_mempoolbooleanNoIf true, include mempool transactions in the lookup. Default true

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "gettxout",
    "params": [
        "65951708c3d0087631c663179faf2b84e11d41b95fd56eae9dc4810e565415ee",
        1,
        true
    ],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'gettxout',
    params: [
        "65951708c3d0087631c663179faf2b84e11d41b95fd56eae9dc4810e565415ee",
        1,
        true
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'gettxout',
        'params': [
        "65951708c3d0087631c663179faf2b84e11d41b95fd56eae9dc4810e565415ee",
        1,
        true
    ],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "gettxout",
            "params": [
        "65951708c3d0087631c663179faf2b84e11d41b95fd56eae9dc4810e565415ee",
        1,
        true
    ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "result": {
        "bestblock": "000000000044b7b0276f3baa73a690467eaff42379eaeeb197a983c6f1408ce1",
        "confirmations": 17150,
        "value": 3.17223382,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 13bbd8bc8df03a5a9cda88103f583aa8bc043e24 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a91413bbd8bc8df03a5a9cda88103f583aa8bc043e2488ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
                "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
            ]
        },
        "version": 6,
        "coinbase": false
    },
    "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
bestblockstringHash of the chain tip at query time
confirmationsintegerNumber of confirmations (0 for mempool UTXOs)
valuenumberOutput value in ZEC
scriptPubKey.asmstringHuman-readable script disassembly
scriptPubKey.hexstringHex-encoded raw script
scriptPubKey.reqSigsintegerRequired signature count for standard scripts
scriptPubKey.typestringScript type (pubkeyhash, scripthash, multisig, pubkey, nulldata)
scriptPubKey.addressesarray of stringTransparent addresses that can spend this output
coinbasebooleanWhether this output is from a coinbase (miner reward) transaction

Use Cases

  • Wallet UTXO Verification: Confirm a UTXO is still unspent before using it as an input
  • Explorer UTXO Detail: Show output-level detail on transaction detail pages
  • Balance Reconstruction: Iterate known UTXOs to reconstruct a wallet's transparent balance
  • Coinbase Maturity Checks: Detect coinbase UTXOs and enforce the 100-confirmation maturity rule before spending

Error Handling

Error CodeMessageDescription
-32602Invalid paramsTxID or output index is malformed
-32603Internal errorNode failed to look up the UTXO