feat: add zcash wallet and mediator services#517
Open
macterra wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Zcash (transparent-only) support to Archon by introducing a Zebra-backed wallet service (Keymaster mnemonic + local signing) and a companion mediator that scans/anchors OP_RETURN batch DIDs, plus wiring/testing/docs to integrate ZEC:* registries end-to-end.
Changes:
- Introduces new
zcash-walletHTTP service (Zebra RPC + local transparent signing) and newzcashmediator (scan/import/export + metrics). - Extends Gatekeeper registry validation to include
ZEC:mainnetandZEC:testnet(TypeScript + Rust) and updates sample configuration. - Adds Dockerfiles/compose integration and Jest tests covering derivation and RPC-backed wallet behavior.
Reviewed changes
Copilot reviewed 33 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/wallet/zcash-wallet.test.ts | New Jest coverage for RPC-backed wallet flows (setup, balance/UTXO normalization, anchoring). |
| tests/wallet/zcash-derivation.test.ts | New tests for derivation, coin type selection, and OP_RETURN size validation. |
| tests/gatekeeper/utils.test.ts | Updates registry listing tests to include ZEC:* registries. |
| services/mediators/zcash/tsconfig.json | TypeScript build config for the Zcash mediator package. |
| services/mediators/zcash/src/zcash-mediator.ts | New mediator service: scans Zebra blocks for OP_RETURN batch DIDs; imports/exports via Gatekeeper/Keymaster and zcash-wallet; exposes metrics. |
| services/mediators/zcash/src/types/bitcoin-core/index.d.ts | Local bitcoin-core type shim for the mediator’s RPC usage. |
| services/mediators/zcash/src/types.ts | Shared mediator DB/types (discovered items, registry block verbosity, etc.). |
| services/mediators/zcash/src/db/sqlite.ts | SQLite persister backend for mediator state. |
| services/mediators/zcash/src/db/redis.ts | Redis persister backend for mediator state. |
| services/mediators/zcash/src/db/mongo.ts | MongoDB persister backend for mediator state. |
| services/mediators/zcash/src/db/jsonfile.ts | JSON-file persister backend for mediator state. |
| services/mediators/zcash/src/db/abstract-db.ts | Shared locking updateDb implementation for persisters. |
| services/mediators/zcash/src/config.ts | Env-driven configuration for the Zcash mediator. |
| services/mediators/zcash/README.md | Mediator documentation: responsibilities, env vars, notes on fee bumping behavior. |
| services/mediators/zcash/package.json | Package metadata/deps for the Zcash mediator. |
| services/mediators/zcash/data/.gitignore | Ignores persisted mediator state in services/mediators/zcash/data. |
| services/mediators/zcash-wallet/tsconfig.json | TypeScript build config for the Zcash wallet service package. |
| services/mediators/zcash-wallet/src/zcash-wallet.ts | New wallet core: address tracking, balance/UTXO views, local tx building/signing/broadcast, OP_RETURN anchoring. |
| services/mediators/zcash-wallet/src/zcash-rpc.ts | Zebra JSON-RPC client wrapper. |
| services/mediators/zcash-wallet/src/wallet-api.ts | New Express HTTP API matching satoshi-wallet contract (admin-key gated) + metrics. |
| services/mediators/zcash-wallet/src/derivation.ts | BIP44 transparent derivation and address generation for Zcash (mainnet/testnet). |
| services/mediators/zcash-wallet/src/config.ts | Env-driven configuration for the Zcash wallet service. |
| services/mediators/zcash-wallet/package.json | Package metadata/deps for the Zcash wallet service. |
| services/mediators/zcash-wallet/package-lock.json | Lockfile for the Zcash wallet service dependencies. |
| sample.env | Adds ZEC-related env examples and includes ZEC:mainnet in Gatekeeper registries. |
| rust/services/gatekeeper/src/api.rs | Allows ZEC:mainnet/ZEC:testnet in Rust Gatekeeper registry validation. |
| packages/gatekeeper/src/gatekeeper.ts | Allows ZEC:mainnet/ZEC:testnet in TS Gatekeeper registry validation. |
| package.json | Adds @bitgo/utxo-lib dependency at repo root (needed for shared/test builds). |
| package-lock.json | Updates lockfile for new root dependency graph. |
| docs/services/mediators/zcash-wallet/README.md | Wallet documentation: scope, routes, config, Zebra RPC requirements. |
| docs/services/gatekeeper/README.md | Documents ZEC:* as supported registries. |
| Dockerfile.zcash-wallet | Container build for the wallet service. |
| Dockerfile.zcash | Container build for the mediator service. |
| docker-compose.zcash-mainnet.yml | Compose stack for Zcash wallet + mediator on mainnet. |
| docker-compose.yml | Includes Zcash compose and adds ZEC:mainnet to explorer networks. |
| AGENTS.md | Adds repo guidance for Zebra-backed transparent-only wallet behavior and registry validator updates. |
Files not reviewed (1)
- services/mediators/zcash-wallet/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds transparent-only Zcash wallet and mediator services. The wallet matches the
satoshi-walletHTTP contract as closely as practical while using Zebra for chain/address-index/broadcast RPCs and Keymaster for mnemonic-backed local signing. The mediator mirrors thesatoshi-mediatorimport/export flow forZEC:*registries.What changed
services/mediators/zcash-walletwith deterministic transparent derivation, Zebra RPC support, wallet routes, local transaction signing, send/anchor support, and explicit unsupported fee bumping.services/mediators/zcashto scan Zebra blocks for OP_RETURN batch DIDs, import discovered batches, export Gatekeeper queues throughzcash-wallet, and publish block metadata.Validation
npm run buildinservices/mediators/zcash-walletnpm run buildinservices/mediators/zcashnpm test -- --runTestsByPath tests/gatekeeper/utils.test.ts tests/wallet/zcash-derivation.test.ts tests/wallet/zcash-wallet.test.ts --runInBandcargo check --manifest-path rust/services/gatekeeper/Cargo.tomlgit diff --checkhttp://100.70.86.134:8232/:getblockcount, address-index RPCs, and verbosity-2 block shape for mediator scanning.No broadcast was attempted.
cargo fmt --check --manifest-path rust/services/gatekeeper/Cargo.tomlstill reports pre-existing formatting drift across the Rust service beyond this change.