How to enable RPC for Zebra 1.0.0 stable release?

Since upgrading zebra from the RC releases to the 1.0.0 stable release, I can’t get RPC on port 8232 to work anymore. I’ve been following the steps at Hosting Zcash litewalletd via Zebra – JMPInline ( (in fact, I wrote that blog) for some time, but now with 1.0.0, port 8232 appears to be closed.

I’m running zebra via its docker image. When I run bash within the docker container (while zebra is running) and run curl, I get this:

# curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: application/json'
curl: (7) Failed to connect to port 8232: Connection refused

The zebrad.toml file I created includes this:

listen_addr = ''

But when I start the container, it rewrites the file and removes that section. This is the whole content of the rewritten file:

network = "Mainnet"
listen_addr = ""

cache_dir = "/var/cache/zebrad-cache"

#endpoint_addr = ""

Why is zebra rewriting my config file? How do I enable JSON-RPC calls into it?


Thank you for reporting this. I’ll have a look at it as we recently made changes to Docker, including an entrypoint for the runtime build: zebra/docker/ at main · ZcashFoundation/zebra · GitHub

This is a great post by the way Hosting Zcash litewalletd via Zebra – JMPInline, we might consider including the Healthcheck in our image :grimacing:


We rewrote our Dockerfile for the stable release, so specifying the RPC port manually in your config in the Docker volume won’t work anymore. You can now pass the RPC port when building the image (--build-arg RPC_PORT=8232) or when starting the container (--env "RPC_PORT=8232"), and Zebra will pick it up. Here’s the relevant Dockerfile part when building the image: zebra/docker/Dockerfile at 40d697a66c3a732502a99994d0d2692c3ebf3e08 · ZcashFoundation/zebra · GitHub, and here’s the relevant part of the script that starts Zebra in the container: zebra/docker/ at 40d697a66c3a732502a99994d0d2692c3ebf3e08 · ZcashFoundation/zebra · GitHub. Please note that the Docker API might change soon. You can track the status of those updates here Inconsistent management of ports in the Dockerfile · Issue #6759 · ZcashFoundation/zebra · GitHub.


Thanks. I like the changes. I added this to my docker-compose.yml file:

    - RPC_PORT=8232

And removed the external volume I had previously had to setup in order to set up the config file.
It seems to be working now. :slight_smile:


Great, these are very recent changes. We’ll have them documented in the Zebra book together with other Docker config options at some point.

Happy shielding.


Thanks for the great blog post!

Here’s some things you might be interested in tweaking:

With zcashd, we could use the included zcash-cli tool, but that tool is not included in the zebra image. I suspect it would be incompatible anyway

zcash-cli is compatible with zebrad, we’ve used it in some of our manual RPC testing. Feel free to copy it across from the zcashd Docker image, and use it with zebrad.

HEALTHCHECK --interval=15s --start-period=3m CMD curl --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest”, “method”: “getblockchaininfo”, “params”: }’ -H ‘content-type: application/json’

If you use the getinfo method, it could be slightly faster, because it has a smaller RPC response, and it doesn’t query the chain tip. It’s unlikely to make any practical difference though!


Did not know this, very neat!