EIPs Explained

ERC-7861 · Draft · ERC · 2025-01-14

ERC-7861: ERC-721 Verifiable Credential Extension

An ERC-721 extension that turns an NFT collection into a set of verifiable credentials, exposing the issuer, credential type, encryption and verification methods, a per-token credential URI and revocation status in one standard interface.

What problem does it solve?

Projects already use NFTs to represent diplomas, memberships, KYC attestations and similar claims, but each collection invents its own way to say who issued them, where the actual credential lives, whether it is encrypted and whether it has been revoked. Verifiers have to write custom code for every collection.

ERC-7861 adds a small, shared interface on top of ERC-721 so any platform can discover and check a credential NFT the same way. It was designed with W3C Verifiable Credentials in mind but can link any private, off-chain payload to a wallet through an NFT.

How it works

Collection-wide properties (the same for every token):

  • issuer(): issuer DID or address (an empty string means no issuer).
  • credentialType(): what kind of credential this collection holds.
  • encryptionMethod(): returns an empty string if and only if credentials are unencrypted; otherwise names the method. Extra decryption details can be exposed elsewhere.
  • verificationMethod(): how to verify the credential's proof, ideally matching the W3C "verification method" concept.

Per token:

  • credentialURI(tokenId): where the credential lives (IPFS, a private server with access control, …), or an empty string if retrieval works differently.
  • isRevoked(tokenId): true once revoked; may also be true for tokens that do not exist. Revocation can be burning the NFT, a list in the contract, or an off-chain list.

Optional events, CredentialIssued(tokenId, to) and CredentialRevoked(tokenId), let indexers track the lifecycle.

A verifier's flow: find the credential NFT in the holder's wallet → fetch from credentialURI → decrypt if encryptionMethod() is set (possibly needing the holder's consent) → verify with verificationMethod() → check isRevoked.

Sample code

Checking a credential with ethers v6:

import { Contract } from "ethers";

const vc = new Contract(collection, [
  "function issuer() view returns (string)",
  "function credentialType() view returns (string)",
  "function encryptionMethod() view returns (string)",
  "function verificationMethod() view returns (string)",
  "function credentialURI(uint256) view returns (string)",
  "function isRevoked(uint256) view returns (bool)",
], provider);

if (await vc.isRevoked(tokenId)) throw new Error("credential revoked");

const [iss, type, enc, method, uri] = await Promise.all([
  vc.issuer(), vc.credentialType(), vc.encryptionMethod(),
  vc.verificationMethod(), vc.credentialURI(tokenId),
]);
console.log({ iss, type, encrypted: enc !== "", method, uri });
// next: fetch `uri`, decrypt if needed, verify the proof per `method`

Things to know

  • Status is Draft, and the Rationale section is still TODO.
  • The ERC-165 interface ID is unclear in the current text: the specification gives 0x7861069 (only seven hex digits) while the reference implementation uses 0x74699c4e. Check the final spec before relying on supportsInterface.
  • The spec recommends credentials be non-transferable; for that behaviour see ERC-5192 (minimal soulbound) or ERC-4973.
  • Everything onchain, including credentialURI, is public. Keep sensitive data encrypted off-chain.
  • Strict access control on issuing, revoking and setting collection properties is essential; the reference implementation leaves it out.

#nft #erc721 #credentials #identity #verifiable-credentials

Details

Authors
Valerio Massimo Camaiani (@vmc-crossmint)
Status
Draft
Type
Standards Track / ERC
Created
2025-01-14
Requires

Machine-readable: Markdown · JSON