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

validateaddress - Zcash

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

This method validates a transparent Zcash address and returns metadata: whether the address is well-formed, whether it's P2PKH (t1) or P2SH (t3), and the raw script hash. For shielded and unified addresses, use z_validateaddress instead.

Parameters

Parameter
Type
Required
Description

address

string

Yes

Transparent Zcash address to validate

Request

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

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

console.log(response.data.result);

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "isvalid": true,
        "address": "t1c74RiTicVSKthLmn2c4WFLJdLDs5sQ4X6",
        "scriptPubKey": "76a914c74RiTicVSKthLmn2c4WFLJdLDs5sQ4X688ac",
        "isscript": false
    }
}

Response Parameters

Parameter
Type
Description

isvalid

boolean

true if the address is well-formed

address

string

The validated address

scriptPubKey

string

Hex-encoded scriptPubKey for this address

isscript

boolean

true if the address is a P2SH (t3) address, false if P2PKH (t1)

Use Cases

  • Address Input Validation: Validate user-supplied addresses in wallet UIs before allowing send

  • Address Type Detection: Distinguish P2PKH from P2SH addresses to select the correct signing path

  • Explorer Search Sanity: Verify search input is a valid address before running expensive queries

Error Handling

Error Code
Message
Description

-32602

Invalid params

Address parameter is missing or malformed

-32603

Internal error

Node failed to validate the address

Was this helpful?