From d725d29a580e5f575cbf47dfe3805726971e3453 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 26 Jul 2023 00:51:05 +0200 Subject: [PATCH] add(Docker): Docs for mining with Docker (#7179) * Add docs for mining with Docker * Refactor the docs for mining with Docker * Add a note on syncing --- book/src/SUMMARY.md | 1 + book/src/user/mining-docker.md | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 book/src/user/mining-docker.md diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index e0c32275..aa49967e 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -15,6 +15,7 @@ - [zk-SNARK Parameters](user/parameters.md) - [Mining](user/mining.md) - [Testnet Mining with s-nomp](user/mining-testnet-s-nomp.md) + - [Mining with Zebra in Docker](user/mining-docker.md) - [Kibana blockchain explorer](user/elasticsearch.md) - [Troubleshooting](user/troubleshooting.md) - [Developer Documentation](dev.md) diff --git a/book/src/user/mining-docker.md b/book/src/user/mining-docker.md new file mode 100644 index 00000000..e5d97431 --- /dev/null +++ b/book/src/user/mining-docker.md @@ -0,0 +1,45 @@ +# Mining with Zebra in Docker + +Some of our published [Docker images](https://hub.docker.com/r/zfnd/zebra/tags) +have the `.experimental` suffix in their name. We compile these images with the +`getblocktemplate-rpcs` feature, and you can use them for your mining +operations. For example, executing + +```bash +docker run -e MINER_ADDRESS="t1XhG6pT9xRqRQn3BHP7heUou1RuYrbcrCc" -p 8232:8232 zfnd/zebra:v1.1.0.experimental +``` + +will start a container on Mainnet and bind port 8232 on your Docker host. If you +want to start generating blocks, you need to let Zebra sync first. + +Note that you must pass the address for your mining rewards via the +`MINER_ADDRESS` environment variable when you are starting the container, as we +did in the example above. The address we used starts with the prefix `t1`, +meaning it is a Mainnet P2PKH address. Please remember to set your own address +for the rewards. + +The port we mapped between the container and the host with the `-p` flag in the +example above is Zebra's default Mainnet RPC port. If you want to use a +different one, you can specify it in the `RPC_PORT` environment variable, +similarly to `MINER_ADDRESS`, and then map it with the Docker's `-p` flag. + +Instead of listing the environment variables on the command line, you can use +Docker's `--env-file` flag to specify a file containing the variables. You +can find more info here +https://docs.docker.com/engine/reference/commandline/run/#env. + +## Mining on Testnet + +If you want to mine on Testnet, you need to set the `NETWORK` environment +variable to `Testnet` and use a Testnet address for the rewards. For example, +running + +```bash +docker run -e NETWORK="Testnet" -e MINER_ADDRESS="t27eWDgjFYJGVXmzrXeVjnb5J3uXDM9xH9v" -p 18232:18232 zfnd/zebra:v1.1.0.experimental +``` + +will start a container on Testnet and bind port 18232 on your Docker host, which +is the standard Testnet RPC port. Notice that we also used a different rewards +address. It starts with the prefix `t2`, indicating that it is a Testnet +address. A Mainnet address would prevent Zebra from starting on Testnet, and +conversely, a Testnet address would prevent Zebra from starting on Mainnet.