For the complete documentation index, see llms.txt. This page is also available as Markdown.

gettxout - Zcash

Example code for the gettxout JSON-RPC method. Сomplete guide on how to use the gettxout JSON-RPC method in GetBlock.io Web3 documentation.

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

Parameter
Type
Required
Description

txid

string

Yes

Transaction ID containing the output

n

integer

Yes

Output index (0-based) within the transaction

include_mempool

boolean

No

If true, include mempool transactions in the lookup. Default true

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "gettxout",
    "params": [
        "9c8f0e4f8d2e7c6b5a4f3e2d1c0b9a8e7f6d5c4b3a2b1c9d8e7f6a5b4c3d2e1f",
        0,
        true
    ],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');

const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'gettxout',
    params: [
        "9c8f0e4f8d2e7c6b5a4f3e2d1c0b9a8e7f6d5c4b3a2b1c9d8e7f6a5b4c3d2e1f",
        0,
        true
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

Response

Response Parameters

Parameter
Type
Description

bestblock

string

Hash of the chain tip at query time

confirmations

integer

Number of confirmations (0 for mempool UTXOs)

value

number

Output value in ZEC

valueZat

integer

Output value in zatoshi

scriptPubKey.asm

string

Human-readable script disassembly

scriptPubKey.hex

string

Hex-encoded raw script

scriptPubKey.reqSigs

integer

Required signature count for standard scripts

scriptPubKey.type

string

Script type (pubkeyhash, scripthash, multisig, pubkey, nulldata)

scriptPubKey.addresses

array of string

Transparent addresses that can spend this output

coinbase

boolean

Whether 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 Code
Message
Description

-32602

Invalid params

TxID or output index is malformed

-32603

Internal error

Node failed to look up the UTXO

Was this helpful?