From e38ede5eef6824448dc23d4a526ef70e354d2e1e Mon Sep 17 00:00:00 2001 From: macintoshhelper Date: Tue, 1 Jul 2025 04:15:52 +0200 Subject: [PATCH] Add Zcash support (#995) * add zcash fragment with definition * fix zcash port number * fix zec db data and add zec lightwalletd fullnode opt * fix zec lightwalletd zcash.conf error * remove LWD_URL for main zec fragment * set zcash docker image to latest * revert zcash-walletd to 0.0.2 * move zec lwd_url back to zecrocks * add zcash-fullnode exclusive fragment * add fragment configs support * fix compose generator configs --------- Co-authored-by: macintoshhelper <6757532+macintoshhelper@users.noreply.github.com> --- Generated/zcash.conf | 2 + .../crypto-definitions.json | 8 ++ .../docker-fragments/zcash-fullnode.yml | 92 +++++++++++++++++++ .../docker-fragments/zcash.yml | 27 ++++++ .../src/DockerComposeDefinition.cs | 6 ++ 5 files changed, 135 insertions(+) create mode 100644 Generated/zcash.conf create mode 100644 docker-compose-generator/docker-fragments/zcash-fullnode.yml create mode 100644 docker-compose-generator/docker-fragments/zcash.yml diff --git a/Generated/zcash.conf b/Generated/zcash.conf new file mode 100644 index 0000000..22f9ab8 --- /dev/null +++ b/Generated/zcash.conf @@ -0,0 +1,2 @@ +rpcpassword=none +rpcbind=zebra diff --git a/docker-compose-generator/crypto-definitions.json b/docker-compose-generator/crypto-definitions.json index d299288..e6af952 100644 --- a/docker-compose-generator/crypto-definitions.json +++ b/docker-compose-generator/crypto-definitions.json @@ -94,5 +94,13 @@ "LNDFragment": null, "EclairFragment": null, "PhoenixdFragment": null + }, + { + "Crypto": "zec", + "CryptoFragment": "zcash", + "CLightningFragment": null, + "LNDFragment": null, + "EclairFragment": null, + "PhoenixdFragment": null } ] diff --git a/docker-compose-generator/docker-fragments/zcash-fullnode.yml b/docker-compose-generator/docker-fragments/zcash-fullnode.yml new file mode 100644 index 0000000..7be005e --- /dev/null +++ b/docker-compose-generator/docker-fragments/zcash-fullnode.yml @@ -0,0 +1,92 @@ +services: + zcash_walletd: + restart: unless-stopped + image: 1337bytes/zcash-walletd:0.0.2 + environment: + NOTIFY_TX_URL: http://btcpayserver:49392/zcashlikedaemoncallback/tx?cryptoCode=zec&hash= + ROCKET_DB_PATH: /data/zec-wallet.db + LWD_URL: http://lightwalletd:9067 + expose: + - "8000" + volumes: + - "zec_wallet:/data" + + btcpayserver: + environment: + BTCPAY_ZEC_DAEMON_URI: http://zcash_walletd:8000 + BTCPAY_ZEC_WALLET_DAEMON_URI: http://zcash_walletd:8000 + BTCPAY_ZEC_WALLET_DAEMON_WALLETDIR: /root/zec_wallet + volumes: + - "zec_wallet:/root/zec_wallet" + + zebra: + container_name: zebra + image: zfnd/zebra + platform: linux/amd64 + restart: unless-stopped + deploy: + resources: + reservations: + cpus: "4" + memory: 16G + volumes: + - zebrad-cache:/home/zebra/.cache/zebra + tty: true + environment: + - ZEBRA_RPC_PORT=8232 + - ENABLE_COOKIE_AUTH=false + ports: + - "8232:8232" + #networks: + # - generated_default + + lightwalletd: + image: electriccoinco/lightwalletd + platform: linux/amd64 + depends_on: + zebra: + condition: service_started + restart: unless-stopped + deploy: + resources: + reservations: + cpus: "4" + memory: 16G + environment: + - LWD_GRPC_PORT=9067 + - LWD_HTTP_PORT=9068 + configs: + - source: lwd_config + target: /etc/lightwalletd/zcash.conf + volumes: + - lwd-cache:/var/lib/lightwalletd/db + #! This setup with `--no-tls-very-insecure` is only for testing purposes. + #! For production environments, follow the guidelines here: + #! https://github.com/zcash/lightwalletd#production-usage + command: > + --no-tls-very-insecure + --grpc-bind-addr=0.0.0.0:9067 + --http-bind-addr=0.0.0.0:9068 + --zcash-conf-path=/etc/lightwalletd/zcash.conf + --data-dir=/var/lib/lightwalletd/db + --log-file=/dev/stdout + --log-level=7 + ports: + - "127.0.0.1:9067:9067" # gRPC + - "127.0.0.1:9068:9068" # HTTP + +configs: + lwd_config: + file: ./zcash.conf + +volumes: + zec_wallet: + zec_data: + zebrad-cache: + driver: local + + lwd-cache: + driver: local + +exclusive: + - zcash-node diff --git a/docker-compose-generator/docker-fragments/zcash.yml b/docker-compose-generator/docker-fragments/zcash.yml new file mode 100644 index 0000000..ca3e538 --- /dev/null +++ b/docker-compose-generator/docker-fragments/zcash.yml @@ -0,0 +1,27 @@ +version: "3" + +services: + zcash_walletd: + restart: unless-stopped + image: 1337bytes/zcash-walletd:0.0.2 + environment: + NOTIFY_TX_URL: http://btcpayserver:49392/zcashlikedaemoncallback/tx?cryptoCode=zec&hash= + ROCKET_DB_PATH: /data/zec-wallet.db + LWD_URL: https://zec.rocks:443 + expose: + - "8000" + volumes: + - "zec_wallet:/data" + btcpayserver: + environment: + BTCPAY_ZEC_DAEMON_URI: http://zcash_walletd:8000 + BTCPAY_ZEC_WALLET_DAEMON_URI: http://zcash_walletd:8000 + BTCPAY_ZEC_WALLET_DAEMON_WALLETDIR: /root/zec_wallet + volumes: + - "zec_wallet:/root/zec_wallet" +volumes: + zec_wallet: + zec_data: + +exclusive: + - zcash-node diff --git a/docker-compose-generator/src/DockerComposeDefinition.cs b/docker-compose-generator/src/DockerComposeDefinition.cs index 2e41906..86353ab 100644 --- a/docker-compose-generator/src/DockerComposeDefinition.cs +++ b/docker-compose-generator/src/DockerComposeDefinition.cs @@ -142,6 +142,7 @@ namespace DockerGenerator var services = new List>(); var volumes = new List>(); + var configs = new List>(); var networks = new List>(); foreach (var o in processedFragments.Select(f => (f, ParseDocument(f))).ToList()) { @@ -155,6 +156,10 @@ namespace DockerGenerator { volumes.AddRange(fragmentVolumesRoot.Children); } + if (doc.Children.ContainsKey("configs") && doc.Children["configs"] is YamlMappingNode fragmentConfigsRoot) + { + configs.AddRange(fragmentConfigsRoot.Children); + } if (doc.Children.ContainsKey("networks") && doc.Children["networks"] is YamlMappingNode fragmentNetworksRoot) { networks.AddRange(fragmentNetworksRoot.Children); @@ -165,6 +170,7 @@ namespace DockerGenerator output.Add("version", new YamlScalarNode("3") { Style = YamlDotNet.Core.ScalarStyle.DoubleQuoted }); output.Add("services", new YamlMappingNode(Merge(services))); output.Add("volumes", new YamlMappingNode(volumes)); + output.Add("configs", new YamlMappingNode(configs)); output.Add("networks", new YamlMappingNode(networks)); PostProcess(output);