z_validateaddress - Zcash

This method validates a Zcash shielded or unified address (Sapling zs, Orchard, or Unified u) and returns type-specific metadata. Unified addresses can contain multiple receivers (transparent + Sapling + Orchard); the response indicates which types are present. Use validateaddress for transparent addresses.

Parameters

ParameterTypeRequiredDescription
addressstringYesShielded or Unified Zcash address

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": "z_validateaddress",
    "params": [
        "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
    ],
    "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: 'z_validateaddress',
    params: [
        "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
    ],
    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': 'z_validateaddress',
        'params': [
        "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
    ],
        '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": "z_validateaddress",
            "params": [
        "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua"
    ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "result": {
        "isvalid": true,
        "address": "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua",
        "address_type": "p2pkh",
        "ismine": false
    },
    "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
isvalidbooleantrue if the address is well-formed
address_typestringAddress type: sapling, orchard, unified, or p2pkh/p2sh for transparent
addressstringThe validated address
receiver_typesarray of stringFor unified addresses: list of receiver types included (orchard, sapling, p2pkh, p2sh). Returned for Unified Addresses only

Use Cases

  • Shielded Wallet Input Validation: Verify shielded and unified addresses before allowing send
  • Unified Address Introspection: Determine which receiver types a unified address supports to select the appropriate spending pool
  • Address Migration Support: Detect legacy Sapling addresses vs modern Orchard/unified addresses in wallet UX
  • Compliance Address Type Reporting: Distinguish shielded vs transparent activity for jurisdictional reporting

Error Handling

Error CodeMessageDescription
-8Invalid addressAddress is not a valid shielded or unified Zcash address
-32602Invalid paramsAddress parameter is missing or malformed
-32603Internal errorNode failed to validate the address