Quickstart
Publish on-chain with Reclaim contract on Near
Pre-requisite
At this stage, we assume that you are familiar with the steps at ReactJs.
We will be using HereWallet and MyNearWallet as a wallet to interact with the frontend interface. Make sure that you have one of them installed and funded.
Also, you will need to have the Near CLI installed.
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 or mainnet:
- Mainnet: reclaim-protocol-mainnet.near
- Testnet: reclaim-protocol.testnet
Clone the near contract sdk repo.
This Near contract serves as a client to our Reclaim protocol. It instantiates Reclaim's contract, handles proofs, and verifies them.
Create new account or import an existing account.
Use near-cli
to create a new account or import an existing account.
Deploy.
Deploy the contract with your account and the wasm file.
Add Epoch
Send transaction to add epoch from the owner account.
Frontend Development
Features
- Proof Submission: Generate proof requests and submit them on-chain.
- Proof Verification: Verify submitted proofs directly through the smart contract.
- Wallet Connection: Built-in wallet connection.
Cloning the frontend repo.
2. Install Dependencies
Run this command:
Code discovery (src/components/create-new-proof.js).
We will submit the proof on chain once we get the onSuccessCallback
. Fill in your Reclaim credentials marked with //TODO
s.
Code discovery (src/config.js).
If you deployed your own version of the contract, you will need to update the contractPerNetwork
list with your contract's account address.
Submitting the proof.
- First, You will need to connect your near account.
- Then, After requesting a proof from Reclaim and performing the verification on your end, a verify proof button will appear on the screen.
- Finally, Clicking on the
Verify Proof
button will send transaction.
Now your proof will get approved on-chain, here is the sample transaction from the screenshot above.
Code Overview
src/components/create-new-proof.js
- Proof Request: Configures and initiates proof requests through Reclaim’s SDK.
- QR Code Generation: Displays a QR code for users to scan and submit proofs.
- Proof Submission: Handles on-chain submission upon proof verification.
src/pages/index.js
- Proof Transformation: Transforms the received proof to be compatible with the smart contract.
- Verification Process: Sends a transaction to verify the proof on-chain and provides a link to the transaction on the explorer.
Troubleshooting
- Wallet Connection Issues: Ensure that your wallet is set to the correct network that you contract is deployed on and refresh the page if the connection fails.
- Proof Submission Fails: Double-check your Reclaim credentials, contract address, and that the correct network is selected.