GithubHelp home page GithubHelp logo

satosato23 / world-id-onchain-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from worldcoin/world-id-onchain-template

1.0 0.0 0.0 590 KB

Template repository for a World ID

Home Page: https://docs.worldcoin.org

JavaScript 9.87% TypeScript 39.53% CSS 5.83% Solidity 44.77%

world-id-onchain-template's Introduction

World ID On-Chain Template

Template repository for a World ID On-Chain Integration.

Local Development

Prerequisites

Create a staging on-chain app in the Worldcoin Developer Portal.

Ensure you have installed Foundry, NodeJS, and pnpm.

Local Testnet Setup

Start a local node forked from Optimism Sepolia, replacing $YOUR_API_KEY with your Alchemy API key:

# leave this running in the background
anvil -f https://opt-sepolia.g.alchemy.com/v2/$YOUR_API_KEY

In another shell, deploy the contract, replacing $WORLD_ID_ROUTER with the World ID Router address for your selected chain, $NEXT_PUBLIC_APP_ID with the app ID as configured in the Worldcoin Developer Portal, and $NEXT_PUBLIC_ACTION with the action ID as configured in the Worldcoin Developer Portal:

cd contracts
forge create --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 src/Contract.sol:Contract --constructor-args $WORLD_ID_ROUTER $NEXT_PUBLIC_APP_ID $NEXT_PUBLIC_ACTION

Note the Deployed to: address from the output.

Local Web Setup

In a new shell, install project dependencies:

pnpm i

Set up your environment variables in the .env file. You will need to set the following variables:

  • NEXT_PUBLIC_APP_ID: The app ID as configured in the Worldcoin Developer Portal.
  • NEXT_PUBLIC_ACTION: The action ID as configured in the Worldcoin Developer Portal.
  • NEXT_PUBLIC_WALLETCONNECT_ID: Your WalletConnect ID.
  • NEXT_PUBLIC_CONTRACT_ADDRESS: The address of the contract deployed in the previous step.

Start the development server:

pnpm dev

The Contract ABI will be automatically re-generated and saved to src/abi/ContractAbi.json on each run of pnpm dev.

Iterating

After making changes to the contract, you should:

  • re-run the forge create command from above
  • replace the NEXT_PUBLIC_CONTRACT_ADDRESS environment variable with the new contract address
  • if your contract ABI has changed, restart the local web server

Testing

You'll need to import the private keys on the local testnet into your wallet used for local development. The default development seed phrase is test test test test test test test test test test test junk.

Caution

This is only for local development. Do not use this seed phrase on mainnet or any public testnet.

When connecting your wallet to the local development environment, you will be prompted to add the network to your wallet.

Use the Worldcoin Simulator in place of World App to scan the IDKit QR codes and generate the zero-knowledge proofs.

world-id-onchain-template's People

Contributors

m1guelpf avatar 0xpenryn avatar atlantis-for-worldcoin[bot] avatar

Stargazers

MW avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.