Testnet quickstart¶
Get a quote for selling testnet ZEC (TAZ) for test dollars (tUSD) on Ethereum Sepolia, then complete one shielded swap using the reference wallet. You can stop after the quote without creating a wallet or paying a fee. The example pays shielded tUSD to your Railgun balance. For a public tUSD payout, the API also supports an Ethereum account that pays its own Sepolia gas. Payout routes
The public mainnet API is coming soon. All commands below use test assets.
Connect to testnet¶
First identify both services. The maker offers the exchange and locks its tokens on Sepolia. The relayer submits the Ethereum claim and shielded payout your wallet authorizes.
The public gateway is https://api-testnet.veylor.cash. Use /maker for quotes and /relayer for fees and settlement. Discovery and quotes are public. Keep the wallet seed and swap state on the machine running the CLI.
For discovery and a quote, you only need Bash, curl and jq. Run these snippets in the same shell so later steps can use the values you set here.
set -euo pipefail
export ZECSWAP_MAKER_URL=https://api-testnet.veylor.cash/maker
export ZECSWAP_RELAYER_URL=https://api-testnet.veylor.cash/relayer
export EVM_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
export ZECSWAP_CONTRACT=0x62ce626c5a30528b8ee33145d491785082a6cf8a
export ZECSWAP_TOKEN=0x64c4a5cb09fe0b706d4cf24dc0a45fff275d727c
info=$(curl -fsS "$ZECSWAP_MAKER_URL/v1/info")
terms=$(curl -fsS "$ZECSWAP_RELAYER_URL/v1/terms")
jq -e --arg c "$ZECSWAP_CONTRACT" --arg t "$ZECSWAP_TOKEN" '
.apiVersion == 1 and .zcashNetwork == "testnet" and
.chainId == 11155111 and .contract == $c and .token == $t
' <<< "$info"
jq -e --arg c "$ZECSWAP_CONTRACT" '
.chainId == 11155111 and .contract == $c
' <<< "$terms"
Both checks must print true before you continue. They catch a service pointing at a different network or contract before your wallet creates a payment. The pinned addresses identify this testnet deployment. Stop on a mismatch and check for a deployment update. Sepolia swap contract · Sepolia tUSD token
Preview a quote¶
A quote tells you how much TAZ you would spend and how much tUSD is available before the relayer’s fee. Asking for one does not open an escrow. This example uses a nonzero placeholder payout address for a disposable quote. Leave that quote to expire. The CLI requests a fresh quote bound to its own payout when you run a swap.
units=1000000
quote=$(curl -fsS -H 'Content-Type: application/json' \
--data "{\"units\":$units,\"payout\":\"0x0000000000000000000000000000000000000001\"}" \
"$ZECSWAP_MAKER_URL/v1/quote")
jq '{amount, depositZat, openFeeZat: (.openFee.zat // 0), expiresAt}' <<< "$quote"
jq '{fee, feeExpiresAt}' <<< "$terms"
| Field | How to read it |
|---|---|
units |
Number of maker denominations. Read the resulting token amount from the quote. |
amount |
Gross tUSD payout as a decimal string in base units. 1,000,000 base units = 1 tUSD. |
depositZat |
Shielded TAZ required for the swap. 100,000,000 zatoshis = 1 TAZ. |
openFee.zat |
Optional, nonrefundable TAZ fee paid to the maker before opening. Budget it separately from the deposit and Zcash transaction fees. |
networkCost |
Optional cost component already reflected in the quoted price. Use depositZat as quoted. |
fee |
Relayer fee in token base units, deducted from the payout. It must be below the gross amount. |
expiresAt, feeExpiresAt |
Unix times in seconds. Refresh the quote or terms after expiry. |
Reading the numbers. If amount is "1000000" and the relayer’s fee is "100000", the amount sent to Railgun for shielding would be 900,000 base units, or 0.9 tUSD. Railgun’s shield fee may reduce the final private balance. On Zcash, budget the quoted depositZat, any separate openFee.zat, and the wallet’s transaction fees. Your live quote supplies the actual amounts.
Fund a test wallet¶
To go beyond a quote, install Git, rustup and a native C/C++ build toolchain on Linux or macOS. Build the public CLI from the revision used by this guide. init creates the wallet and prints its Zcash testnet address. Run it once per wallet.
git clone https://github.com/ChinmayGopal931/zecSwap.git
cd zecSwap
git checkout --detach 2470b7cf535185e837bfe5af5e641ea2c964a23f
cargo build --locked -p zecswap-cli
cli="$PWD/target/debug/zecswap-cli"
umask 077
export ZECSWAP_CLI_DIR="$HOME/.veylor/bridge-testnet"
"$cli" --network testnet init
Send TAZ to the printed address from another test wallet or a testnet faucet. Wait for the spendable balance to cover the quoted deposit, the open fee, and Zcash transaction fees. Valar testnet faucet
"$cli" --network testnet status
Run a shielded swap¶
Use the same wallet directory for the whole swap. The example caps the open fee at 20,000 zatoshis and the relayer fee at 100,000 token base units (0.1 tUSD). Check the fresh terms against your budget before starting. Starting this command authorizes the wallet to spend test funds. It takes a fresh quote and can pay the nonrefundable open fee immediately. The flags cap the two fees. For an integration with a hard maximum total TAZ spend or minimum net payout, check those limits on the actual quote before paying or accepting.
terms=$(curl -fsS "$ZECSWAP_RELAYER_URL/v1/terms")
jq -e --argjson amount "$(jq -r .amount <<< "$quote")" '
(.fee | tonumber) as $fee |
$fee <= 100000 and $fee < $amount and .feeExpiresAt > now
' <<< "$terms"
"$cli" --network testnet swap --units "$units" \
--relayer "$ZECSWAP_RELAYER_URL" \
--max-open-fee 20000 --max-fee 100000
After the maker opens escrow, the CLI reads the locked tokens and payout terms from Sepolia. Only then does it send the quoted TAZ deposit to the joint shielded address. Once the deposit is confirmed and the claim is allowed, the relayer submits the wallet’s authorization and shields the net tUSD payout. A successful payout prints claimed; shielded … into … with the amount sent for shielding and the destination. A cancellation or refund has its own output. A successful process exit alone does not identify which outcome occurred.
Run one swap at a time per wallet directory. If interrupted, restore the same settings and rerun the swap command with the same directory to resume an unfinished swap. Running it again after completion starts another swap. Preserve the seed, wallet database, and swap state together.