Network details
JSON-RPC API
To get basic network information from your Zcash node HTTPS endpoint, callgetblockchaininfo:
upgrades, and the balances of the transparent and shielded pools in valuePools.
Address index
Zebra indexes transparent addresses, so you can look up an address’s balance, transaction history, and unspent outputs without running an indexer. Each method takes an object with anaddresses array:
getaddressbalance— the current balance and the total received, in zatoshis.getaddresstxids— the IDs of the transactions that touch the addresses, optionally limited to a block range withstartandend.getaddressutxos— the unspent outputs of the addresses, with the amount of each in thesatoshisfield, in zatoshis.
Shielded pool state
Zebra serves the state of the Sapling and Orchard note commitment trees, which wallets use to sync and to build shielded transactions:z_gettreestate— the note commitment tree state of the Sapling and Orchard pools at a block, by height or hash.z_getsubtreesbyindex— the roots of complete note commitment subtrees forsaplingororchard, from a start index.z_validateaddress— validates a transparent, Sapling, or unified address and returns its type.z_listunifiedreceivers— returns the receivers that a unified address contains.
Python
Install requests:main.py example prints Chain: main, the block height, and the balance and history of the address that received the founders’ reward in block 1. On Testnet, replace the address with a Testnet address, which starts with tm or t2. For a password-protected endpoint, put the credentials in the URL, as in https://USERNAME:PASSWORD@HOSTNAME, and requests sends them as HTTP basic authentication.
JavaScript
The example uses the built-infetch in Node.js 18 or later, so it needs no packages.
fetch rejects a URL that includes credentials, with TypeError: Request cannot be constructed from a URL that includes credentials. For a password-protected endpoint, send the credentials in an Authorization header instead:
Available methods
Chainstack Zcash nodes serve these Zebra JSON-RPC methods on Mainnet and Testnet:
The mining methods
getblocktemplate and submitblock and the node control methods stop, addnode, generate, invalidateblock, and reconsiderblock are not available. A call returns error code -32601.
Zcash behaviors that affect tooling
JSON-RPC over HTTPS only
Zebra serves JSON-RPC over HTTP, so Chainstack Zcash endpoints have no WebSocket endpoint and no subscriptions. To follow new blocks, pollgetbestblockhash or getblockcount. Mainnet produces a block about every 75 seconds.
Amounts come in two units
Transaction outputs report each amount twice, asvalue in ZEC and valueZat in zatoshis. The address index methods report amounts in zatoshis only, and getaddressutxos names the field satoshis. Use the zatoshi fields for arithmetic to avoid floating-point rounding.
Wallet methods are not part of Zebra
Zebra is a full node without a built-in wallet, so the wallet methods of the deprecatedzcashd node, such as z_sendmany, z_getbalance, and listunspent, do not exist. Build and sign transactions with a Zcash wallet library, then broadcast them with sendrawtransaction.