ERC-5851 · Stagnant · ERC · 2022-10-18
ERC-5851: On-Chain Verifiable Credentials
A stagnant proposal for issuer and verifier contracts that record off-chain identity checks (KYC, age, jurisdiction) as soulbound certificates, so other contracts can ask on-chain whether an address meets a set of claims.
What problem does it solve?
Many on-chain applications need to know something about the person behind an address: that they passed KYC, are over 18, live in an allowed jurisdiction, or are a unique human (to prevent Sybil attacks in voting). The checks themselves happen off-chain, but there was no common way to commit the result on-chain so any contract could rely on it.
ERC-5851 proposes a standard split between:
- Issuers, which define the claims that make up a credential and certify (or revoke) addresses as meeting them, represented as a non-transferable "soulbound" token (SBT).
- Verifiers, contracts such as DeFi protocols or DAOs that simply ask "is this address certified for credential X?" before allowing an action.
How it works
Describing claims. Each credential, identified by an SBTID, has an array of Claim structs. A claim combines:
Metadata–title,_typeanddescriptionof the field (e.g. "age", "uint").logic– a comparison operator as a string, one of⊄ ⊂ < <= == != >= >.expectation– aValuesstruct (string / uint / address / bool), reused from ERC-3475.
{ "title": "age", "type": "uint", "description": "age from legal document",
"logic": ">=", "value": "18" }
Issuer interface (admin-controlled):
| Function | Purpose |
|---|---|
standardClaim(SBTID) |
Read the claims defining a credential |
changeStandardClaim(SBTID, claims) |
Create or change those claims; emits StandardChanged |
certify(claimer, SBTID) |
Mark an address as holding the credential; emits Certified |
revoke(claimer, SBTID) |
Remove it; emits Revoked |
Verifier interface: ifVerified(claimer, SBTID) returns true if the address holds that certificate. The reference implementation wraps this in a modifier that gated functions can use.
The actual evidence (documents, zero-knowledge proofs) stays off-chain; only the issuer's attestation is recorded.
Sample code
A protocol restricting a function to certified addresses:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC5851Verifier {
function ifVerified(address claimer, uint256 SBTID) external view returns (bool);
}
contract GatedVault {
IERC5851Verifier public immutable issuer;
uint256 public immutable requiredId; // e.g. the "KYC passed, age >= 18" credential
constructor(IERC5851Verifier _issuer, uint256 _id) {
issuer = _issuer;
requiredId = _id;
}
modifier onlyCertified() {
require(issuer.ifVerified(msg.sender, requiredId), "not certified");
_;
}
function deposit() external payable onlyCertified {
// ...
}
}
Things to know
- Status: Stagnant. The Rationale section is still "TBD" and the spec has inconsistencies (for example, the operator table and Unicode code points do not fully match).
- Everything depends on the issuer's admin key: it defines the claims and certifies or revokes addresses. Changing a credential's claims later affects everyone already certified under it.
- An on-chain certificate is linked to an address and is public. Projects should consider what it reveals about a person; storing raw personal data on-chain is not part of the design.
- Related soulbound work: ERC-5192 for minimal non-transferable NFTs.