Demo
We are going to create a verified identity on-chain, and use it to swap USDC to BTC (on devnet).
-
Visit identity.civic.finance and connect your sollet.io wallet.
You will see an USDC/BTC liquidity pool.
This pool has been created using the Identity-gated Token-Swap program.
When creating the pool, the creator specified an Identity Validator (IdV) public key.
-
Airdrop some devnet USDC into your wallet
-
Click the Swap button and attempt to swap USDC for BTC
The liquidity pool on-chain program rejects your transaction, because you do not have an identity signed by the identity validator.
-
Let’s create an identity. There are two options. The first, using the demo IdV.
This simulates a user sending information directly to an identity validator, who checks it, and stores a hash of the information on-chain.
Note: In this demo, the IdV key is stored on the front-end, and the hash is a simple unsalted SHA-256. In a production system, the user would choose from a set of acceptable IdVs, and establish a session with them, and the attestation would happen on the IdV back-end. Alternatively, the user could reuse a pre-attested identity (see Civic below).
-
The other alternative, is to use Civic Secure Identity.
Scan the QR code with the Civic Wallet. Civic returns a reusable, verified credential to the client app, which can then be stored on-chain as above.
Note: In this demo, the Civic credential is attested onto Solana on the front-end, as with step 4. In a production system, the Civic IdV would attest on its back-end, as it currently does on other blockchains.
-
Attempt a swap with the new identity
Now that the identity is created, the swap can go through. The Token-Swap program identifies that the identity has an attestation registered by the chosen IdV, and allows the transaction.