Reclaim Verifier on top of XION network.
Chain Name | Deployed Address | Explorer Link |
---|---|---|
xion-testnet-2 | xion1zcphm9wllvmtlhclvwh8qrlcx46p5mwe4yfdve0c95xfh6arsejspq5nvd | https://explorer.burnt.com/xion-testnet-2/account/xion1zcphm9wllvmtlhclvwh8qrlcx46p5mwe4yfdve0c95xfh6arsejspq5nvd |
Before deploying the contract, ensure you have the following:
-
XION Daemon (
xiond
)
Follow the official guide to installxiond
:
Interact with XION Chain: Setup XION Daemon -
Docker
Install and run Docker, as it is required to compile the contract.
git clone https://github.com/reclaimprotocol/xion-sdk-onchain-integration.git
cd xion-sdk-onchain-integration
Run the following command to compile and optimize the contract:
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/optimizer:0.16.0
Note:
This step uses CosmWasm's Optimizing Compiler, which reduces the contract's binary size, making it more efficient for deployment.
Learn more here.
The optimized contract will be stored as:
/artifacts/reclaim_xion.wasm
First, set your wallet name:
WALLET="your-wallet-name-here"
Now, upload the contract to the blockchain:
RES=$(xiond tx wasm store ./artifacts/reclaim_xion.wasm \
--chain-id xion-testnet-2 \
--gas-adjustment 1.3 \
--gas-prices 0.001uxion \
--gas auto \
-y --output json \
--node https://rpc.xion-testnet-2.burnt.com:443 \
--from $WALLET)
After running the command, extract the transaction hash:
echo $RES
Example output:
{
"height": "0",
"txhash": "B557242F3BBF2E68D228EBF6A792C3C617C8C8C984440405A578FBBB8A385035",
...
}
Copy the transaction hash for the next step.
Set your transaction hash:
TXHASH="your-txhash-here"
Query the blockchain to get the Code ID:
CODE_ID=$(xiond query tx $TXHASH \
--node https://rpc.xion-testnet-1.burnt.com:443 \
--output json | jq -r '.events[-1].attributes[1].value')
Now, display the retrieved Code ID:
echo $CODE_ID
Example output:
1248
Set the contract's initialization message (replace with your own):
MSG='{"owner":"xion138lsa3mczwzl9j7flytg0f5r6pldaa8htddq0j"}'
Instantiate the contract with the Code ID from the previous step:
xiond tx wasm instantiate $CODE_ID "$MSG" \
--from $WALLET \
--label "reclaim_xion" \
--gas-prices 0.025uxion \
--gas auto \
--gas-adjustment 1.3 \
-y --no-admin \
--chain-id xion-testnet-1 \
--node https://rpc.xion-testnet-1.burnt.com:443
Example output:
gas estimate: 217976
code: 0
txhash: 09D48FE11BE8D8BD4FCE11D236D80D180E7ED7707186B1659F5BADC4EC116F30
Copy the new transaction hash for the next step.
Set the new transaction hash:
TXHASH="your-txhash-here"
Query the blockchain to get the contract address:
CONTRACT=$(xiond query tx $TXHASH \
--node https://rpc.xion-testnet-1.burnt.com:443 \
--output json | jq -r '.events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
Display the contract address:
echo $CONTRACT
Example output:
xion1zcphm9wllvmtlhclvwh8qrlcx46p5mwe4yfdve0c95xfh6arsejspq5nvd
Change directory to the /node
directory and install packages:
cd node
npm install
Then add your credentials to your .env
:
XION_MNEMONIC="your wallet mnemonic phrase here"
XION_RPC_URL=https://rpc.xion-testnet-2.burnt.com
XION_CHAIN_ID=xion-testnet-2
CONTRACT_ADDRESS=xion1zcphm9wllvmtlhclvwh8qrlcx46p5mwe4yfdve0c95xfh6arsejspq5nvd
While in /node
, run the command:
node add-epoch.js
This will add an Epoch, here is an example tx.
You can fetch an added Epoch with:
node get-epoch.js
While in the same directory, run the command:
node verify_proof.js
This will add an Epoch, here is an example tx.
You can try Reclaim's ZkFetch tool as well for generating proofs:
node zkfetch.js