1. deploy

Spin up the testing chain with

npx hardhat node

Use the hardhat testing chain as an example config.

PROVIDER=http://127.0.0.1:8545/
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
deploy.ts
import { ethers } from 'ethers'
import { deployUnirep } from '@unirep/contracts'

async function main(){
    const provider = await ethers.getDefaultProvider(PROVIDER)
    const signer = new ethers.Wallet(
        PRIVATE_KEY,
        provider
    )
    const contract = await deployUnirep(
        signer
    )
    console.log("Unirep address: ", contract.address)
}

main();

Now the verifiers are fixed in @unirep/contracts so it can be deployed with deployUnirep function. To make verifiers more flexible, it it recommended to download Unirep repository and deploy verifiers before deploying Unirep.sol.

Last updated