ERC-7861 ERC-721 verifiable credential extension
Draft · NFTs & multi-token · created 2025-01-14
An extension that lets an ERC-721 NFT specify the issuer, credential type, and encryption and verification methods at the collection level, and query each individual NFT's credential location and revocation status in a standard way.
Why it is needed
When ERC-721 collections tried to attach verifiable credentials, such as proof of identity or educational credentials, to NFTs, the way of checking storage location, encryption status, verification method, and revocation status differed from collection to collection. This forced third-party platforms such as wallets and verification services to build new, separate integration logic for every collection that handled credentials. Credentials often carry sensitive information such as identity or education records, and without knowing the encryption status and verification method in advance, they are hard to handle safely; with no standard way to distinguish revoked credentials, reliable use and real-time tracking were difficult.
What to implement
event CredentialIssued(uint256 indexed tokenId, address indexed to);: An event emitted when a new credential is issued.event CredentialRevoked(uint256 indexed tokenId);: An event emitted when a credential is revoked.function issuer() external view returns (string memory);: Returns the issuer DID or address of the credential collection.function credentialType() external view returns (string memory);: Returns the type of credential belonging to the collection.function encryptionMethod() external view returns (string memory);: Returns the encryption method of the credential, or an empty string if it is not encrypted.function verificationMethod() external view returns (string memory);: Returns the method used to verify the credential's proof.function credentialURI(uint256 tokenId) external view returns (string memory);: Returns the URI pointing to the credential location for that NFT.function isRevoked(uint256 tokenId) external view returns (bool);: Returns whether the credential has been revoked.
In depth
Collection-level issuer and type information
issuer() and credentialType() are properties shared across the entire collection, letting the issuer and credential type that apply to all tokens be managed in one place. An empty string from issuer() means there is no issuer.
Specifying the off-chain location via credentialURI
credentialURI(tokenId), similar to ERC-721's tokenURI, points to the storage location of an individual credential. It can point to a public store such as IPFS or to a custom store with access control. The call must fail if tokenId is not a valid NFT, and an implementation that looks up the credential by other means must return an empty string.
encryptionMethod and the decryption flow
encryptionMethod() must return an empty string, and only when the credential is not encrypted. When it is encrypted, it is recommended that only the name of the encryption method be returned, and additional information needed for decryption can be provided separately through another function or contract metadata. The decryption process may include a consent step such as a user wallet signature.
verificationMethod and authenticity verification
verificationMethod() returns the method used to verify the authenticity and integrity of the credential. The format of the return value is left to the implementer, but compatibility with the W3C verification method concept is recommended. When zero-knowledge proofs are used, specific queries can be verified without disclosing the entire credential.
isRevoked and revocation handling
isRevoked(tokenId) must return false if the credential has not been revoked and true if it has, and may return true for a credential that does not exist. Implementing revocation is not mandatory, and it can be done by burning the NFT, by a separate structure within the contract, or by an off-chain revocation list. If burning is used, validity is confirmed simply by the fact that the NFT has not been burned.
Lifecycle tracking via events
CredentialIssued and CredentialRevoked MAY be emitted when the corresponding action is performed, letting off-chain systems efficiently monitor credential status in real time through these events. Emitting the events is not mandatory, but it is recommended for lifecycle tracking.
ERC-165 support and ERC-721 compatibility
supportsInterface must return true when called with 0x7861069. This standard does not change ERC-721's existing functionality and only adds new functions, so it is fully compatible with existing ERC-721 contracts.
A proposal still in Draft stage
This standard is currently in Draft status, and the Rationale section has not yet been written. The function composition or detailed rules may change in the future, or discussion may stall.
Things to watch out for
- Strict access control required: Strict access control must be applied to the authority to issue or revoke credentials and to the authority to set collection properties such as issuer and type, in order to preserve the integrity of the collection information.
- Non-transferability recommended: To preserve the authenticity of the credential and prevent unauthorized transfer, it is best to override the transfer functions so that the credential NFT cannot be transferred.
- Do not expose sensitive information in credentialURI: Because anyone can query credentialURI, it must not directly contain sensitive information. Sensitive data should be encrypted and stored off-chain, and credentialURI should only point to the location of that encrypted data.