Skip to main content

Smart Contracts

Privado ID Smart Contracts - Github

As part of our unified address methodology, we deployed contracts via the CREATE2 EVM opcode. This method ensures that the final address of the contract depends on the contract's initialization bytecode and a salt. To support deployments across various networks, we utilized CreateX contract factories. Specifically, the deployCreate2 method was used to handle the deployments.

Networks

We have deployed contracts across the following mainnets and testnets so far:

Mainnets:

Testnets:

Unified contract addresses

*EXCEPTIONS

It’s important to note that the State contract addresses for the following two networks are exceptions. These contracts were already deployed at these addresses, and they are not being redeployed because they contain a significant amount of historically collected data. Redeploying them to a unified address would result in data loss, which we aim to avoid:

Smart Contract TypeUnified Address
STATE* 0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896
VALIDATOR_MTP_V20x27bDFFCeC5478a648f89764E22fE415486A42Ede
VALIDATOR_SIG_V20x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b
VALIDATOR_V30xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336
UNIVERSAL_VERIFIER0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c
IDENTITY_TREE_STORE0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81
info

State Contracts are used for publishing data on the blockchain in scenarios such as issuing MTP-type credentials, generating on-chain proofs, enforcing credential revocations, and providing a timestamping service for tracking expirations during on-chain proof verifications. Check the contract codebase and algorithms of work docs, repository.

Stateless Contract Libraries

We have released a set of reusable stateless contracts, deployed to unified addresses, that can be integrated into any contract. These can be used for standalone deployments of contracts from the ecosystem.

  • SMT_LIB: 0x682364078e26C1626abD2B95109D2019E241F0F6
  • POSEIDON_1: 0xC72D76D7271924a2AD54a19D216640FeA3d138d9
  • POSEIDON_2: 0x72F721D9D5f91353B505207C63B56cF3d9447edB
  • POSEIDON_3: 0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240
  • POSEIDON_4: 0x0695cF2c6dfc438a4E40508741888198A6ccacC2

These libraries can be leveraged for various purposes, such as building custom verifiers, state management, or identity trees, allowing for flexible integration into other projects. By using these pre-deployed contracts, developers can significantly reduce the gas costs typically incurred during deployment.

info

More about v3 circuit.

Check the examples of deployment for v3 validator

CredentialAtomicQuerySigValidator

CredentialAtomicQuerySigValidator.sol - Github

The CredentialAtomicQuerySigValidator contract is used to verify any credential-related zk proof generated by user using the credentialAtomicQuerySigV2OnChain circuit. The contract only verifies proofs based on credential of type Signature

The core of the contract is its verify function that takes the proof generated by a user and executes a set of verifications:

  • Verifies that the proof is valid. This verification is actually performed inside the Groth16VerifierSig contract which is automatically generated using circomlibjs library.
  • Verifies that the input used to generate the proof matches the query associated to that specific Request.
  • Verifies that the user's and the Issuer's identity states are valid based on the State Contract.

The CredentialAtomicQuerySigValidator executes the same set of verifications of the Verification Library. The former is required when performing on-chain verification while the latter is required for off-chain verification.

CredentialAtomicQueryMTPValidator

CredentialAtomicQueryMTPValidator.sol - Github

Performs the same set of verifications of the CredentialAtomicQuerySigValidator but for credential of type MTP.

Further protocol related contracts can be found at Iden3 - Smart Contracts