Publish on-chain with Reclaim contract on Aleph Zero
Pre-requisite
At this stage, we assume that you are familiar with the steps at ReactJs.
We will be using Polkadot.js extension (opens in a new tab) as a wallet to interact with the frontend interface. Make sure that you have one of them installed and funded.
You can access the code of this walkthrough on Gitlab:
Contract Deployment
If you don't need to add more checks and logic to on-chain contract, You can skip those steps and use our already deployed contract on the testnet (opens in a new tab).
Clone the Reclaim Aleph Contract repo.
This Ink! contract (opens in a new tab) serves as a client to our Reclaim protocol. It instantiates Reclaim's contract, handles proofs, and verifies them.
- You can add more checks and logic to your on-chain contract.
- Build Command will bundle your contract into a
.contract
file.
git clone https://gitlab.reclaimprotocol.org/integrations/onchain/ink-sdk.git
cd reclaim-aleph-client
cargo contract build --release
Deploy.
Deploy the contract with your account and the <contract_name>.contract
file through Contract UI (opens in a new tab).
Add Epoch
Send transaction to add epoch from the owner account through Contract UI (opens in a new tab).
- Please use the following args:
minimum_witness_for_claim_creation
- 1witnesses
-[{"address": "0x244897572368eadf65bfbc5aec98d8e5443a9072", "host": "reclaim.testnet"}]
Frontend Development
Cloning the frontend repo.
git clone https://gitlab.reclaimprotocol.org/starterpacks/reclaim-aleph-example
cd reclaim-aleph-example
npm install
Code discovery(GenerateProofPage.tsx).
We will save the proof in the state once we get the onSuccessCallback
. Fill in your Reclaim credentials marked with //TODO
s.
- After saving the proof, you can navigate to
VerifyProof
page to verify it.
Code discovery (src/metadata).
If you deployed your own version of the contract, you will need to update the addresses.json
file with your contract's account address.
Also, Update reclaim.json
with your deployed contract json ABI.
Code discovery (src/utils/verifyProof.ts).
If you deployed your own version of the contract and added more args to the verify_proof
function or you need to call a different function,
you will need to update this file with your modification.
Submitting the proof.
npm start
- First, You will need to connect your wallet.
- Then, After requesting a proof from Reclaim and performing the verification on your end, you would need to navigate to
Verify Proof
Page Where verify proof button will appear on the screen and be enabled. - Finally, Clicking on the
Verify Proof
button will send transaction.