✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.

Other SDKs
Cardano
Quickstart

Publish on-chain with Reclaim contract on Cardano

Pre-requisite

  • Before proceeding, ensure familiarity with ReactJs development as described here.

  • You can access the code of this walkthrough on Gitlab (opens in a new tab).

Overview

This walkthrough demonstrates how to integrate Reclaim Protocol proofs with decentralized identity (DID) and verifiable credentials (VCs) using Atala PRISM/Hyperledger Identus. Once a Reclaim Proof is generated, we use it to:

  1. Create a DID.
  2. Issue a Verifiable Credential (VC) tied to that Proof.
  3. Incorporate the DID and VC into the transaction's datum before locking.
  4. During unlocking, verify the VC on-chain before granting access.

By coupling these steps, we ensure that not only is the proof cryptographically valid, but it is also bound to a self-sovereign identity and a tamper-evident credential. This greatly enhances trust and security in decentralized identity workflows on the Cardano blockchain.

Dapp Development

1. Cloning the Dapp repo.

git clone https://gitlab.reclaimprotocol.org/integrations/onchain/pluts-sdk
 
cd pluts-sdk
 
npm install

2. Code Discovery: lockTx.ts

Primary Functionality:

  • Prepares and locks the transaction that holds the proof, DID, and VC.

Key Steps:

  • Get Proof from Reclaim: Retrieve the proof generated off-chain.
  • Create DID & VC: Use the proof to create a Decentralized Identifier and issue a Verifiable Credential using Atala PRISM/Identus before locking.
  • Add to Datum: Incorporate the DID and VC data into the transaction datum, ensuring that both the proof and associated identity credentials are recorded on-chain.
  • Lock Transaction: Sign and submit the lock transaction, making the proof-backed VC accessible only to the rightful owner’s DID.

Functions:

  • getLockTx: Builds the locking transaction, including proof and VC data.
  • lockTx: Signs and submits the locked transaction to the blockchain.

3. Code Discovery: unlockTx.ts

Primary Functionality:

  • Handles the unlocking process by verifying the proof and the associated VC on-chain.

Key Steps:

  • Fetch On-Chain Data: Retrieve the DID and VC from the locked UTxO.
  • Verify VC: Ensure the Verifiable Credential (issued during the locking step) is valid and corresponds to the DID owner attempting the unlock.
  • Unlock Transaction: Once verified, proceed to sign and submit the unlocking transaction, releasing assets and confirming ownership.

Functions:

  • getUnlockTx: Assembles the transaction required to unlock assets after verifying the VC.
  • unlockTx: Signs and submits the unlock transaction to the blockchain.

4. Code Discovery: reclaimPlutus.ts

Description:

  • Defines the smart contract logic for validation.
  • Ensures that the DID, VC, and proof embedded in the datum meet the required unlocking conditions.

Components:

  • Datum & Redeemer: Data formats that the validator uses to verify if the transaction (with the included DID and VC) meets the unlocking criteria.
  • scriptTestnetAddr: The testnet address where the contract runs, ensuring that all transactions occur in the correct environment.

5. Verification Flow

Connect Wallet

Use Nami or another Cardano-compatible wallet set to the testnet environment.

Generate Proof

Scan the provided QR code or initiate the Reclaim App process to produce a zero-knowledge proof.

Lock Proof with DID & VC

  • After generating the proof, create your DID and issue a VC from that proof using Atala PRISM/Identus.
  • Include the DID and VC in the datum during the lockTx process.
  • Submit the lock transaction, thereby publishing the proof and identity credentials on-chain.

lock-exp

Verify by Unlocking

  • To unlock, the DApp fetches the DID and VC from the on-chain datum.

  • Verifies the authenticity of the VC and checks that it belongs to the wallet’s DID.

  • If verified, proceed with unlockTx to release funds and confirm rightful ownership.

    unlock-exp

Contract Deployment

Summary

This documentation outlines how to:

  • Generate a Reclaim proof and transform it into a DID and a Verifiable Credential using Atala PRISM/Hyperledger Identus.
  • Lock this credentialized proof on-chain with a Plutus smart contract.
  • Verify the DID and VC upon unlocking, ensuring that only an authenticated entity can reclaim the locked assets.