getaddressutxos - Zcash
Example code for the getaddressutxos JSON-RPC method. Complete guide on how to use the getaddressutxos JSON-RPC method in GetBlock.io Web3 documentation.
This method returns all unspent transaction outputs (UTXOs) held by one or more transparent addresses. Optionally includes chain-info metadata (chain tip height and hash) alongside the UTXOs for consistency guarantees. Transparent UTXOs only — shielded notes are not enumerable.
Parameters
addresses_or_object
object
Yes
Request object (see below)
Request Object
addresses
array of string
Yes
Transparent addresses to query
chainInfo
boolean
No
If true, wrap the UTXO list in a chain-info envelope. Default false
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getaddressutxos",
"params": [
{
"addresses": [
"t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
],
"chainInfo": true
}
],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'getaddressutxos',
params: [
{
"addresses": [
"t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
],
"chainInfo": true
}
],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);Response
Response Parameters
utxos
array of object
List of unspent outputs (present when chainInfo=true)
utxos[].address
string
Address holding this UTXO
utxos[].txid
string
Transaction ID containing the UTXO
utxos[].outputIndex
integer
Output index within the transaction
utxos[].script
string
Hex-encoded scriptPubKey
utxos[].satoshis
integer
UTXO value in zatoshi
utxos[].height
integer
Block height at which the UTXO was created
hash
string
Chain tip hash at query time (chainInfo=true only)
height
integer
Chain tip height at query time (chainInfo=true only)
Use Cases
Wallet Coin Selection: Enumerate UTXOs for coin-selection algorithms when constructing new transactions
Transparent Balance Verification: Independently sum UTXOs to verify
getaddressbalanceresultsConsistent Snapshot Reads: Use
chainInfo=trueto get UTXOs alongside the tip they were read atCustody Reconciliation: Enumerate all UTXOs across a family of custody addresses for accounting
Error Handling
-8
Invalid address
One or more addresses are malformed
-32602
Invalid params
Request structure is malformed
-32603
Internal error
Address indexing may be disabled
Last updated
Was this helpful?