Skip to content

brevis-network/brevis-quickstart-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brevis Quickstart Typescript

This repo contains a simple end-to-end brevis application that proves the account age for a given user and handles the attested age in an app contract.

Environment Requirements

  • Go >= 1.20
  • Node.js LTS

The prover service is a standalone process that is run on a server, preferably as a systemd managed process so that it can be auto restarted if any crash happens. The prover service is designed to be used in conjunction with brevis-network/brevis-sdk-typescript.

Start Prover (for testing)

cd prover
make start

Start Prover with Systemd (in production on linux server)

You may want to have a process daemon to manage the prover services in production. The Makefile in the project root contains some convenience scripts.

To build, init systemd, and start both prover processes, run the following command. Note it requires sudo privilege because we want to use systemd commands

cd prover
make deploy

The Node.js project in ./app is a simple program that does the following things:

  1. call the Go prover with some transaction data to generate an account age proof
  2. call Brevis backend service and submit the account age proof
  3. wait until the final proof is submitted on-chain and our contract is called

How to Run

cd app
npm run start

The app contract AccountAge.sol is called after you submit proof is submitted to Brevis when Brevis' systems submit the final proof on-chain. It does the following things when handling the callback:

  1. checks the proof was associated with the correct vk hash
  2. decodes the circuit output
  3. emit a simple event

Init

cd contracts
npm install

Test

npm run test

Deploy

Rename .env.template to .env. Fill in the required env vars.

npx hardhat deploy --network sepolia --tags AccountAge

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published