Skip to content

circlefin/verite

Repository files navigation

Verite

Decentralized Identity for Crypto Finance.

This repository is a monorepo containing the Core Verite Javascript SDK, documentation, as well as several demos to illustrate issuance, verification, revocation, and real-world use-cases of the Verite standard.

Getting Started

Requirements

  • Node.js v14
  • npm v7 or greater (npm i -g npm@7)

Project Structure

This repository is set up as an npm workspace (which requires npm v7 or greater). The dependencies for all packages are installed from the root level using npm install.

Each package in this repository lives in the packages/ directory.

The primary packages in this repository are:

  • docs - Documentation for the Verite
  • verite - The core Javascript SDK for issuing, verifying, and revoking Verifiable Credentials.
  • contract - Two sample ERC20 contracts showcasing how to implement Verite into a smart contract.
  • solana - A sample Solana program demonstrating how to implement Verite into a program.
  • e2e-demo - A demo walkthrough of the entire Verite project, showcasing issuance, verification, and revocation, with additional demos for DeFi and custodial use cases.
  • wallet - A demo wallet for storing and submitting credentials. Written in React Native using Expo.

In addition to the packages above, there are 3 single-purpose demo packages, largely extracted from the e2e-demo package to help clarify each major function of Verite credentials.

Each package contains a README file with specific details about how to use the package.

Development Environment Setup

Setting up a new development environment is accomplished by running the following script:

npm run setup

This script will do the following:

  • Install all dependencies
  • Build the verite project
  • Set up the local IP hostname for e2e-demo to be used with the wallet.
  • Generate an auth JWT secret for e2e-demo
  • Generate issuer and verifier DIDs and secrets for e2e-demo
  • Build and migrate the database for e2e-demo

Running the end-to-end Demo

When first starting, you will likely be most interested in the ./packages/e2e-demo package. This package contains several demos and integrates deeply with verite.

This package contains several isolated demos. One of the demos showcases an Ethereum dApp integration, and requires running a local Ethereum node.

Running a local Ethereum node

Running an Ethereum node is easily accomplished by using our built-in scripts for running a HardHat node.

  1. To start a local Ethereum node, simply run:
npm run hardhat:node

Now you have a local Ethereum node running. This process is long-lived and should remain open in it's own terminal tab.

  1. Next, you will need to deploy the smart contracts to the local Ethereum network.
npm run hardhat:deploy

And finally, you can run the local demos:

npm run dev

This will start your server at http://localhost:3000

Running the wallet

To run the wallet, you will need the Expo Go app on your phone.

  1. Start the wallet:

    npm run wallet
  2. Scan the QR code with your phone.

On iOS, scan the QR code with your phone's camera. On Android, scan the QR code from within the Expo Go app.

Manually running services

Each packages in the ./packages folder has instructions on how to get started independently of other packages. To run a service on it's own, follow the instructions in the package's README.md file.

NOTE It is recommended that you run npm run clean before manually running a service.

Developing

To run type-checking, linting, and tests, simply run:

npm run check

Testing

Run tests by running

npm run test

NOTE Be sure to have built the verite package by running npm run build:verite.

Linting the codebase

npm run lint

or, with autofix:

npm run lint -- --fix

Run a type check

npm run type-check --workspaces --if-present

Fixing with Prettier

This app uses Prettier to format the code, and you can auto-format all files with

npm run format

Troubleshooting

Nonce too high

Occasionally, the local hardhat ethereum node and MetaMask become out of sync. If you see an error stating "Nonce too high", you can fix this by:

  1. Open MetaMask settings
  2. Click "Advanced"
  3. Click "Reset Account"

Contributors