Quickstart for Solidity
Pre-requisite
This tutorial assumes that you have a frontend that requests proofs from the user and processes the response, like React, React Native, or Node.
Solidity
Deploy a smart contract
Deploy the following smart contract to the chain of your choice, we will be using Polygon's Mumbai for this walkthrough.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@reclaimprotocol/verifier-solidity-sdk/contracts/Reclaim.sol";
import "@reclaimprotocol/verifier-solidity-sdk/contracts/Addresses.sol";
contract Attestor {
address public reclaimAddress;
// add providersHashes for your permitted providers
string[] public providersHashes;
constructor(string[] memory _providersHashes){
providersHashes = _providersHashes;
// TODO: Replace with network you are deploying on
reclaimAddress = Addresses.PLOYGON_MUMBAI_TESTNET;
}
function verifyProof(Reclaim.Proof memory proof) public view{
Reclaim(reclaimAddress).verifyProof(proof);
// TODO: your business logic upon success
// verify proof.context is what you expect
}
}
You can check out the supported networks here (opens in a new tab)
Context Field
proof.claimInfo.context
is the field were you can add a message and an address to the proof.
In addition, context will be having provider extracted data (e.g. your SteamId if you're using SteamId Provider).
As context is a string
, we provide a function that will make it easier for you to extract fields from it:
function extractFieldFromContext(string memory data, string memory target)
public pure returns (string memory)
where data
is the context field string and target
is name of the field you want to extract.
Please note that you will need to provider target string in the following format: '"FIELD_NAME_HERE":"' (e.g. '"SteamId":"')
you can also use extractFieldFromContext
to extract contextAddress
and contextMessage
using the same mentioned way.
Get the artifacts
Once deployed, take a note of the following:
- ChainId (80001 in our case).
- Contract address.
- ABI.