✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.

Gear
Vara

Publish on chain using gear-js

Pre-requisite

You can access the code of this walkthrough on Gitlab:

These two repos hold all configurations and metadata required to publish a Reclaim proof to Vara network.

Contract and JS interactions

Clone the client contract repo.

git clone https://gitlab.reclaimprotocol.org/integrations/onchain/gear-sdk
cd reclaim-gear
cargo b --workspace

Add your wallet information.

As stated in the README, add your wallet credentials to your js/.env as specified in js/.env.example.

MNEMONIC= // Your mnemonic

Deploy contract.

Follow steps at Gear Wiki (opens in a new tab) to set up a wallet, generate artifiacts, and deploy through IDEA. Upon deployment, add your contract address to your js/.env.

ADDRESS= // Your contract address

Verify a proof.

Give the js/index.js file a quick read, make sure that you have the correct RPCs and contract addresses.

There are three functions of interest here:

  • initiate: Pings the contract to bootstrap an initial state.

  • addEpoch: Adds witnesses for epochs.

  • verifyProof: Verifies a proof.

Run the script with npm run start. You may comment and un-comment depending on your purpose, but note that functions should be called in the order stated above.

Here is a sample proof verification transaction (opens in a new tab).

React client development

Cloning the frontend repo.

git clone https://gitlab.reclaimprotocol.org/starterpacks/reclaim-gear-example.git
 
cd reclaim-gear-example
 
npm install

Code discovery.

In your App.js, make sure you have your Reclaim credentials ready for placeholders marked with //TODOs. Proof submission to Vara happens in VerifyProof component.

Submitting the proof.

npm run build
 
npm run start

After requesting a proof from Reclaim and performing the verification on your end, a verify proof button will appear on the screen. Make sure your polkadot.js is connected, click the button, a wallet pop-up will show prompting you to submit.