ERC-1812 EIP-712 verifiable claims (Ethereum Verifiable Claims)
Stagnant · Signatures & auth · created 2019-03-03
Defines a method for storing identity or credential information (claims) signed off-chain by an issuer using EIP-712, which can later be presented to a wallet or contract and have its signature verified to prove authenticity.
Why it is needed
Identity and credential information for Ethereum addresses, such as KYC, GDPR compliance, or accredited investor verification, can be risky or even illegal under EU GDPR if permanently recorded on-chain. ERC-735 and ERC-780 store such claims on-chain, but this leaves the problem that personal information remains on an immutable public ledger. Off-chain alternatives like W3C Verifiable Claims or uPort's verification message spec are based on JSON-LD and JWT, making them hard to integrate directly with Ethereum wallets and Web3 clients. EIP-712 provides a signed data format encoded via the Solidity ABI and JSON-RPC signing calls supported by existing wallets, but there was no common specification systematizing this into reusable identity claims, forcing each issuer to create and verify claims in its own way.
What to implement
function verifyIssuer(Know memory claim, uint8 v, bytes32 r, bytes32 s) public returns (address): Computes the EIP-712 digest, recovers the signer with ecrecover, and checks the claim's validity period.function vouch(Know memory claim, uint8 v, bytes32 r, bytes32 s) public returns (bool): Takes a claim and signature, verifies the issuer, and then records that the issuer attests to knowing the subject.function revoke(bytes32 digest) public returns (bool): The caller (issuer or subject) records a specific claim digest in the revocation list.function revoked(address party, bytes32 digest) public view returns (bool): Queries whether a specific party has revoked the claim with that digest.
In depth
Minimal claim structure
Every claim is defined as a Solidity struct with at least three fields. subject is an address indicating who the claim is about, while validFrom and validTo express the claim's validity start and end times, respectively, as uint256 values in seconds. A claim with no expiration sets validTo to the maximum uint256 value (all bits set to 0xff). The struct name (CLAIM TYPE) denotes the actual kind of claim; while not required, it is recommended to use schema.org's classification scheme. As an example, a Know struct is presented, meaning the issuer attests to knowing the subject.
Verifying a claim in a contract
When defining a claim format, you must create a Verifying Contract with a public view function called verify(). This function builds an EIP-712 digest by combining the "\x19\x01" prefix with DOMAIN_SEPARATOR and hash(claim), recovers the signer with ecrecover, and checks claim.validFrom and claim.validTo to confirm the current time falls within the validity period. Other contracts, or web3/state channel apps, verify a claim by calling this verify interface, passing in the struct along with v, r, and s as is.
Embedding a claim within another signature structure
A Claim struct, together with v, r, s, can be nested inside a higher-level struct such as VerifiableReference, which in turn can be nested inside an even higher-level struct such as Introduction. Each nested Verifiable Claim must be verified individually alongside its parent Signed Typed Data structure. Claims issued under different EIP-712 domains can be nested within one another in this same way.
Signing on behalf of an issuer via key delegation
There are two delegation methods for cases where a smart contract address, or a server requiring key rotation, cannot sign directly. First, by adding an issuer field to the claim struct, the verification code must, in addition to standard EIP-712 verification, look up EthereumDIDRegistry (ERC-1056) and call registry.validDelegate(issuer, 'veriKey', recoveredAddress) to confirm the signer is a valid veriKey delegate of the issuer. Second, there is an embedded delegation proof method, where a Delegate(issuer, subject, validFrom, validTo) is bundled with v, r, s as a VerifiableDelegate and nested directly inside the claim's issuer field. This delegation proof should be created specifically for a given EIP-712 domain and not reused across other domains, and domain implementers may add further fields to the Delegate structure for domain-specific rules.
Claim types: binary, value, and hashed claims
A Binary claim carries no value and signifies issuance alone, containing only subject, issuer, validFrom, and validTo, as in Person. A Value claim, such as Name or AverageBalance, carries a human-readable value in a value field (or a field named accordingly), but care must be taken since putting such values into a transaction on a public blockchain could constitute a GDPR violation for a company or developer. A Hashed claim stores a keccak256 hash instead of the value itself, in a keccak256 field, but the same warning applies, since even a hash of a known value may raise GDPR concerns.
Setting up the EIP-712 domain
The claim's EIP-712 Domain must include name, version, chainId, verifyingContract, and salt. The complete signed data is formed and verified by combining the EIP712Domain type definition, the claim type definition, the primaryType, the domain values, and a message containing the actual claim values into a single typed data JSON object.
Revocation registry
Both the issuer and the subject must be able to revoke claims they are party to, with the final rules for who may revoke determined by the Verifying contract. RevocationRegistry provides revoke(digest), which records the revocation time as a block number in revocations[digest][msg.sender] per digest and per party, and revoked(party, digest) for lookups. The verifying contract computes the digest, recovers the issuer via ecrecover, and checks both revocations.revoked(issuer, digest) and revocations.revoked(claim.subject, digest) to reject revoked claims.
A proposal that remains stagnant
This EIP is in Stagnant status, not finalized as a standard, and is no longer actively discussed.