Skip to content

Guide · Open source

How to use sismo-badges: install and build the Sismo contracts

Updated · written with AI from the project's own documentation and checked against our catalogue data

sismo-badges is the open-source repository containing the Ethereum smart contracts of the Sismo Protocol, published under the MIT licence and written in TypeScript tooling around Solidity contracts. This guide shows you how to clone it, install dependencies, compile and test the contracts, and understand how the registry, attesters and Badges contract fit together. It is aimed at developers and engineers, not end users, since the repository contains contracts rather than a finished app.

Sismosismo-core/sismo-badges · ★ 15.9k · MIT

Quick start

  1. 1Check prerequisites. Make sure Git, Node.js and Yarn are installed on your machine.
  2. 2Clone the repository. Clone sismo-core/sismo-badges from GitHub and open the project folder.
  3. 3Install dependencies. Run yarn in the project folder to install the packages.
  4. 4Compile the contracts. Run yarn compile to compile the contracts with Hardhat.
  5. 5Run the tests. Run yarn test to launch all tests and confirm the build works.
  6. 6Read the example attester. Open attesters/hydra-s1/HydraS1SimpleAttester.sol to see how an attester implements the required functions.

What sismo-badges contains

The repository holds three core contracts. The registry, core/AttestationsRegistry.sol, stores all attestations and is owned by a governance that authorizes or unauthorizes issuers to record in it. The standard abstract contract core/Attester.sol must be inherited by attesters, which verify user requests and build the attestations to record. The core/Badges.sol contract reads the registry and presents attestations as stateless, non-transferable ERC1155 tokens.

  • core/AttestationsRegistry.sol: stores all attestations
  • core/Attester.sol: abstract contract that attesters inherit
  • core/Badges.sol: non-transferable ERC1155 view of attestations
  • attesters/: example attester implementations

Install prerequisites: Git, Node.js and Yarn

You need Git to clone the repository, Node.js, and Yarn to install dependencies and run the scripts. The source lists these three tools as the prerequisites for the clone-and-build method. It does not specify required version numbers, so check the project's own files for those.

Install dependencies, compile and run tests

After cloning the repository and changing into its folder, install dependencies with Yarn. Then compile the contracts with Hardhat and run the test suite. These are the commands the README lists for the Usage section.

  • Install dependencies: run yarn
  • Compile contracts with Hardhat: yarn compile
  • Run all tests: yarn test
  • Print the storage layout: yarn storage-layout
yarn yarn compile yarn test

Deploy the contracts to a local chain

The README describes a local deployment flow that uses two terminal tabs. Start a local chain in the first tab, then run the local deploy script in the second. Keep both running while you work against the local network.

  • Terminal tab 1: start the local chain with yarn chain
  • Terminal tab 2: deploy with yarn deploy:local
yarn chain yarn deploy:local

Write a new attester

To create a new attester, inherit the core/Attester.sol abstract contract and implement the two required functions: _verifyRequest(request, proofData), which checks the user's request against the proof they supply, and buildAttestations(request, proofData), which builds the attestations to record from a verified request. Two optional hooks, _beforeRecordAttestations and _afterRecordAttestations, are also available.

The README points to attesters/hydra-s1/HydraS1SimpleAttester.sol as a worked example. The source also mentions a documentation guide for attesters and invites pull requests with new attesters.

  • Required: _verifyRequest(request, proofData)
  • Required: buildAttestations(request, proofData)
  • Optional: _beforeRecordAttestations(request, proofData)
  • Optional: _afterRecordAttestations(request, proofData)

What people use it for

  • Auditing the registry, attester and Badges contracts before relying on Sismo attestations
  • Writing a new attester that inherits core/Attester.sol and verifies its own proof type
  • Studying how zero-knowledge proof based attestations are recorded on-chain
  • Running the contracts on a local chain to test attester logic

Frequently asked questions

Is sismo-badges a finished app I can use as a user?

No. The README describes the repository as a set of smart contracts for the Sismo Protocol, not an application with a user interface for end users. It is aimed at developers working with the contracts.

What do I need to install sismo-badges?

The source lists Git, Node.js and Yarn as prerequisites. You clone the repository, run yarn to install dependencies, then run yarn compile and yarn test.

What license is sismo-badges under?

The repository is distributed under the MIT License, as stated in the README's License section.

How do I write a new Sismo attester?

Inherit the core/Attester.sol abstract contract and implement _verifyRequest and buildAttestations. The README points to attesters/hydra-s1/HydraS1SimpleAttester.sol as an example.

Where can I find the deployed contract addresses?

The README links to the deployed contract addresses page in the Sismo documentation at docs.sismo.io. The repository itself is for building and testing.

Is the project still actively maintained?

The last push date shown is 2023-10-03, so check the repository activity yourself before depending on it for new work.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

sismo-badges suits developers building or auditing Ethereum contracts for the Sismo attestation system, or engineers who want to write a new attester. It is a poor fit for anyone wanting a finished end-user app or who lacks Solidity and Ethereum experience, and the last push date of 2023-10-03 means you should verify current activity first.

Install options & downloads