Skip to content

Commit

Permalink
Merge pull request #5 from 0xPolygonID/move-docs-issuer
Browse files Browse the repository at this point in the history
Includes Issuer files
  • Loading branch information
cerberushades authored Aug 14, 2023
2 parents eb7f666 + 19430cc commit 2786341
Show file tree
Hide file tree
Showing 30 changed files with 3,663 additions and 211 deletions.
33 changes: 33 additions & 0 deletions docs/contracts/credential-linkage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
id: credential-linkage
title: Credential Linkage
sidebar_label: Credential Linkage
description: Description of the relationships between credentials and issuers.
keywords:
- docs
- polygon id
- anchoring
- credential
- linkage
---

There are 2 types of relationships between credentials and their issuers:

- Issuer DID anchoring: as an issuer of credentials, issuers can choose to just leave their identifier in the genesis state. However, it is recommended that they publish their issuer DID on-chain for visibility and traceability purposes. This is done by calling the “Transit State function” so that the issuer can register their identity state and identifier in the identity `StateV2.sol` contract. At this point, we can consider that the **Issuer DID is anchored**.

- Credential Linkage: after the issuer’s DID is anchored to the blockchain, then the issuer can generate credentials with its identifier and signature (using either the BJJ or MTP, see [credential issuance methods](../issuer/cred-issue-methods.md) for more). At this point, we can consider that the credential has a linkage to the blockchain in which the issuer registered its DID.

![img](/img/anchoring-linkage.png)

!!!note
If the credential is issued using the MTP method, then the credential data is also “anchored” (via an indirect merkle tree proof) to the blockchain. Otherwise, only the Issuer’s DID is anchored to the blockchain.


## Credential Linkage to Different Blockchains

Credentials could be linked to different Ethereum Virtual Machine (EVM) blockchains, they are not limited to only being linked to the Polygon Mainnet when they are issued. For instance, credentials could be linked to a Supernets chain or another EVM chain. The issuer state contract could be deployed to other EVM-compatible chains, and verifiers could validate the proofs from these credentials as long as they have access to the particular chain.

!!!note
Credential linkage is only supported for a single chain for each credential (a credential cannot be linked to multiple blockchains at the same time).

![img](/img/linkage-multiple.png)
66 changes: 66 additions & 0 deletions docs/contracts/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Smart Contracts

<a href="https://github.com/0xPolygonID/contracts" target="_blank">**Polygon ID Smart Contracts - Github**</a>

## Blockchain addresses

For situations where one needs to publish data on the blockchain, such as creating a mtp-type credential, generating on-chain proofs and make credential revocations effective, it is important to have the Smart Contracts addresses:

- Testnet(mumbai) -> `0x134B1BE34911E39A8397ec6289782989729807a4`
- Mainnet -> `0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D`

## Validator addresses
Current addresses on Polygon Mumbai testnet.

| | Sig | MTP |
|:------------------:|:------------------------------------------:|:-----------------------------------------:|
| **Validators** |0xF2D4Eeb4d455fb673104902282Ce68B9ce4Ac450 |0x3DcAe4c8d94359D31e4C89D7F2b944859408C618 |
| **ERC20 examples** |0x9017a99afb69CB7B21C7DD29827b4762DECD53FD |0x3Bf7f4774DC3f92431fA690fa000f636562dCC18 |


Current addresses on Polygon Main. (ERC20 example with airdrop use case, restricted to 1 request).

| | Sig | MTP |
|:------------------:|:------------------------------------------:|:-----------------------------------------:|
| **Verifier** |0x6f6E19781600d6B06D64A6b86431FB7dB3E919e0 |0x9DB901F3AFdAAA73F5B2123B186F566fA3Ed1551 |
| **Validators** |0x9ee6a2682Caa2E0AC99dA46afb88Ad7e6A58Cd1b |0x5f24dD9FbEa358B9dD96daA281e82160fdefD3CD |
| **ERC20 examples** |0x8732e29eE329fD19Ff868a3Df3D5F6A3116027A2 |0x5c31BB88AA57C69FF537C5d86102246D61712C90 |


ERC20 examples with airdrop use case, not restricted.

| | Sig | MTP |
|:------------------:|:------------------------------------------:|:-----------------------------------------:|
| **Validators** |0x9ee6a2682Caa2E0AC99dA46afb88Ad7e6A58Cd1b |0x5f24dD9FbEa358B9dD96daA281e82160fdefD3CD |
| **ERC20 examples** |0x7C14Aa764130852A8B64BA7058bf71E4292d677F |0xa3Bc012FCf034bee8d16161730CE4eAb34C35100 |

## CredentialAtomicQuerySigValidator

<a href="https://github.com/0xPolygonID/contracts/blob/main/contracts/validators/CredentialAtomicQuerySigValidator.sol" target="_blank">**CredentialAtomicQuerySigValidator.sol - Github**</a>

The CredentialAtomicQuerySigValidator contract is used to verify any credential-related zk proof generated by user using the <a href="https://docs.iden3.io/protocol/main-circuits/#credentialAtomicQuerySigV2OnChain" target="_blank">`credentialAtomicQuerySigV2OnChain`</a> circuit. The contract only verifies proofs based on credential of type `Signature`

The core of the contract is its <a href="https://github.com/0xPolygonID/contracts/blob/main/contracts/validators/CredentialAtomicQuerySigValidator.sol#L41" target="_blank">`verify`</a> 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
<a href="https://github.com/0xPolygonID/contracts/blob/main/contracts/verifiers/circuits/verifierSig.sol" target="_blank">`verifierSig`</a> contract which is automatically generated using circom.
- 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](../verifier/verification-library/verification-api-guide.md#verification---under-the-hood). The former is required when performing on-chain verification while the latter is required for off-chain verification.
CredentialAtomicQuerySigValidator address:

- <a href="https://mumbai.polygonscan.com/address/0xF2D4Eeb4d455fb673104902282Ce68B9ce4Ac450" target="_blank">Mumbai: 0xF2D4Eeb4d455fb673104902282Ce68B9ce4Ac450</a>

## CredentialAtomicQueryMTPValidator

<a href="https://github.com/0xPolygonID/contracts/blob/main/contracts/validators/CredentialAtomicQueryMTPValidator.sol" target="_blank">**CredentialAtomicQueryMTPValidator.sol - Github**</a>

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

CredentialAtomicQueryMTPValidator address:

- <a href="https://mumbai.polygonscan.com/address/0x3DcAe4c8d94359D31e4C89D7F2b944859408C618" target="_blank">Mumbai: 0x3DcAe4c8d94359D31e4C89D7F2b944859408C618</a>

> Further protocol related contracts can be found at <a href="https://docs.iden3.io/contracts/state/" target="_blank">Iden3 - Smart Contracts</a>
Loading

0 comments on commit 2786341

Please sign in to comment.