RPC to query transactions?

Hello, i’d like to know if there’s a way to collect informations about transactions or balance of some address using the zcash-cli command.

For example if I try to know the balance of this address → t3gQDEavk5VzAAHK8TrQu2BWDLxEiF1unBm (a Founder’s Reward one)
with zcash-cli getbalance *address*, it returns 0, but it isn’t the right value: Accounts - Zchain.

As from I understood, I can only check MY address balance, generated within zcashd and not some random one.

So, is there a way to retrieve this kind of information? Are there some “hidden APIs” to query?

PS: Again, I hope I posted this in the right section :kissing_closed_eyes:

Check the list of RPC commands here https://zcash-rpc.github.io/ (or simply zcash-cli --help).

You can analyse non-wallet transactions (assuming you have txindex=1 in your zcash.conf file) with getrawtransaction and then running decoderawtransaction on the result.

As for getting transactions per address use a block explorer and then analyse the individual transactions. All the information is available via the individual transactions/blocks but they are indexing the data and making it much easier to interpret.

See this WIP documentation that was just published: source/rtd_pages/insight_explorer.rst · 954ac2cf4373cae408efd0838d8b468ea6018caa · zcash-docs / zcash-docs · GitLab

As noted on other thread some Insight explorer changes are being incorporated into the main zcashd so once they are merged these RPC methods will be available if enabled. You can actually use these already though assuming you are running the Docker Insight container as that patched version of zcashd contains them.

Using your example above for the address balance. First SSH into the container:

docker exec -it zcash-explorer /bin/bash

Then use the getaddressbalance RPC method:

/home/zcashd/zcash-patched-for-explorer/src/zcash-cli getaddressbalance '{"addresses": ["t3gQDEavk5VzAAHK8TrQu2BWDLxEiF1unBm"]}'
{
  "balance": 1475000000000,
  "received": 1475000000000
}
1 Like