|
1 | 1 | # Integration: Namada |
2 | 2 |
|
3 | | -This page describes an example integration of ZAIR in Namada. You can find the latest source code hosted at [GitHub](https://github.com/eigerco/namada) (_latest commit at the time of writing: [`f3292f8`](https://github.com/eigerco/namada/commit/f3292f8d800227e922a0934f7edf232dfe907db4)_). |
| 3 | +This page describes an example integration of ZAIR in Namada. You can find the latest source code hosted at [GitHub](https://github.com/eigerco/namada) (_latest commit at the time of writing: [`53f8a9c`](https://github.com/eigerco/namada/commit/53f8a9c7059a873db7dacc18d8b4916e61272c5e)_). |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +This section walks through a minimal end-to-end workflow: building an airdrop configuration, spinning up a local Namada chain, and claiming an airdrop. |
| 8 | + |
| 9 | +### 1. Preparing a ZAIR Airdrop Configuration |
| 10 | + |
| 11 | +Generate the proving parameters and airdrop config: |
| 12 | + |
| 13 | +```bash |
| 14 | +zair setup sapling --scheme sha256 |
| 15 | +zair setup orchard --scheme sha256 |
| 16 | +zair config build --network testnet --height 3663119 |
| 17 | +``` |
| 18 | + |
| 19 | +Then create an `airdrop` directory containing all the generated artifacts: |
| 20 | + |
| 21 | +```bash |
| 22 | +mkdir airdrop |
| 23 | +mv config.json *.params *.bin airdrop/ |
| 24 | +``` |
| 25 | + |
| 26 | +The `airdrop` directory should contain the following files: |
| 27 | + |
| 28 | +| File | Description | |
| 29 | +| --------------------------- | ---------------------------- | |
| 30 | +| `config.json` | Airdrop configuration | |
| 31 | +| `setup-sapling-pk.params` | Sapling proving key | |
| 32 | +| `setup-sapling-vk.params` | Sapling verifying key | |
| 33 | +| `setup-orchard-params.bin` | Orchard proving parameters | |
| 34 | +| `snapshot-sapling.bin` | Sapling snapshot nullifiers | |
| 35 | +| `snapshot-orchard.bin` | Orchard snapshot nullifiers | |
| 36 | + |
| 37 | +See [`zair config`](../cli/config.md) and [`zair setup`](../cli/setup.md) for the full flag references. |
| 38 | + |
| 39 | +### 2. Setting Up a Local Namada Chain |
| 40 | + |
| 41 | +Compile the Namada executable: |
| 42 | + |
| 43 | +```bash |
| 44 | +make build |
| 45 | +``` |
| 46 | + |
| 47 | +Compile WASM transactions and initialize a local test chain: |
| 48 | + |
| 49 | +```bash |
| 50 | +cd wasm && make all && cd .. |
| 51 | +python3 ./scripts/gen_checksums.py |
| 52 | +python3 ./scripts/gen_localnet.py -m release |
| 53 | +``` |
| 54 | + |
| 55 | +```admonish warning |
| 56 | +If you encounter a compilation error with `nam-blst`, try building with `CC=clang` instead. |
| 57 | +``` |
| 58 | + |
| 59 | +### 3. Copying Airdrop Configuration to Chain Config |
| 60 | + |
| 61 | +Copy the generated airdrop directory into the chain's validator base directory: |
| 62 | + |
| 63 | +```bash |
| 64 | +# Note the chain ID starting with "local." from the output below |
| 65 | +ls .namada/validator-0/ |
| 66 | +``` |
| 67 | + |
| 68 | +```bash |
| 69 | +cp -r airdrop/ .namada/validator-0/<CHAIN_ID>/airdrop/ |
| 70 | +``` |
| 71 | + |
| 72 | +```admonish note |
| 73 | +This step initializes the airdrop state in genesis and must be completed before starting the chain. |
| 74 | +``` |
| 75 | + |
| 76 | +### 4. Starting the Chain |
| 77 | + |
| 78 | +Start the validator: |
| 79 | + |
| 80 | +```bash |
| 81 | +namada ledger run --base-dir .namada/validator-0 |
| 82 | +``` |
| 83 | + |
| 84 | +### 5. Claiming an Airdrop |
| 85 | + |
| 86 | +With the chain running, submit a claim transaction using the desired account address: |
| 87 | + |
| 88 | +```bash |
| 89 | +namada client claim-airdrop \ |
| 90 | + --base-dir .namada/validator-0 \ |
| 91 | + --source <ADDRESS> \ |
| 92 | + --seed-file-path <SEED_FILE> \ |
| 93 | + --birthday <BIRTHDAY> \ |
| 94 | + --gas-limit 300000 |
| 95 | +``` |
| 96 | + |
| 97 | +You can verify the claim by querying the account balance before and after: |
| 98 | + |
| 99 | +```bash |
| 100 | +namada client balance --base-dir .namada/validator-0 --owner <ADDRESS> --token NAM |
| 101 | +``` |
| 102 | + |
| 103 | +```admonish note |
| 104 | +Use `namada wallet list --base-dir .namada/validator-0` to list available account addresses. |
| 105 | +``` |
| 106 | + |
| 107 | +See [`zair claim`](../cli/claim.md) for more details on the claim pipeline. |
4 | 108 |
|
5 | 109 | ## Implementation |
6 | 110 |
|
|
0 commit comments