Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLaux committed Nov 25, 2024
1 parent 41fc6fb commit da9d4b5
Showing 1 changed file with 65 additions and 66 deletions.
131 changes: 65 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,40 @@ Core components include:



## Zebra node
## Executing the ZSA flow against a dockerized Zebra node

Before testing, we need to bring up the desired node and ensure that V5 transactions are activated (NU5 is active).
To build and run the Zebra docker image:

Currently, we use a custom Zebra build. There are several changes compared to the upstream node:

- Activation height is set to `1,060,755`

- PoW is disabled

- Consensus branch id is set to custom value. This is done to fork from the main chain
```bash
% docker build -t qedit/zebra-regtest-txv6 .

- Peers lists are empty, meaning that a node will not connect to any other nodes
% docker run -p 18232:18232 qedit/zebra-regtest-txv6
```
More details on how the docker file is created and synced: [Dockerfile](./Dockerfile)

- Blocks up to new activation height are pre-mined and stored in the database that is built into the docker image to avoid long initial sync time
In a different window, setup and run the Zcash transaction tool:

To build and run the docker image:
A one time setup for Diesel is required:
```bash
% cargo install diesel_cli --no-default-features --features sqlite

% diesel setup
```
Build and run the orchardZSA test case using the Zcash transaction tool:
```bash
docker build -t qedit/zebra-regtest-txv6 .
% RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsa
```
To re-run the test scenario, you need to reset the Zebra node by shutting down the Zebra container and starting it again.

docker run -p 18232:18232 qedit/zebra-regtest-txv6
```
The detailed script for the ZSA flow are in the file [test_orchard_zsa.rs](src/commands/test_orchard_zsa.rs)

More details on how the docker file is created and synced: [Link](https://github.com/QED-it/zcash_tx_tool/blob/main/Dockerfile)


## Configuration

The path to the configuration file can be specified with the `--config` flag when running the application. The default filename is "config.toml"

An example configuration file with default values can be found in `example_config.toml`
An example configuration file with default values can be found in `regtest_config.toml`


## Build instructions
Expand All @@ -67,77 +69,74 @@ Although release build is highly recommended for performance reasons:
To test ZSA functionality with the tool, the corresponding flag should be set:

```bash
RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo build
% RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo build
```

## Vanilla Orchard test scenario
## ZSA Orchard test scenario

Main test scenario ([src/commands/test_orchard.rs](src/commands/test_orchard.rs)) consists of the following steps:
Main test scenario ([src/commands/test_orchard_zsa.rs](src/commands/test_orchard_zsa.rs)) consists of the following steps:

1) Mine 100 empty blocks to be able to use transparent coinbase output
2) Create and mine a new shielding transaction with a transparent input and a shielded output
3) Create and mine a new transfer transaction with shielded inputs and outputs
4) Assert balances for the selected accounts
1) Issue an asset
2) Transfer the asset to another account
3) Burn the asset (x2)

To run the test scenario:

```bash
cargo run --package zcash_tx_tool --bin zcash_tx_tool test-orchard
% RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo run --release --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsa
```

With optional, but recommended `--release` flag, or simply
[//]: # ()
[//]: # (## Docker-based demo)

```bash
zcash_tx_tool test-orchard
```
[//]: # ()
[//]: # (You can also run the tests using docker. To do that you'll need first to build the docker image)

## ZSA Orchard test scenario
[//]: # ()
[//]: # (```bash)

Main test scenario ([src/commands/test_orchard_zsa.rs](src/commands/test_orchard_zsa.rs)) consists of the following steps:
[//]: # (% docker build -t zcash_tx_tool -f Dockerfile-demo .)

1) Issue an asset
2) Transfer the asset to another account
3) Burn the asset
[//]: # (```)

To run the test scenario:
[//]: # ()
[//]: # (And after that run the image itself.)

```bash
RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo run --package zcash_tx_tool --bin zcash_tx_tool test-orchard-zsa
```
[//]: # (The default connection parameters are set to connect to the zebra-node running on the machine itself (127.0.0.1))

With optional, but recommended `--release` flag, or simply
[//]: # (If you ran the node in a docker container with the command above, you named that container "zebra-node", so you should use that as the ZCASH_NODE_ADDRESS.)

```bash
zcash_tx_tool test-orchard-zsa
```
[//]: # (If the node is running on the ECS server, you can connect to it by setting the ZCASH_NODE_ADDRESS=<Domain>.)

## Docker-based demo
[//]: # ()
[//]: # (First, make sure you created the network:)

You can also run the tests using docker. To do that you'll need first to build the docker image
[//]: # (```bash)

```bash
docker build -t zcash_tx_tool -f Dockerfile-demo .
```
[//]: # (% docker network create zcash-network)

And after that run the image itself.
The default connection parameters are set to connect to the zebra-node running on the machine itself (127.0.0.1)
If you ran the node in a docker container with the command above, you named that container "zebra-node", so you should use that as the ZCASH_NODE_ADDRESS.
If the node is running on the ECS server, you can connect to it by setting the ZCASH_NODE_ADDRESS=<Domain>.
[//]: # (```)

First, make sure you created the network:
```bash
docker network create zcash-network
```
And started the node with the network argument, like this
```bash
docker run --name zebra-node --network zcash-network -p 18232:18232 qedit/zebra-regtest-txv6
```
[//]: # (And started the node with the network argument, like this)

Here are the 3 options (No parameters will default to the first configuration)
[//]: # (```bash)

```bash
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=127.0.0.1 -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=zebra-node -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=<Domain> -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
```
The '-it' parameter was added to allow the demo to be interactive.
[//]: # (% docker run --name zebra-node --network zcash-network -p 18232:18232 qedit/zebra-regtest-txv6)

[//]: # (```)

[//]: # ()
[//]: # (Here are the 3 options &#40;No parameters will default to the first configuration&#41;)

[//]: # ()
[//]: # (```bash)

[//]: # (% docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=127.0.0.1 -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool)

[//]: # (% docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=zebra-node -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool)

[//]: # (% docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=<Domain> -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool)

[//]: # (```)

[//]: # (The '-it' parameter was added to allow the demo to be interactive.)

0 comments on commit da9d4b5

Please sign in to comment.