Links

Onchain Sample Project

Prerequisites

  • Node.js >= 18.15.0 (Latest LTS version)
  • Yarn
  • Foundry (see how to install it here)
  • Metamask installed in your browser

Installation

In a first terminal:
# clone the repository
git clone https://github.com/sismo-core/sismo-connect-onchain-sample-project.git
cd sismo-connect-onchain-sample-project
# install frontend dependencies
yarn
# install contract dependencies with Forge
foundryup
forge install

Launch a local fork chain of Mumbai

In a new terminal:
yarn anvil

Start your local application

In a new terminal:
# this will start your Next.js app
# the frontend is available on http://localhost:3000/
# it deploys the contracts on the local blockchain
yarn dev
After this command, you will have your local application running on http://localhost:3000 and all the contracts have been deployed on your local blockchain.
Running app on http://localhost:3000
If you wish to see the frontend code, you can go to the src/pages folder. The contract code is in the contracts folder.

Be eligible for the airdrop

To be eligible for the airdrop, you will then need to add your address in the config.ts file:
// config.ts
// Replace with your address to become eligible for the airdrop
// make sure to have this address in your Vault
export const yourAddress = "0x855193BCbdbD346B423FF830b507CBf90ecCc90B";
After changing the config.ts file, you don't need to restart the app or restart anvil. Simply refresh the page on the front end and you are good to go.
Make sure to import the address you reference in the config.ts file into your Data Vault when you try out the sample project application. If it is not done when you are redirected, you can add your address by clicking on the purple "connect" button.
Import the address referenced in the config.ts file

Important note

The interaction with the fork network can become quite unstable if you stop the yarn anvil command at some point or if you have already used the sample app before.
If so:
  • keep the local anvil node running,
  • make sure to delete your activity tab for the fork network in Metamask by going to "Settings > Advanced > Clear activity tab data" when connected to the fork network.
  • relaunch the anvil node and the application
See FAQ for more information.