Giter VIP home page Giter VIP logo

zen-node-docker's Introduction

latest release v5.0.2 Docker Automated build Docker Stars Docker Pulls

Docker image for the Horizen Blockchain Daemon - zend

Notes

Starting from v4.0.0-rc3, zen-node docker containers will be released in only one version, which includes the AddressIndexing features that were previously only available in the bitcore tags. This means that new bitcore* tags for block explorers will not be published anymore, please use the normal tags for block explorers starting with v4.0.0-rc3

Available tags

Release tags:

Usage examples

To run, execute docker run --name zen-node zencash/zen-node, this will create a minimal zen.conf file in the named volume /mnt/zen which is used as zend's data directory and downloads the ZCash trusted setup to the named volume /mnt/zcash-params. Once the trusted setup is downloaded and verified zend will start syncing with the blockchain.

To execute zen-cli commands inside of a running container, use docker exec -it zen-node gosu user zen-cli $command, to see available cli commands run docker exec -it zen-node gosu user zen-cli help.

To gain a shell inside of the container, run docker exec -it zen-node gosu user bash, after that zen-cli can be executed as if running natively.

To use data/params directories stored on the host instead of docker volumes, mount them into the docker container at /mnt/zen and /mnt/zcash-params and set LOCAL_USER_ID and LOCAL_GRP_ID environment variables, e.g. docker run --name zen-node -e LOCAL_USER_ID=$(id -u) -e LOCAL_GRP_ID=$(id -g) -v "$HOME/.zen:/mnt/zen" -v "$HOME/.zcash-params:/mnt/zcash-params zencash/zen-node.

To configure zend for use in testnet mode, run docker run --name zen-node -e OPTS="-testnet=1" zencash/zen-node.

To configure zend for use with block explorers, run docker run --name zen-node -e OPTS="-txindex=1 -addressindex=1 -timestampindex=1 -spentindex=1 -zmqpubrawtx=tcp://*:28332 -zmqpubhashblock=tcp://*:28332" zencash/zen-node:bitcore, but be aware of zmq.md#security-warning when exposing the zmq port.

To make zend's P2P port reachable from the outside, run docker run --name zen-node -p 9033:9033 zencash/zen-node or to specify a custom port docker run --name zen-node -p 9876:9876 -e PORT=9876 zencash/zen-node.

Note: never expose the RPC port (default 8231) to the internet! By default the RPC interface is not restricted by origin IP, this will change in a future release, see Configuration options RPC_ALLOWIP_PRESET for more.

For advanced usage, see Configuration options.

Samples

Systemd unit file and docker compose file samples are available here.

Configuration options

To configure the most commonly used zend options, the following environment variables can be used:

  • OPTS define any command line options to run zend with, e.g. -e OPTS="-txindex=1 -debug=1 -testnet=1" Available switches can be displayed with: docker run --rm -e OPTS="-help" zencash/zen-node
  • LOCAL_USER_ID and LOCAL_GRP_ID change ownership of folders mounted into the container at /mnt/zen and /mnt/zcash-params to LOCAL_USER_ID:LOCAL_GRP_ID, if not provided 9001:9001 will be used. With this, host directories can be mounted into the container with the right ownership, zend runs with the same UID:GID inside of the container as specified with LOCAL_USER_ID and LOCAL_GRP_ID. Example: docker run --rm -e LOCAL_USER_ID=$(id -u) -e LOCAL_GRP_ID=$(id -g) -v "$HOME/.zen:/mnt/zen" -v "$HOME/.zcash-params:/mnt/zcash-params zencash/zen-node
  • PORT to set the P2P port, e.g. -e PORT=9033
  • RPC_USER to set the RPC username, e.g. -e RPC_USER=zenuser
  • RPC_PASSWORD to set the RPC password, e.g. -e RPC_PASSWORD=secret
  • RPC_PORT to set the RPC port, e.g. -e RPC_PORT=8231
  • RPC_ALLOWIP_PRESET one of ANY|SUBNET|LOCALHOST, default ANY. LOCALHOST uses zend's default setting of only allowing localhost access. SUBNET tries to detect all local subnets/docker networks, disallowing any public networks. ANY allows IPv4 and IPv6 connections from anywhere by setting rpcallowip=0.0.0.0/0 and rpcallowip=::/0 in zen.conf, to keep backwards compatibility this is the current default. Example: -e RPC_ALLOWIP_PRESET=SUBNET NOTE: the default will change to LOCALHOST in a future release, as allowing ANY is a potential security risk if the RPC port is exposed to the internet.
  • RPC_ALLOWIP comma separated string of one or more IPs/subnets, no spaces. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). Allows RPC access from the provided IPs or networks by setting rpcallowip= for each value in zen.conf. Works in combination with RPC_ALLOWIP_PRESET. Example: -e RPC_ALLOWIP="10.10.10.1,192.168.0.1/24,fe01:a1f:ea75:ca75::/128"
  • EXTERNAL_IP comma separated string of one or more of IPv4, IPv6 or the string "DETECT", no spaces. Adds externalip= for each provided IP Address to zen.conf. "DETECT" tries to determine the outgoing IPv4 and IPv6 address using DNS queries to resolver.opendns.org. Example: -e EXTERNAL_IP="DETECT,1.1.1.1,2606:4700:4700::1111"
  • ADDNODE comma separated string of one or more nodes to try to connect to, in format IPv4:PORT, [IPv6]:PORT or FQDN:PORT, no spaces. Example: -e ADDNODE="37.120.176.224:9033,[2a03:4000:6:8315::1]:9033,mainnet.horizen.global:9033"
  • LOG=STDOUT sets -printtoconsole, logging to docker logs instead of debug.log.
  • TLS_KEY_PATH to set the SSL private key path, e.g. -e TLS_KEY_PATH=/home/user/.zen/ssl.key
  • TLS_CERT_PATH to set the SSL certificate path, e.g. -e TLS_CERT_PATH=/home/user/.zen/ssl.crt
  • CUSTOM_SCRIPT to run a user defined bash script before launching zend. This is useful to e.g. make backups of wallet.dat each time the container starts. Example: -e CUSTOM_SCRIPT=/home/user/.zen/backup_wallet.sh

Building locally

git clone https://github.com/HorizenOfficial/zen-node-docker.git
cd zen-node-docker
for folder in latest latest-legacy-cpu bitcore bitcore-legacy-cpu testing testing-legacy-cpu bitcore-testing bitcore-testing-legacy-cpu; do
  docker build -t zen-node:$folder -f $folder/Dockerfile .
done

zen-node-docker's People

Contributors

aschult5 avatar blbradley avatar cronicc avatar lander86 avatar otoumas avatar tarrenj avatar tvangundy-hl avatar ysibirski avatar zennermac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zen-node-docker's Issues

Horizen Node stuck - v3.2.0

Hi All ,

My node was running fine with version v 3.2.0 but from past 8-10 hours when i query the node it shows "Activating Best Chain ..." . Any thoughts around this , how to fix.

Additional logs for this issue :

2022-12-30 12:53:13 UpdateTip: new best=00000000033047bb7249ebc7f8dd132aead66f871376da1373b7a7f7bbd8fe6a height=1235294 log2 _work=57.05246 tx=31943509 date=2022-10-26 12:47:24 progress=0.875475 cache=45.2MiB(17081tx) 2022-12-30 12:53:13 TLS: ./zen/tlsmanager.cpp: connect():370 - TLS connection to 168.119.83.16:9033 failed (err_code 0x0) 2022-12-30 12:53:14 Connection to 168.119.83.16:9033 will be unencrypted 2022-12-30 12:53:14 UpdateTip: new best=00000000034317d61176451eb99d2a64245ae1484dacd0cf757d9fe85630f4aa height=1235295 log2 _work=57.052462 tx=31943553 date=2022-10-26 12:50:43 progress=0.875479 cache=45.4MiB(17166tx) 2022-12-30 12:53:14 connect() to [2409:8c28:801:227:11::5]:9033 failed: Cannot assign requested address (99) 2022-12-30 12:53:16 Reading config file /home/user/.zen/zen.conf 2022-12-30 12:53:16 Horizen version v3.2.0-bitcore (2022-09-28 15:35:09 +0000) 2022-12-30 12:53:17 Zen version v3.2.0-bitcore (2022-09-28 15:35:09 +0000) 2022-12-30 12:53:17 Using OpenSSL version OpenSSL 1.1.1q 5 Jul 2022 2022-12-30 12:53:17 Using BerkeleyDB version Berkeley DB 6.2.23: (March 28, 2016) 2022-12-30 12:53:17 Default data directory /home/user/.zen 2022-12-30 12:53:17 Using data directory /home/user/.zen 2022-12-30 12:53:17 Using at most 125 connections (1048576 file descriptors available) 2022-12-30 12:53:17 Using 16 threads for script verification 2022-12-30 12:53:17 scheduler thread start 2022-12-30 12:53:17 Loading verifying key from /home/user/.zcash-params/sprout-verifying.key 2022-12-30 12:53:17 Loaded verifying key in 0.010374s seconds. 2022-12-30 12:53:17 Loading Sapling (Spend) parameters from /home/user/.zcash-params/sapling-spend.params 2022-12-30 12:53:17 Loading Sapling (Output) parameters from /home/user/.zcash-params/sapling-output.params 2022-12-30 12:53:17 Loading Sapling (Sprout Groth16) parameters from /home/user/.zcash-params/sprout-groth16.params 2022-12-30 12:53:22 Loaded Sapling parameters in 4.326327s seconds. 2022-12-30 12:53:22 libevent: getaddrinfo: address family for nodename not supported 2022-12-30 12:53:22 Binding RPC on address :: port 8231 failed. 2022-12-30 12:53:22 HTTP: creating work queue of depth 16 2022-12-30 12:53:22 HTTP: starting 4 worker threads 2022-12-30 12:53:22 Using wallet wallet.dat 2022-12-30 12:53:22 init message: Verifying wallet... 2022-12-30 12:53:22 CDBEnv::Open: LogDir=/home/user/.zen/database ErrorFile=/home/user/.zen/db.log 2022-12-30 12:53:22 Bound to [::]:9033 2022-12-30 12:53:22 Bound to 0.0.0.0:9033 2022-12-30 12:53:22 Block index database configuration: 2022-12-30 12:53:22 * Using 1000 max open files 2022-12-30 12:53:22 * Compression is enabled 2022-12-30 12:53:22 Cache configuration: 2022-12-30 12:53:22 * Max cache setting possible 16384MiB 2022-12-30 12:53:22 * Using 337.5MiB for block index database 2022-12-30 12:53:22 * Using 36.1MiB for chain state database 2022-12-30 12:53:22 * Using 76.4MiB for in-memory UTXO set 2022-12-30 12:53:22 init message: Loading block index... 2022-12-30 12:53:22 Opening LevelDB in /home/user/.zen/blocks/index 2022-12-30 12:53:23 Opened LevelDB successfully 2022-12-30 12:53:23 Opening LevelDB in /home/user/.zen/chainstate 2022-12-30 12:53:23 Opened LevelDB successfully 2022-12-30 12:53:58 LoadBlockIndexDB: last block file = 450 2022-12-30 12:53:58 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=315, size=24021202, heights=1234968...123528 2, time=2022-10-25...2022-10-26) 2022-12-30 12:53:58 Checking all blk files are present... 2022-12-30 12:53:59 LoadBlockIndexDB: transaction index enabled 2022-12-30 12:53:59 LoadBlockIndexDB: maturityHeight index disabled 2022-12-30 12:53:59 LoadBlockIndexDB: address index enabled 2022-12-30 12:53:59 LoadBlockIndexDB: timestamp index enabled 2022-12-30 12:53:59 LoadBlockIndexDB: spent index enabled 2022-12-30 12:53:59 LoadBlockIndexDB: hashBestChain=000000000137c57a617a705da00c7c6cff62fd7dee1b1506005a9c1e8d698cc5 height=12 34242 date=2022-10-24 16:08:00 progress=0.871800 2022-12-30 12:53:59 AppInit2: indexVersion 1.0 2022-12-30 12:53:59 init message: Verifying blocks... 2022-12-30 12:53:59 Verifying last 288 blocks at level 3 2022-12-30 12:54:15 No coin database inconsistencies in last 289 blocks (8953 transactions) 2022-12-30 12:54:15 block index 53125ms 2022-12-30 12:54:15 init message: Loading wallet... 2022-12-30 12:54:15 nFileVersion = 3020050 2022-12-30 12:54:15 Keys: 101 plaintext, 0 encrypted, 101 w/ metadata, 101 total 2022-12-30 12:54:15 ZKeys: 0 plaintext, 0 encrypted, 0 w/metadata, 0 total 2022-12-30 12:54:15 wallet 16ms 2022-12-30 12:54:15 init message: Activating best chain... 2022-12-30 12:54:15 UpdateTip: new best=00000000023e81062db03b9128b0f802ea954b2a09d1694c33f5e0e2336ec6af height=1234243 log2 _work=57.049785 tx=31909236 date=2022-10-24 16:09:30 progress=0.871802 cache=0.0MiB(4tx) 2022-12-30 12:54:17 UpdateTip: new best=00000000018074969465890dfdda97f79f6e2745e65da891e94aca8c4fc23dca height=1234244 log2 _work=57.049788 tx=31909306 date=2022-10-24 16:16:13 progress=0.871811 cache=0.1MiB(35tx)

include Let's Encrypt CA

Hello!

This image is very usable. However, any secnode operator will want to add the Let's Encrypt CA bundle to this image in order to use it.

Could it be included in this image by default?

Upgrading Zen node from v2.0.24 to v3.0.2 /3 asking to reindex

Hello ,

I have a zen node running which was working fine with version v2.0.24 but suddenly stooped syncing, when checked the logs it said the node version is deprecated at a specific block and needed to be upgraded . So the latest version being v3.0.3 tried to upgrade but the node does not sync and getting message to use -reindex to recover.

Can any one suggest
1.if -reindex is really needed and is it safe for the existing data if we apply reindex .
2.How many days it takes to re-index a historical node
Reindex-HorizenNode
.

reindex howto

Hello!

I'm having trouble figuring out how to reindex using this image. Any ideas?

Add additional environment variables

TLS_KEY_PATH setting tlskeypath zend option
TLS_CERT_PATH setting tlscertpath zend option

CUSTOM_SCRIPT user provided bash script to be executed at the end of entrypoint.sh, just before starting zend. Useful to e.g. backup wallet.dat every time the container starts.

2.0.15 docker image is broken (zen .deb is not installed)

$ docker run --rm -ti zencash/zen-node:v2.0.15
Starting with UID/GID : 9001/9001
error: exec: "zen-fetch-params": executable file not found in $PATH

weird...

$ docker run --rm -ti --entrypoint=/bin/bash zencash/zen-node:v2.0.15 dpkg -l | grep zen

no output. the package had never been installed, if I look at /var/log/dpkg.log in image.

is there a way to attach a volume?

I would like to store the zen chain in a persistent volume in case I have to reconfigure the container.
Is there a practical way to switch wallet.dat files and restart the container?

Missing dependency sw_vers

docker run --rm -ti zencash/zen-node
Starting with UID/GID : 9001/9001
# Not changed to Zen because we're still using the Zcash zkSNARK params
Zcash - fetch-params.sh

This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.

If they already exist locally, it will exit now and do nothing else.
Retrieving: https://zensystem.io/downloads/sprout-proving.key
/usr/bin/zen-fetch-params: line 27: sw_vers: command not found

how to reindex?

the container just exits and this is the message:

Error: Error: Disk space is low!
Error: Error: Disk space is low!
Starting with UID/GID : 9001/9001

Allowing RPC access from: 0.0.0.0/0 ::/0

Zcash - fetch-params.sh

Zen uses the same zkSNARK parameters generated by ZCash.
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.

If they already exist locally, it will exit now and do nothing else.
: Error opening block database.
Please restart with -reindex to recover.

how can I restart the container with a new config without losing the chain?
also, my hard drive has 80gb, is this enough space?

df -h

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           383M  840K  382M   1% /run
/dev/sda1        75G   72G   32M 100% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      253M  142K  252M   1% /boot/efi
tmpfs           383M     0  383M   0% /run/user/0

Cannot specify LOCAL_GRP_ID corresponding to an existing group in container

Scenario:

LOCAL_GRP_ID already exists in container

Expected behavior:

User is created with existing group

Actual behavior:

Container fails to start with error:
groupadd: GID ... already exists

Perhaps the code should check if the group exists with getent group $LOCAL_GRP_ID before calling groupadd. Currently, it is effectively checking whether the user exists with id -g user.

https://github.com/ZencashOfficial/zen-node-docker/blob/6bfa81750b3f270a5714b37d6887c6e638c4e124/latest/entrypoint.sh#L11

Using Data Volumes

I'm trying to setup a zen-node-docker that will use a mounted LV on my Ubuntu 16.04 LTS Server, but it seems not be working like with my ethereum parity docker.

docker run -d -ti --restart always -v /mnt/zenchain:/mnt/ zencash/zen-node --base-path /mnt/

I had to stop it again because it's filling my root dir, unlike the parity docker which using the same command.

Any thoughts?

running image with LOCAL_GRP_ID=0 fails

$ docker run --name zend-group-check -d -e LOCAL_USER_ID=0 -e LOCAL_GRP_ID=0 -v /etc/letsencrypt:/etc/letsencrypt zencash/zen-node
3515ded8e9e301d63430d5e46d5255367c3a7fdf919f157265631b47e3ad937b
$ docker logs zend-group-check
groupadd: GID '0' already exists

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.