dnalob / zapa-yoink

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zapa

Zapa is Zero-Knowledge Anonymous Payments on Avalanche -- a privacy coin built and deployed as an Avalanche Subnet. Zapa integrates the shielded payments technology of Zcash with the Avalanche consensus mechanism in order to offer a lightning fast privacy coin fully operated on Proof of Stake.

Status

  • Locally working end to end with ava-sim
  • Testnet deployed
  • Mainnet deployed

Fuji Testnet Deployment Information

Subnet ID: 2ma1j6rSYPykvTDk6JeHKGgXQzqtWbwrsEzUethnTf8k7DMSEb

VM ID: tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH

Active Blockchain ID: 6Jdeqk1VMB3qXhse3C3YnuoZPnaNAqGJJucyRSkXmpiekrEto

Disabled Blockchain IDs: ydwMTPrYBWHrGVmWfG8k4Po2eTPEqe7y7Z4jZaUr2Me6rin7, 2LedqoeDb3zZQSqPBczemzrofepr6SzSHXxHXANrfzeFKGGNVd

Setup

After cloning, fetch submodules:

git submodule update --init --recursive

Throughout this project there are optional directives for debugging in VS Code. Contained in this repo is a pre-configured VS Code workspace. To open this project in VS Code, open VS Code and select "Open Workspace from file", then select zapa.code-workspace from this repo's main directory.

Project Overview

Zapa Diagram

This image depicts the three main components of Zapa and how they work together to facilitate an anonymous transaction on the blockchain. Each of those three components are also submodules of this repository:

  • avalanchego -- Node implementation of the Avalanche network.
  • zapavm -- Go plugin which acts as a thin bridge between avalanchego and zcashd.
  • zcash -- A daemon for generating and validating anonymous transactions.

The fourth submodule (not depicted above) is ava-sim which is a utility for spinning up a local network for testing.

Tokenomics

See Tokenomics for details on how the ZAPA token works, incentives, fees, and reward structure.

Local Setup

The best way to develop, test, and debug is to setup a local five-node network using ava-sim. The steps required are:

  1. Run five versions of zcashd, each exposing a different port to talk to a unique zapavm node in the local network.
  2. Run ava-sim with the zapavm plugin as an argument.
  3. Interact with the local nodes to send transactions, query balances, and mine blocks.

Step 1: Running zcashd

Checking out the zcash submodule and follow the steps outlined in Running zcashd: A 5 Node Local Setup.

Step 2: Running ava-sim with zapavm plugin

Follow the steps linked here to run ava-sim with the zapavm plugin.

Step 3: Interact with Local Nodes

See Interacting with the Chain for instructions on how to interact with the local nodes.

Running a Validator

To validate the Zapa chain and start earning ZAPA on the fuji network:

  1. Run a zcash node
  2. Launch the zapavm plugin ontop of an existing avalanchego fuji deployment.

Step 1: Run zcashd

All of these steps require checking out the zcash submodule and taking action to build or run resources in that project.

Step 2: Launch the zapavm plugin

  • Ensure you have an avalanchego node pointed at the Fuji network. See Avalanche Docs
  • Either follow instructions to build zapavm from source or use a pre-existing build. If using a pre-existing build, no action is required on this step.
  • Move the plugin binary to your plugins directory, usually found at build/plugins/ relative to your avalanchego program. For example, if you're running your node on ubuntu, the command is likely (for OSX just replace zapavm-ubuntu with zapavm-osx:
cp zapavm/builds/zapavm-ubuntu ~/avalanche-node/plugins/zapavm
  • Update your node configuration to whitelist the subnet specified above.
  • Alias the vm. Create a vm/aliases.json configuration to alias this VM so that Avalanche knows which vm-id this binary belongs to. Assuming your existing aliases file is empty, you can use this command:
echo {\"tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH\":[\"zapavm\"]} > ~/.avalanchego/configs/vms/aliases.json
  • Restart avalanchego
  • When the node has finished bootstrapping, you should see logs indicating this in the chain log.

Step 3: Interact with the chain

Inspiration for Interacting with the Chain

In case you're looking for inspiraton, here's a sequence of calls you can make to earn and transact ZAPA:

  1. Call MineBlock to ask your node to produce a block.
  2. Call NodeBlockCounts to verify that your node has indeed produced a block. If your node has successfully produced a block, you should also have some coinbase rewards. If not, return to step 1. Sometimes this takes a few tries.
  3. Call ListSpent to see your balances.
  4. Then, try sending some funds around...privately, of course. Call z_getnewaddress to get a shielded address.
  5. Then call SubmitTx in order to send some ZAPA from one of your unspent addresses to this new shielded address.
  6. You can then verify the coinas got there by calling z_getbalance.
  7. Once you've verified that you can shield funds, try then sending ZAPA to someone else's z-address. Any transactions between z-addresses are 100% private.

About