Quickstart
Publish on-chain with Reclaim contract on Starknet
Pre-requisite
At this stage, we assume that you are familiar with the steps at ReactJs.
For this walkthrough, you'll need a compatible wallet to interact with the frontend interface. We recommend using either Braavos or Argent X.
Setting Up Your Wallet
-
Install Braavos or Argent X: Choose and install either wallet extension from the provided links.
-
Switch to Starknet Sepolia Network:
- Braavos:
- Click on the settings icon in the top left corner.
- Navigate to the "Networks" section.
- Select "Starknet Sepolia".
- Argent X:
- Click on the settings icon in the top right corner.
- Choose "Sepolia" from the network options.
- Braavos:
-
Fund Your Wallet: Ensure your wallet is funded with ETH on the Sepolia Testnet. You can obtain testnet ETH from the Starknet Faucet.
Accessing the Code
The code for this walkthrough is available 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 Sepolia Testnet or Mainnet.
Note: in this walkthrough we will be using Sepolia Testnet, but you can always replace --network=sepolia
with --network=mainnet
Clone the Starknet contract sdk repo.
To get started, clone the Starknet SDK repository and navigate to the project directory.
Setting up your environment
To interact with Starknet and compile Cairo code, several tools need to be installed. If you already have these tools configured, you can skip to step 3.
Refer to the Starknet documentation for detailed instructions on setting up your environment. Follow these steps:
- Install Starkli.
- Set environment variables for Starkli.
- Install Scarb.
Next, set up your account by following the steps in the Starknet account setup guide:
- Create an account.
- Deploy the account.
Build the smart contract
Compile the smart contract using Scarb.
Run Tests
Run the tests to ensure everything is functioning correctly.
Declaring the smart contract
Declare the smart contract on Starknet Sepolia. Replace <NAME>
with the actual name of the compiled contract in the target/dev/
directory.
Deploy
Deploy the contract using your Starknet Sepolia account. Replace <CLASS_HASH>
with the output obtained from the previous step when declaring the smart contract. For <CONSTRUCTOR_INPUTS>
, provide the address of the account that will be the contract owner.
Add Epoch
To add an epoch, ensure you are using the account set as the owner of the contract. Replace <CONTRACT_ADDRESS>
with your actual contract address.
Note: The add_new_epoch
function accepts a list of witnesses, represented in Cairo as Array<u256>
. To send this list, you must pass the array length as the first parameter, followed by the low and high values.
For example, to add an epoch, replace the placeholders with this values:
Frontend Development
Cloning the frontend repo.
Code discovery (src/App.tsx).
We will submit the proof on chain once we get the onSuccessCallback
. Fill in your Reclaim credentials marked with //TODO
s.
Code discovery (src/verify-proof.jsx).
If you deployed your own version of the contract, you will need to update the contract address.
Submitting the proof.
- First, You will need to connect your wallet (Make sure you are on Sepolia network).
- 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 a transaction. - You can check the transaction on the explorer by clicking on
See Transaction on the Explorer
button.