Skip to content
commitwtfPublic

Repository files navigation

Commit Protocol

Getting Started

npm run dev

# Open App
open localhost:3000

# Open Indexer Playground
open http://localhost:42069

Deploy contracts locally

npm run deploy

# Transfer ETH to address
npm run contracts:contracts:faucet -- <wallet address>

SDK Documentation


Commit Protocol is an accountability protocol designed to incentivize participants to join and commit to various activities such as showing up at events, fitness challenges, product milestones, and more.

The protocol is built to create accountability by enabling participants to commit to specific goals and receive rewards upon successful completion. It is trustless and permissionless, meaning anyone can create, join, and interact with commitments without needing authorization from a central authority.

Commits are created as ERC721 contracts and participants receive an NFT when they join.

When participants join they transfer a configured amount of tokens, the stake. These stakes become the rewards that are distributed to the participants who have been verified.

Verifying Participants

Commit Protocol leverages Verifier Contracts to authenticate and validate participants on-chain. These verifier contracts are external smart contracts that the Commit contract calls to check if participants meet the required conditions (e.g., holding a token, attestation, or valid signature).

How Verification Works:

  • When participants fulfill the commitment (e.g., complete a fitness goal or attend an event), an attestation or token is issued to their wallet by an external service.
  • The participant then triggers the commit.verify() function on the Commit contract.
  • The Commit contract queries the associated Verifier contract, passing the participant’s address and any necessary data.
  • The Verifier contract checks if the participant holds the required attestation, token, or signature.
  • If the verification passes, the participant becomes eligible to claim rewards.

Available Verifiers

  1. EASVerifier (Ethereum Attestation Service)

    • Verification: Participants must hold an EAS attestation with a specific schemaUID and attester address.
    • Example Use Case: Participants receive attestations from Event Organizer, a DAO, or another trusted source.
  2. SignatureVerifier

    • Verification: Participants provide a backend-issued signature proving attendance or task completion.
    • Example Use Case: Event participants scan a QR code, and the backend issues a signature confirming their presence.
  3. TokenVerifier

    • Verification: Participants must hold at least x amount of a specified ERC20 or ERC721 token.
    • Example Use Case: Only holders of a DAO governance token or NFT can join a private commit.

External Services and Verification

Commit Protocol is designed to integrate seamlessly with external services (such as event apps or backend servers). These services are responsible for issuing attestations, signatures, or tokens that participants use to verify their commitment.

  • External Services Create Proofs:
    • Attestations, tokens, or signatures are issued outside the Commit contract.
  • Commit Contract Performs On-Chain Verification:
    • The commit.verify() function checks the participant’s wallet state by calling the Verifier contract on-chain.

Security Benefits of On-Chain Verifiers:

  • Trustless Verification: Commit contracts verify directly with Verifier contracts – no manual review is needed.
  • Immutable Records: Verification results are stored on-chain, preventing tampering or disputes.
  • Interoperable: Verifier contracts can be updated or swapped, allowing CommitProtocol to adapt to new verification methods.

Claiming Rewards

Verified participants are able to claim their reward which is calculated as: (stakes + funding - fees) / verifiedCount

Funder Incentives

Anyone can fund existing Commits to boost participant rewards.

  • Sponsors/Supporters: Increase participant motivation by funding the reward pool.
  • Grant Programs: DAOs and foundations can fund public goods or fitness challenges.
  • Speculation on Outcomes: Funders can back certain Commit pools if they believe in higher verification rates, indirectly influencing outcomes.

Contracts

Building Custom Verifiers

You can easily build your own Verifier contracts to customize how participants are eligible for rewards.

contract CustomVerifier is IVerifier {
  function verify(
    address participant,
    bytes calldata data, // Initialized verifierData
    bytes calldata userdata // User-provided data from frontend (i.e. signature)
  ) external view returns (bool) {
    // TODO: Implement logic
    return true;
  }
}
// Initialize the SDK and extend with your custom verifier (see @commit/sdk/verifiers.index.ts for more details)
const commitClient = new CommitSDK({ chainId, walletClient }).extend({
  verifiers: {
    CustomVerifier: {
      name: "CustomVerifier",
      description: "Testing a custom Verifier",
      contracts: {
        [base.id]: "0xVerifierAddress
      },
      data: (data) => "0x", // Encode verifierData
      userdata: (data) => "0x", // Encode userdata
      decode: (data: Hex) => null // Decode verifierData
    },
  },
});

Releases

Packages

Contributors

Languages