The Zcash tx-tool is designed to create and send Zcash transactions to a node (e.g., Zebra). It currently supports transaction versions V5 and V6, including the Orchard ZSA (Zcash Shielded Assets) functionality.
This repository includes a simple Zebra Docker image that incorporates the OrchardZSA version of Zebra and runs in regtest mode.
WARNING: This tool is not a wallet and should not be used as a wallet. This tool is in the early stages of development and should not be used in production environments.
- Features
- Core Components
- Prerequisites
- Getting Started
- Configuration
- Build Instructions
- Test Scenarios
- Connecting to the Public ZSA Testnet
- License
- Acknowledgements
- Transaction Creation: Craft custom Zcash transactions.
- Transaction Submission: Send transactions to a Zcash node.
- ZSA Support: Work with Zcash Shielded Assets (Orchard ZSA).
- Version Compatibility: Supports transaction versions V5 and V6.
- Tested on Ubuntu 22.04 LTS but should work on any Linux distribution that support the Prerequisites.
- Alpha - Everything, including APIs and data structures, is subject to breaking changes. Feature set is incomplete.
- librustzcash: Used for transaction creation and serialization. This version includes slight modifications for additional functionality.
- Diesel ORM Framework: A safe and extensible ORM and query builder for Rust.
- Abscissa Framework: A microframework for building Rust applications.
- Docker: Install Docker
- Rust & Cargo: Install Rust and Cargo
- Diesel CLI: Installed via Cargo.
- Linux Dev tools:
sudo apt update
sudo apt install pkg-config libssl-dev libsqlite3-dev Open a terminal and execute the following commands:
# Clone the zebra repository with the ZSA integration branch
git clone -b zsa-integration-demo --single-branch https://github.com/QED-it/zebra.git
# Navigate to the testnet deployment directory
cd zebra/testnet-single-node-deploy
# Build the Zebra Docker image
docker build -t qedit/zebra-regtest-txv6 .
# Run the Zebra Docker container
docker run -p 18232:18232 qedit/zebra-regtest-txv6For more details on how the Docker image is created and synchronized, refer to the Dockerfile in the zebra repository.
In a separate terminal window, perform the following steps:
Install Diesel CLI and set up the database and get Zcash Params for Sapling:
# Install Diesel CLI with SQLite support
cargo install diesel_cli --no-default-features --features sqlite
# Set up the database
diesel setup
# Get Zcash Params for Sapling (if needed)
./zcutil/fetch-params.shThere are multiple test scenarios provided in the repository, viz.
test-orchard-zsa(The detailed script for the flow is at test_orchard_zsa.rs.)test-three-party(The detailed script for the flow is at test_three_party.rs.)test-orchard(The detailed script for the flow is at test_orchard.rs.)
Build and run the test case of your choice using the Zcash Transaction Tool, by replacing <test-case> in the command below with either of the test scenarios listed above:
# Build and run with ZSA feature enabled
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool <test-case>For example, to run the test-orchard-zsa scenario, use:
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsaNote: To re-run the test scenario (or to run a different scenario), reset the Zebra node by stopping and restarting the Zebra Docker container.
You can specify the path to the configuration file using the --config flag when running the application. The default configuration file name is config.toml.
An example configuration file with default values is provided in regtest_config.toml.
To set up the Diesel database:
-
Install Diesel CLI:
cargo install diesel_cli --no-default-features --features sqlite
-
Set Up the Database:
diesel setup
To build the application:
# Debug build
cargo build
# Release build (recommended for performance)
cargo build --releaseTo test ZSA functionality with the tool, enable the corresponding feature flag:
cargo build --releaseWe describe here
This test scenario (src/commands/test_orchard_zsa.rs) is a two-party setting which performs the following steps:
- Issue an Asset: Create and issue a new ZSA.
- Transfer the Asset: Send the issued asset to another account.
- Burn the Asset (Twice): Burn the asset in two separate transactions.
To run the test scenario:
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsaThis test scenario (src/commands/test_three_party.rs) is a three-party setting which performs the following steps:
- Issue an Asset: Create and issue a new ZSA.
- Transfer the Asset (Twice): Send the issued ZSA to another account, and then from that account to a third account.
- Burn the Asset: The third account burns the ZSA.
To run the test scenario:
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-three-partyIt is also possible to construct your own scenario in a manner similar to these. To do so, copy one of the test scenario files to a new file in the same location and make the changes to fit your setting.
To allow this new file to be run, make the following changes to commands.rs:
- Add the module corresponding to your new file to the start of commands.rs.
- Add an analogous new variant to the
AppCmdenum.
You should then be able to run your scenario via (assuming test-scenario is the name of your scenario):
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-scenarioWe’ve made it easy to test Zcash Shielded Assets (ZSA) functionality by connecting directly to our public Zebra node, hosted by QEDIT on AWS.
- TLS-enabled URL: https://dev.zebra.zsa-test.net
You can run the zcash_tx_tool against our testnet by setting the appropriate environment variables before running your test scenarios.
Set the following environment variables before running your test scenarios:
export ZCASH_NODE_ADDRESS=dev.zebra.zsa-test.net
export ZCASH_NODE_PORT=443
export ZCASH_NODE_PROTOCOL=httpsThen run your test scenario as usual:
cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsaExample logs:
Using NetworkConfig: node_address = dev.zebra.zsa-test.net ; node_port = 443 ; protocol = https
2025-05-08T08:07:23.864492Z INFO zcash_tx_tool::components::transactions: Starting sync from height 1
...
2025-05-08T08:08:58.961625Z INFO zcash_tx_tool::commands::test_balances: === Balances after burning ===
2025-05-08T08:08:58.961634Z INFO zcash_tx_tool::commands::test_balances: Account 0 balance: 990
2025-05-08T08:08:58.961638Z INFO zcash_tx_tool::commands::test_balances: Account 1 balance: 1
This demonstrates the full ZSA lifecycle and verifies testnet functionality.
This project is licensed under the MIT License. See the LICENSE file for details.
- Zcash: The privacy-protecting digital currency.
- Zebra: An independent Zcash node implementation.
- librustzcash: The Rust library underpinning Zcash.
- Diesel ORM Framework: For database interactions.
- Abscissa Framework: For application structure.
Feel free to contribute to this project by opening issues or submitting pull requests.