GithubHelp home page GithubHelp logo

luandt / brevis-quickstart-ts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brevis-network/brevis-quickstart-ts

0.0 0.0 0.0 155 KB

License: MIT License

Go 14.66% TypeScript 34.32% Makefile 1.97% Solidity 49.05%

brevis-quickstart-ts's Introduction

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 [TransactionHash]

Example

npm run start 0x6dc75e61220cc775aafa17796c20e49ac08030020fce710e3e546aa4e003454c

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

brevis-quickstart-ts's People

Contributors

patrickmao93 avatar andrewleechch 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.