ERC-8356: Purpose-Bound Third-Party Data Consent
Revocable, purpose-bound consent grants for a third-party data subject, with an independently revocable agent leg.
Abstract
This standard defines a consent grant in which three principals are distinguished: a subject who consents, a grantee who receives access, and an optional agent that acts on the grantee's behalf. The subject is not the beneficiary. The grant is bound to a declared purpose drawn from a versioned code registry, carries a validity window and a usage cap, may be attenuated into sub-grants that can never exceed their parent, and can be revoked either in whole by the subject or in part by terminating only the agent leg. Grants are minted against an existing asset token so that consent appears in that asset's provenance.
The on-chain record is a status anchor, not the instrument. The instrument, the human-readable authorization the subject actually assented to, remains off-chain and is referenced by hash. What the chain contributes is public, non-repudiable, consensus-ordered revocation, and the ability to prove that a grant existed before a given access.
Motivation
Delegated access to regulated data is now routinely exercised by software agents acting for a human principal. Existing standards cannot express this safely, for three reasons.
A datum about a person is rarely a single object. It is a chain of derived artifacts, each produced by a different custodian and each further from the person than the last. A biological sample is the clearest case:
flowchart LR
subgraph Person["The person"]
Sample["Biosample"]
end
subgraph Lab["Sequencing laboratory"]
FASTQ["FASTQ"]
VCF["VCF"]
end
subgraph Annot["Annotation service"]
AVCF["Annotated VCF"]
Store["Queryable record"]
end
subgraph Model["Model provider"]
Extract["Training extract"]
Vectors["Embeddings"]
Weights["Model weights"]
end
Sample -- "sequencing" --> FASTQ
FASTQ -- "variant calling" --> VCF
VCF -- "annotation" --> AVCF
AVCF -- "indexing" --> Store
Store -- "extraction" --> Extract
Extract -- "embedding" --> Vectors
Vectors -- "training" --> Weights
One consent decision at the left governs seven transformations across four custodians, and the person is asked again at none of them. Two properties follow, and no existing standard provides either. The permission must compose along the chain, narrowing at each hop and never widening. And withdrawal must run the chain in reverse, which it can do until it reaches model weights, where deletion is not available and only measurement and accounting remain.
Every existing delegation standard is two-party. In ERC-4907 and ERC-5006 a token owner grants a
time-boxed user role over their own token. In ERC-8226 a principal delegates scoped, capped
authority to an agent over the principal's own asset, with the mandate keyed (agent, principal, target).
In every case the party who consents is the party who benefits, and the party at risk is the party
who signed. The case this standard addresses is structurally different: a subject consents to a
grantee's access to data about the subject, and the harm from an unauthorized act falls on someone
who is not a party to the transaction at all.
Other standards do model a subject. ERC-8328 defines subjectId, ROLE_SUBJECT
and ROLE_BENEFICIARY; World Wide Web Consortium (W3C) Verifiable Credentials (VC) 2.0 separates credentialSubject from holder and issuer. What
neither does is make that non-party subject's withdrawal operative for a relying party at
access time. ERC-8328 says so itself: it "does not define compliance policy... transfer
restrictions", and its OUTCOME_REVOKED is a recorded assertion that nothing consults. That is the
gap this specification closes, and it is the whole of the claim.
The agent cannot be revoked separately from the human. Where an agent is modeled, it is modeled as an extension of the principal. There is no way to say "this researcher retains access, but the tool they were using does not," which is precisely the action an incident response requires when a model provider, a Model Context Protocol (MCP) server, or a session key is compromised.
Purpose is not enforced anywhere. Regulated-data authorizations are purpose-limited by construction, and no EIP enforces purpose at all. Every regulatory-compliance ERC to date (ERC-3643, ERC-7518, ERC-8106, ERC-8226, ERC-8320) encodes securities and real-world-asset vocabulary: accreditation, jurisdiction blocks, anti-money laundering (AML) flags, transfer caps. A fund unit has no purpose limitation, so the vocabulary was never needed. Data has one.
There is also a concrete gap in the incumbent non-blockchain practice this standard is meant to
interoperate with rather than replace. The Global Alliance for Genomics and Health (GA4GH) Authentication and Authorization Infrastructure
profile, the incumbent mechanism for credentialed access to controlled genomic datasets, allows a Visa Issuer
to provide tokens of this type without any revocation process; it defines exp as explicitly not
a hard cutoff, noting that access is not necessarily removed when the exp timestamp passes; and it
rate-limits the only active validity check, allowing polling at most once per hour per Passport
Clearinghouse. There is no revocation list and no push mechanism. Worst-case
propagation of a withdrawn consent is therefore bounded only by token lifetime and an hourly poll.
A withdrawal that takes an hour to propagate is a poor fit for legal regimes whose operative triggers are knowledge and ease. This standard's contribution is to make the revocation itself public, timestamped, non-repudiable, and immediately readable by any relying party, without moving the authorization document, the identity, or the data on-chain.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Definitions
- Subject: the natural or legal person whose data the grant concerns, and whose assent the grant records. The subject is not required to be the owner of the asset token.
- Grantee: the party authorized to exercise the grant.
- Agent: an optional principal that exercises the grant on the grantee's behalf.
- Instrument: the off-chain authorization document the subject assented to, referenced on-chain
by
termsRefand never stored on-chain. - Agent operator: the party accountable for the agent, typically the organization running the
software the agent is. Named separately from the agent because containing a compromised agent must
not require the agent itself to cooperate. The grant records it in
agentOperator, and the subject signs it together with the agent. - Issuer: the party that runs the programme or study under which grants are made, identified by
the contract's
isIssuerfunction. It is not a party to any individual grant. - Subject key: the address whose signatures authorize every subject-authored act for one grant.
Data model
enum Status {
NONE, // 0 unset
ACTIVE, // 1
REVOKED_BY_SUBJECT, // 2 withdrawal by the subject
RENOUNCED_BY_GRANTEE, // 3 handed back by the grantee
TERMINATED_BY_ISSUER, // 4 programme or study closed
SUSPENDED, // 5 temporary hold; resume is the only non-terminal return to ACTIVE
EXHAUSTED // 6 usesMax reached
}
enum AgentKind {
NONE, // 0 no agent leg
SESSION_KEY, // 1 ephemeral key that calls as msg.sender
EXTERNAL_REGISTRY, // 2 reference into an agent identity registry (e.g. ERC-8004)
TOKEN_BOUND_ACCOUNT, // 3 ERC-6551 account
ASSERTED_UNVERIFIED // 4 claimed by the grantee, not proven
}
enum AgentStatus {
NONE, // 0 no agent leg
ACTIVE, // 1
REVOKED // 2 agent leg ended; the grant itself is unaffected
}
enum SuspendedBy {
NONE, // 0 not suspended
GRANTEE, // 1
AGENT_OPERATOR // 2
}
A conforming implementation MUST store, for each grant, the following fields with these types and meanings:
struct ConsentGrant {
// slot 0
bytes32 scopeRef; // resource hash (the Merkle leaf), or Merkle root if FLAG_SCOPE_IS_ROOT
// slot 1
bytes32 purposeProfileRef; // hash of the canonical purpose profile document
// slot 2
bytes32 termsRef; // hash of the versioned template instrument, never a per-subject copy
// slot 3
bytes32 parentGrantId; // 0 for a root grant
// slot 4
uint256 assetTokenId; // the token, in assetContract, this grant is recorded against
// slot 5
bytes32 subjectCommit; // commitment to a per-grant subject key; never an address
// slot 6
address grantee;
uint48 notBefore;
uint48 expiresAt;
// slot 7
address agent;
uint32 ops; // permission bitmask
uint32 purposeCode; // index into the purpose registry
uint8 status; // Status
uint8 flags;
uint16 depth; // delegation depth, 0 for a root grant
// slot 8
uint8 agentKind; // AgentKind
uint8 agentStatus; // AgentStatus; revocable independently of `status`
uint8 suspendedBy; // SuspendedBy; nonzero only while status is SUSPENDED
uint48 lastUsedAt; // block timestamp of the last accepted commitUsage
uint16 useCount; // cumulative committed uses across epochs; saturates at its maximum
uint16 usesMax; // 0 means unlimited
uint64 usageEpoch; // epoch of the last accepted commitUsage
uint32 usageCount; // count of the last accepted commitUsage within usageEpoch
// slot 9
address agentOperator; // zero when there is no agent leg
// slot 10
address assetContract; // the token contract of assetTokenId; two contracts can share a token id
}
The stored fields, their types and their meanings are normative. Field order and slot packing are
informative: the layout above occupies eleven storage slots (0 to 10), and reordering costs gas on every
grant without changing behaviour. purposeProfileRef, termsRef and the releaseHash of the
purpose registry are each keccak256 of the exact bytes of the document they reference; for a
purpose profile those bytes are its canonical form (see Purpose profile).
Calldata encoding. grant and subGrant take the narrow input struct GrantInput, never
ConsentGrant: a struct of the width of ConsentGrant in an external function signature generates
an application binary interface (ABI) decoder that exceeds the Ethereum Virtual Machine (EVM)
stack, and does not compile, even with the intermediate representation (IR) pipeline enabled. In
GrantInput the seven small scalars (notBefore, expiresAt, ops, purposeCode,
usesMax, agentKind, flags) are packed into the single word policy, laid out as in the policy
table below. The helper encodePolicy(notBefore, expiresAt, ops, purposeCode, usesMax, agentKind, flags) returns that word and decodePolicy(policy) returns the seven scalars. They are conveniences
and not part of the interface. An input struct MUST NOT expose the contract-controlled fields (status, depth, parentGrantId,
agentStatus, suspendedBy, useCount, lastUsedAt, usageEpoch, usageCount): a caller able to
set its own status could forge an active grant, and one able to set depth could escape the
delegation bound.
flags bits: FLAG_SCOPE_IS_ROOT = 0x01, FLAG_DELEGABLE = 0x02,
FLAG_DESTROY_DERIVATIVES = 0x04. Bits 0x08 through 0x80 are reserved and MUST be zero.
ops bits, normative. Without fixed values, two parties assign different meanings to the same
bit position: a grant minted to permit evaluation is read by the data holder as permitting export,
and the failure direction is disclosure:
| bit | name | meaning |
|---|---|---|
0x01 | READ | retrieve the resource |
0x02 | QUERY | evaluate over it without retrieving it |
0x04 | DERIVE | produce a new artifact from it |
0x08 | EXPORT | move it outside the enforcing boundary |
0x10 | TRAIN | use it to fit model parameters |
Bits 0x20 and above are reserved. An unrecognized bit MUST NOT be treated as granting
anything. Implementations MAY additionally expose these as ERC-6617 permissions;
the values are fixed here because a grant minted by one party is evaluated by another, and indices
assigned independently collide.
Interface
interface IConsentGrant /* is IERC165 */ {
event ConsentGranted(
bytes32 indexed grantId, address indexed assetContract, address indexed grantee,
uint256 assetTokenId, uint32 purposeCode, uint48 expiresAt);
event ConsentSubGranted(bytes32 indexed grantId, bytes32 indexed parentGrantId, uint16 depth);
event ConsentRevoked(bytes32 indexed grantId, bytes32 indexed by, uint8 status, bytes32 reasonCode);
event AgentRevoked(bytes32 indexed grantId, address indexed agent, bytes32 reasonCode);
event ScopeLeafRevoked(bytes32 indexed grantId, bytes32 leaf);
event GrantSuspended(bytes32 indexed grantId, address indexed by, bytes32 reasonCode);
event GrantResumed(bytes32 indexed grantId, address indexed by);
event UsageCommitted(bytes32 indexed grantId, uint64 epoch, bytes32 headHash, uint32 count);
/// Subject-authored acts take the subject salt: the contract opens `subjectCommit` as
/// keccak256(abi.encode(subjectSalt, subjectKey)) with subjectKey equal to msg.sender here,
/// or to the `subjectKey` argument whose signature is checked in the `WithSig` variants.
function revokeBySubject(bytes32 grantId, bytes32 reasonCode, bytes32 subjectSalt) external;
function renounceByGrantee(bytes32 grantId) external;
function revokeAgent(bytes32 grantId, bytes32 reasonCode) external;
function revokeScopeLeaf(bytes32 grantId, bytes32 leaf, bytes32 subjectSalt) external;
/// Relayed equivalents. A subject holding no fee token MUST still be able to withdraw,
/// so every subject-authored act has a signed path a third party can submit.
function revokeBySubjectWithSig(
bytes32 grantId, bytes32 reasonCode, bytes32 subjectSalt,
address subjectKey, bytes calldata subjectSig) external;
function revokeScopeLeafWithSig(
bytes32 grantId, bytes32 leaf, bytes32 subjectSalt,
address subjectKey, bytes calldata subjectSig) external;
/// Incident-response hold. Only the grantee or the agent operator. See Status transitions.
function suspend(bytes32 grantId, bytes32 reasonCode) external;
/// Clears SUSPENDED back to ACTIVE. Only the party recorded in `suspendedBy`, never an operator
/// undoing a subject withdrawal.
function resume(bytes32 grantId) external;
/// Programme or study closure. Only an account for which `isIssuer` returns true.
function terminateByIssuer(bytes32 grantId, bytes32 reasonCode) external;
function commitUsage(bytes32 grantId, uint64 epoch, bytes32 headHash, uint32 count) external;
function checkAccess(
bytes32 grantId, uint32 purposeCode, uint32 op,
bytes32 resourceHash, bytes32[] calldata proof
) external view returns (bool);
function isGrantActive(bytes32 grantId) external view returns (bool);
/// The status to show (see Effective status). `isGrantActive` remains the authorization answer.
function effectiveStatus(bytes32 grantId) external view returns (uint8);
/// Whether `leaf` has been withdrawn via `revokeScopeLeaf` on this grant or any ancestor.
function isLeafRevoked(bytes32 grantId, bytes32 leaf) external view returns (bool);
function subjectOf(bytes32 grantId) external view returns (bytes32 subjectCommit);
/// Monotonic per-subject nonce, consumed by every `grant` call. Without it a relayed grant
/// is replayable against the same contract.
function nonces(bytes32 subjectCommit) external view returns (uint256);
function revocationEpoch() external view returns (uint256);
/// The purpose registry (IPurposeRegistry); the zero address means no registry is set.
function purposeRegistry() external view returns (address);
/// The maximum delegation depth this implementation accepts.
function maxDepth() external view returns (uint16);
/// Whether `account` holds the issuer role used by `terminateByIssuer`.
function isIssuer(address account) external view returns (bool);
/// Mint a root grant. Under path (a) of Authorship of consent, `subjectKey` is msg.sender,
/// `subjectSig` is empty and `deadline` is ignored; under path (b), `subjectSig` is the
/// subject's signature of the `Grant` typed data, checked against `subjectKey`.
function grant(
GrantInput calldata g, bytes32 subjectSalt, address subjectKey,
uint256 deadline, bytes calldata subjectSig
) external returns (bytes32 grantId);
/// Mint an attenuated child of `parentGrantId`. See Attenuation.
function subGrant(
bytes32 parentGrantId, GrantInput calldata g, bytes32[] calldata scopeProof
) external returns (bytes32 grantId);
/// The stored fields of a grant; a grant that does not exist returns an all-zero struct.
function getGrant(bytes32 grantId) external view returns (ConsentGrant memory);
}
The ERC-165 interface identifier of IConsentGrant is 0xcc821c0a, the XOR of the selectors of the
functions above.
GrantInput MUST carry exactly the fields of the signed Grant typed data below, other than nonce
and deadline and in that order, and no contract-controlled field. Its field types, and so the selectors of grant and subGrant, are
normative:
struct GrantInput {
bytes32 scopeRef;
bytes32 purposeProfileRef;
bytes32 termsRef;
address assetContract;
uint256 assetTokenId;
bytes32 subjectCommit;
address grantee;
address agent;
address agentOperator;
uint256 policy; // packed scalars; layout in the policy table
}
Required behaviour
Subject commitment. subjectCommit is the only on-chain reference to the subject. It MUST
be formed as:
subjectCommit = keccak256(abi.encode(subjectSalt, subjectKey))
where subjectSalt is drawn from at least 128 bits of entropy, is unique to the grant, and is
never written to contract storage or events, and subjectKey is the address whose signatures authorize every
subject-authored act for that grant: an externally owned account (EOA), whose signature is checked
by recovery, or an ERC-1271 contract account, whose signature is checked by calling
isValidSignature. A signature does not reveal which contract account produced it, so every signed
path takes subjectKey as an explicit argument. A bare keccak256(subjectKey) without a salt MUST NOT be used: an
address space is enumerable, and Privacy rule 2 forbids unsalted hashes over enumerable spaces. A
fresh subjectKey MUST be generated for each grant (Privacy rule 7), so that a long-lived wallet
address is not the opening.
Authorship of consent. grant takes subjectKey as an argument, MUST revert when
g.subjectCommit is zero, and MUST require either (a) msg.sender == subjectKey, with an empty
subjectSig, for an opening of g.subjectCommit, or (b) a valid EIP-712 signature
by subjectKey, verified with ERC-1271 support for contract accounts, over the normative typed
data below, submitted no later than its deadline. An implementation MUST NOT permit an operator, issuer, or minter to create a grant on
a subject's behalf without such authorship. Every call path that accepts subjectSalt (grant,
revokeBySubject, revokeScopeLeaf, both WithSig variants and bindContent of the Content
Credentials profile) MUST treat it as authentication
material, not as chain state, and MUST NOT store it or emit it in an event.
Opening the commitment. Every subject-authored call takes subjectSalt, and the contract MUST
check that keccak256(abi.encode(subjectSalt, subjectKey)) equals the grant's subjectCommit, where
subjectKey is msg.sender on the direct paths and the subjectKey argument on the WithSig
paths and on grant path (b), and only then verify the signature against that address. The salt
travels in the calldata of that call, which is public. From the first subject-authored call of a
grant, grant included, the subject key of that one grant is therefore public. It discloses
nothing about any other grant, because a fresh subject key is used for each grant (Privacy
rule 7). Where the subject key is a contract account, deploying one account per grant can link the
grants through the deployer or the funder; avoiding that linkage is the subject's responsibility
and outside this standard.
The signed payload is normative, because a signature that is not portable across implementations
defeats the purpose of naming EIP-712 at all. The domain is name: "ConsentGrant", version: "1",
with the chain id and the verifying contract address. The struct is:
Grant(bytes32 scopeRef,bytes32 purposeProfileRef,bytes32 termsRef,address assetContract,uint256 assetTokenId,bytes32 subjectCommit,address grantee,address agent,address agentOperator,uint256 policy,uint256 nonce,uint256 deadline)
nonce is the current value of nonces(subjectCommit), and the contract consumes it on every grant
call (see Replay). deadline is the last block timestamp at which the signature is accepted; without
it a signature the subject chose not to submit stays usable until the grant's own expiresAt.
policy packs the seven small scalars, and its layout is normative here even though the
calldata encoding is not. A signed payload that referenced an implementation-defined encoding
would produce a different digest per implementation, which is the portability failure this
paragraph exists to prevent:
| bits | field | type |
|---|---|---|
| 0 to 47 | notBefore | uint48 |
| 48 to 95 | expiresAt | uint48 |
| 96 to 127 | ops | uint32 |
| 128 to 159 | purposeCode | uint32 |
| 160 to 175 | usesMax | uint16 |
| 176 to 183 | agentKind | uint8 |
| 184 to 191 | flags | uint8 |
Bits 192 and above are reserved and MUST be zero. A known limitation: a wallet cannot render
seven packed fields to the person being asked to consent, which is the harm EIP-712 exists to
prevent. The Grant type above is the only signed form: an implementation MUST NOT accept the same
grant under a different typed-data type, because a wallet or verifier could not tell which type a
contract expects, and that is the portability failure the packed layout prevents.
Revocation typed data. Subject-signed withdrawals use the same domain, with these types, which carry no nonce:
RevokeBySubject(bytes32 grantId,bytes32 reasonCode)
RevokeScopeLeaf(bytes32 grantId,bytes32 leaf)
A signed withdrawal names one grant, and both withdrawals are terminal: revokeBySubject reverts
once the grant is REVOKED_BY_SUBJECT, and revokeScopeLeaf reverts once the leaf is
withdrawn. A replayed signature therefore reinstates nothing and cannot advance revocationEpoch a
second time. A nonce shared with grant would let a party holding two signatures for the same nonce
spend one to invalidate the other, which a withdrawal must never allow.
Replay. Domain separation alone stops cross-chain and cross-contract replay and does nothing
about replay against the same contract. Without a nonce a relayer holding one subjectSig can call
grant again after the subject has revoked, minting a fresh identical ACTIVE grant. That is
reinstatement by another name, and it defeats two MUSTs in this document. Implementations therefore
MUST maintain a monotonic per-subject nonce keyed by subjectCommit, MUST expose it as
nonces(bytes32), and MUST consume it on every grant call, under path (a) as under path (b), so that a signature
issued before a direct grant cannot mint a second grant. Signed revocations are replay-safe without
one, as stated under Revocation typed data.
Grant identifiers. grant MUST revert if the identifier already exists. Without that rule an
implementation whose derivation collides silently overwrites a live grant's status, which is a back
door around no-reinstatement. This specification does not mandate a particular preimage, but the
identifier MUST depend on a value that differs between two calls with identical input, so that a
grant made again after a revocation gets a new identifier: for grant, the nonces(subjectCommit)
value it consumed; for subGrant, a counter or an equivalent. An implementation SHOULD derive it so a
wallet can compute it before grant is mined.
Relayed withdrawal. An implementation MUST accept a subject-signed revocation submitted by a
third party (revokeBySubjectWithSig, revokeScopeLeafWithSig), so that a subject holding no fee
token can withdraw. A design where granting accepts a relayed signature and withdrawal does not is
non-conforming, because it makes withdrawal strictly harder than granting.
Attenuation. subGrant MUST be called by the parent's grantee, and MUST revert unless
isGrantActive(parentGrantId) is true, the parent has FLAG_DELEGABLE set, and all of the following
hold: child subjectCommit, assetContract and assetTokenId equal the parent's; child ops is a
subset of parent ops; the child carries FLAG_DESTROY_DERIVATIVES when the parent does; child expiresAt is not later than the parent's; child notBefore is not
earlier than the parent's; child purposeCode is the parent's or a registered narrowing of it;
child usesMax meets the rule below; and depth does not exceed the implementation's maxDepth.
The child names its own grantee, agent and agentOperator, under the same mint-time rules as
grant (see Agent leg at mint).
Because 0 means unlimited, usesMax is attenuated by a rule and not by integer comparison: when the
parent's usesMax is non-zero, the child's MUST be non-zero and not greater than it; when the
parent's is zero, the child's may be any value.
usesMax bounds the uses committed on one grant. Each grant keeps its own useCount, so a grantee
holding a delegable grant can divide or repeat its allowance across sub-grants. A subject who needs
an aggregate ceiling MUST NOT set FLAG_DELEGABLE, or MUST meter access outside this mechanism (see
"usesMax is not a cryptographic bound").
Scope containment MUST be proven, not assumed. Subtree membership is not decidable from two
32-byte roots, so an implementation cannot satisfy "child scope is within parent scope" by inspection.
Either the child names the same scopeRef and the same FLAG_SCOPE_IS_ROOT value as the parent, or
the parent is root-scoped, the child is leaf-scoped, and scopeProof proves the child's scopeRef
is a leaf under the parent's root. An
implementation MUST reject a child whose membership is neither of those. Accepting an unproven child
scope voids attenuation entirely for Merkle-scoped grants: the grantee can mint a child naming any
resource at all, and a later checkAccess on that child consults only the child's own scopeRef.
Agent leg at mint. grant and subGrant MUST revert unless the agent fields agree. When
agentKind is NONE, agent and agentOperator MUST be zero, and agentStatus is set to NONE.
For any other agentKind, agent and agentOperator MUST be non-zero, and agentStatus is set to
ACTIVE. For EXTERNAL_REGISTRY, agent is the address through which the registered identity
acts (for an ERC-8004 identity, its agentWallet), as it stood at the grant. This
standard does not resolve a registry on chain; a relying party that needs the live registry state
reads it off chain.
Mint-time validation. grant and subGrant MUST also revert if grantee is zero, if expiresAt
is not later than notBefore, if agentKind is greater than 4, or if a reserved bit is set: flags
bits 0x08 and above, ops bits 0x20 and above, or policy bits 192 and above. At access time
checkAccess still treats an unrecognized ops bit as granting nothing, so a reader of an older
version fails closed on a grant written for a newer one.
Agent verification. checkAccess MUST accept exactly these callers: (a) msg.sender == agent,
when agentKind is SESSION_KEY, EXTERNAL_REGISTRY or TOKEN_BOUND_ACCOUNT and agentStatus is
ACTIVE; or (b) msg.sender == grantee, when agentKind is NONE or ASSERTED_UNVERIFIED, or
when agentStatus is REVOKED. After revokeAgent the agent therefore fails and the grantee keeps
direct access, which is the incident-response outcome the agent leg exists for. An implementation
MUST NOT accept a caller-supplied agent identity as satisfying an agent constraint.
ASSERTED_UNVERIFIED is recorded for audit only and never makes the agent a permitted caller. An implementation SHOULD take the agent of an
EXTERNAL_REGISTRY grant from an ERC-8004 identity registry rather than defining a parallel agent
model.
checkAccess authenticates only an on-chain caller. The function reads msg.sender. An
off-chain relying party that invokes it through eth_call (or any eth_call equivalent) supplies
from itself and obtains no authentication whatsoever: a client can set from to the agent
address and receive true for a grant that agent was never authorized to exercise from that client.
For off-chain enforcement, a relying party MUST NOT treat a lone checkAccess eth_call as proof of
caller identity. It MUST combine isGrantActive / effectiveStatus (which do not depend on
msg.sender) with an independent authentication of the agent or grantee (for example a signature
over the access request, a signature by the agentWallet registered in an ERC-8004 identity, or a transport-level credential).
On-chain callers that gate a resource behind checkAccess in the same transaction remain sound,
because msg.sender is then the EVM caller.
checkAccess evaluation. checkAccess MUST return true only if all of the following hold: the
caller is permitted by Agent verification; isGrantActive(grantId) is true; purposeCode equals the
grant's purposeCode (exact equality over registered codes, since narrowing applies only to
subGrant); op has exactly one bit set, that bit is a recognized ops bit, and the grant's ops
has that bit set; and the scope proof below holds. It MUST return false for an unknown grant, and for
an op with zero bits or more than one bit set.
Scope proof. checkAccess MUST return false if resourceHash has been withdrawn via
revokeScopeLeaf on this grant or any ancestor, whether or not this grant is root-scoped. When
FLAG_SCOPE_IS_ROOT is set, it MUST also verify proof as a Merkle inclusion proof of
resourceHash under scopeRef. When the flag is clear, scopeRef MUST equal resourceHash. In both cases resourceHash is the Merkle leaf defined below,
keccak256(bytes.concat(keccak256(resourceId))), and the scopeRef of a single-resource grant,
including a leaf-scoped child, is that same leaf.
Merkle construction is normative. Without a fixed leaf and pair rule, two conforming implementations can disagree on whether a proof is valid. Implementations MUST use:
- Leaf.
leaf = keccak256(bytes.concat(keccak256(resourceId))), whereresourceIdis the canonical byte encoding of the resource identifier agreed off-chain for that asset. The identifier MUST carry no meaning outside this protocol or MUST include a salt of at least 128 bits, because the leaf is an unsalted hash of it and Privacy rules 1 and 2 apply to it. Double-hashing matches the OpenZeppelinMerkleProof/ StandardMerkleTree leaf form and blocks second-preimage attacks on interior nodes presented as leaves. - Interior node.
parent = keccak256(bytes.concat(min(a, b), max(a, b)))over the two 32-byte children, i.e. sorted-pair hashing. Proof elements are sibling hashes from leaf to root; at each level the implementation sorts the current hash with the sibling before hashing. - Empty proof. A single-leaf tree has
scopeRef == leafand an emptyproofarray.
revokeScopeLeaf withdrawals MUST be consulted on every ancestor when evaluating a descendant;
isLeafRevoked(grantId, leaf) reports exactly that evaluation.
A per-datum withdrawal that stops at the grant that recorded it does not survive one delegation hop,
and would let a grantee recover a withdrawn leaf by minting a child that re-lists it.
Purpose registry. purposeCode indexes a registry that maps a code to an ontology term and pins
the ontology release, so a code's meaning cannot drift. An implementation MUST expose
purposeRegistry() returning its registry address, and the registry MUST implement:
interface IPurposeRegistry /* is IERC165 */ {
/// The ontology term and the hash of the pinned ontology release for a registered code.
function termOf(uint32 code) external view returns (string memory iri, bytes32 releaseHash);
function isNarrowing(uint32 childCode, uint32 parentCode) external view returns (bool);
}
termOf returns an Internationalized Resource Identifier (IRI) naming the ontology term, and the
hash of the pinned ontology release, so a reader can resolve the mapping and the release. It returns
an empty string for an unregistered code. Once a code is registered, its term and release MUST NOT
change. Who may register codes and narrowings is implementation-defined. The ERC-165 interface
identifier of IPurposeRegistry is 0xea84a472.
Where purposeRegistry() returns the zero address, subGrant MUST require exact purpose equality;
that is, an unset registry MUST fail closed. On-chain purpose matching is equality over registered
codes. Ontology subsumption reasoning, where a broad permitted use implies a narrower one, is
explicitly out of scope and is performed off-chain by the relying party.
Purpose profile. purposeProfileRef is the hash of the canonical purpose profile document,
which carries the full purpose including any parameters. Parameters need a defined place because
several widely used modifiers are parameterized (a disease-specific permission needs a disease, a
geographic restriction needs a region, a time limit needs a duration) and no published vocabulary
specifies how a parameter attaches. The profile document MUST be a JavaScript Object Notation
(JSON) object, canonical per RFC 8785 (JSON
Canonicalization Scheme), with exactly one member, terms, an array of {term, value} pairs where
term is an ontology IRI and value is an IRI or a literal, and the value member is omitted, never null, when the term has no parameter. RFC 8785 does not reorder
array elements, so two profiles with the same pairs in different array orders would hash
differently. Implementations MUST sort the array by term ascending as UTF-8 byte order, ties
broken by the RFC 8785 serialization of the pair, before canonicalization, MUST reject profiles
whose array is not so sorted, and MUST reject two identical pairs. That is a choice made here, not
a convention inherited from elsewhere.
Revocation authority.
| Action | Authorized caller | Resulting status |
|---|---|---|
revokeBySubject | the subject only | REVOKED_BY_SUBJECT |
renounceByGrantee | the grantee | RENOUNCED_BY_GRANTEE |
revokeAgent | grantee, agent, or agent operator | agentStatus only; grant survives |
revokeScopeLeaf | the subject | grant survives, leaf withdrawn |
revokeBySubject MUST be unconditional, MUST take effect immediately, MUST NOT be blocked by the
grantee, the issuer, or the contract operator, and MUST cause isGrantActive to return false for
every descendant grant. It MUST NOT require unbounded work in the revoking transaction; lazy
evaluation is permitted and RECOMMENDED. An eager per-descendant write lets a grantee mint enough
sub-grants to push the subject's withdrawal past the block gas limit, which makes the withdrawal
permanently impossible to execute and defeats the "MUST NOT be blocked" rule in the same sentence that
states it.
revokeAgent MUST revert unless status is ACTIVE or SUSPENDED, agentKind is not NONE and
agentStatus is ACTIVE. revokeScopeLeaf MUST revert unless status is ACTIVE or SUSPENDED
and the leaf is not already withdrawn on this grant; it MAY be called on any grant, root-scoped or
not.
Status transitions. Every non-NONE value MUST have exactly one writing path. Values with no
path are dead weight and invite non-conforming custom setters.
| From | To | Writer | Notes |
|---|---|---|---|
NONE | ACTIVE | grant / subGrant | only mint path |
ACTIVE, SUSPENDED, RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER or EXHAUSTED | REVOKED_BY_SUBJECT | revokeBySubject / WithSig | terminal; subject always wins |
ACTIVE or SUSPENDED | RENOUNCED_BY_GRANTEE | renounceByGrantee | terminal; the grantee can always hand a grant back |
ACTIVE or SUSPENDED | TERMINATED_BY_ISSUER | terminateByIssuer | terminal; caller satisfies isIssuer |
ACTIVE | SUSPENDED | suspend | grantee or non-zero agent operator only |
SUSPENDED | ACTIVE | resume | only the party recorded in suspendedBy |
ACTIVE or SUSPENDED | EXHAUSTED | commitUsage | when cumulative uses reach usesMax != 0 |
Every transition out of SUSPENDED sets suspendedBy to NONE, so the field is non-zero only
while the status is SUSPENDED. suspend MUST revert unless status is ACTIVE and the caller is
the grantee or a non-zero agentOperator. A suspension by the agent operator therefore blocks
neither the subject's withdrawal, nor the grantee's renounceByGrantee, nor terminateByIssuer.
REVOKED_BY_SUBJECT, RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER, and EXHAUSTED
are terminal. An implementation MUST NOT provide any function that returns a terminal grant to
ACTIVE. The one change between terminal statuses is that revokeBySubject records
REVOKED_BY_SUBJECT over RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER or EXHAUSTED: without it a
grantee, an issuer or a usage cap could act first, keep the subject's withdrawal from being recorded,
and so escape FLAG_DESTROY_DERIVATIVES. It emits ConsentRevoked again with the new status. Re-granting MUST mint a new grant with a new identifier. The sole exception to
no-reinstatement is resume of SUSPENDED → ACTIVE, and it exists only so incident response can
lift a temporary hold without erasing a later subject withdrawal. resume MUST revert if the
caller is not the party recorded in suspendedBy, and MUST revert if status is anything other than
SUSPENDED. A grant is replaced by revoking it and minting a new one.
Roles. The callers named in this section are identified as follows. The subject is whoever opens
subjectCommit (Subject commitment). The grantee is grantee, the agent is agent, and the agent
operator is agentOperator, which is zero when there is no agent leg, so no operator can act on such
a grant. The issuer is any account for which isIssuer returns true. suspend records its caller in
suspendedBy (GRANTEE when the caller is the grantee, AGENT_OPERATOR otherwise), and resume
requires the grantee or the agent operator respectively.
Interface detection. A conforming implementation MUST return true from
ERC-165 supportsInterface for the identifier of IConsentGrant, 0xcc821c0a. The
identifier includes grant and subGrant, whose selectors are fixed because GrantInput is
normative.
Activity. isGrantActive MUST evaluate the grant and every ancestor up to maxDepth, and MUST
return false if any is not ACTIVE, if the current time is outside [notBefore, expiresAt), or if
usesMax != 0 && useCount >= usesMax. It does not consider agentStatus: the agent leg changes
who may call checkAccess, not whether the grant is active.
Effective status. effectiveStatus(grantId) MUST return NONE for an unknown grant. Otherwise,
walking from grantId up through its ancestors, it MUST return REVOKED_BY_SUBJECT if any grant on
the path has that status; failing that, the status of the nearest grant on the path with another
terminal status; failing that, SUSPENDED if any grant on the path is suspended; and ACTIVE when
none of these applies. The subject's withdrawal therefore shows through a child that was renounced or
suspended first. It does not
reflect [notBefore, expiresAt) or usesMax: only isGrantActive does, so effectiveStatus is
for display and never replaces isGrantActive.
Revocation epoch. revocationEpoch MUST increase by at least one on every call that can turn a
previously returned authorization into a refusal: revokeBySubject and revokeBySubjectWithSig,
renounceByGrantee, terminateByIssuer, revokeAgent, revokeScopeLeaf and its WithSig
variant, suspend, and any transition to EXHAUSTED. resume does not change it. Relying
parties that cache authorization decisions SHOULD re-validate when it changes; this bounds revocation
latency without requiring per-access reads.
Events. Each state change emits exactly the event named, in the same transaction. grant emits
ConsentGranted; subGrant emits ConsentGranted followed by ConsentSubGranted; every
transition to a terminal status emits ConsentRevoked with the new status; revokeAgent emits
AgentRevoked; revokeScopeLeaf emits ScopeLeafRevoked; suspend emits GrantSuspended and
resume emits GrantResumed, each with the caller in by; and commitUsage emits
UsageCommitted. In ConsentRevoked, by is subjectCommit for REVOKED_BY_SUBJECT, the caller's
address left-padded to 32 bytes for RENOUNCED_BY_GRANTEE and TERMINATED_BY_ISSUER, and zero for
EXHAUSTED, which has no caller to name. reasonCode is the code the caller supplied, or zero where
the function takes none. No event carries the subject key or the salt.
Derivative destruction. FLAG_DESTROY_DERIVATIVES records an instruction of the subject, not an
on-chain mechanism, because a contract cannot delete anything off-chain. When the flag is set on a
grant and that grant or any ancestor reaches REVOKED_BY_SUBJECT, the grantee and the agent MUST
destroy every derivative they produced under the grant (an artifact created through the DERIVE or
TRAIN operations), and a relying party MAY treat continued possession as non-compliance with the
grant. Where destruction is not technically available, as for trained model weights, the grantee
SHOULD document the measurement and accounting done in its place.
Usage accounting. Implementations MUST NOT emit a per-access event. Usage is recorded off-chain
as an append-only hash chain whose head is committed periodically via commitUsage. The chain is
normative so that two parties can recompute the same head:
- Hash function.
Hiskeccak256.h_0 = bytes32(0). - Step.
h_i = keccak256(abi.encodePacked(h_{i-1}, record_i))fori = 1..n. - Record. Each
record_iis 32 bytes:record_i = keccak256(abi.encode( bytes32 grantId, uint64 accessedAt, uint32 op, bytes32 resourceHash, bytes32 requestId)).accessedAtis Unix seconds;requestIdis a caller-chosen unique id for the access so that two identical accesses do not collide into one record. Fields finer than needed for enforcement (identity of a human user, session tokens) MUST NOT appear inrecord_i. - Commitment.
commitUsage(grantId, epoch, headHash, count)asserts that aftercountrecords inepoch, the chain head isheadHash. Anepochis one off-chain hash chain for the grant: epoch 0 is the first, and the grantee or agent starts a fresh chain, withh_0 = bytes32(0)again, by using the next epoch number.epochMUST equalusageEpoch, orusageEpoch + 1once at least one use has been committed (usageCount > 0), so that epoch 0 cannot be skipped empty. Within an epochcountMUST be greater thanusageCount, in a new epochcountMUST be greater than zero, andheadHashMUST NOT be zero. A call that adds no uses, or that repeats an(epoch, count)under anotherheadHash, therefore reverts, so a committed head cannot be restated. The contract MUST then update the stored fields:useCountincreases bycount - usageCountfor the same epoch, or bycountfor a new epoch, and saturates at its maximum;usageEpochandusageCounttake the newepochandcount; andlastUsedAttakesblock.timestamp, the time of the commitment and not of any access.revocationEpochis unrelated toepoch. WhenusesMax != 0anduseCount >= usesMax, status MUST becomeEXHAUSTEDand MUST NOT overwrite a terminal subject or issuer status. Only the grantee, or the agent whileagentStatusisACTIVE, may callcommitUsage; it MUST revert for any other caller, and for a grant whose status is neitherACTIVEnorSUSPENDED.
usesMax is not a cryptographic bound. Only the grantee or agent can advance the off-chain chain
and call commitUsage, so the party constrained by usesMax is also the party that reports use.
The field is a contractual ceiling with on-chain accounting the constrained party self-declares.
A relying party that needs a bound the grantee cannot under-report MUST meter access outside this
mechanism (for example by serving bytes only through a gate that increments its own counter, or by
requiring a usage head signed by a third-party notary). Implementations MUST document this honesty
assumption wherever they surface usesMax to a subject.
What the chain provides is tamper-evidence and ordering over the records that were appended. It does not provide completeness: a party that declines to append a record leaves no gap a third party can detect from the head alone. See Privacy and Data Protection under Security Considerations.
Privacy rules
These rules protect the data subject rather than the protocol. An implementation can satisfy every other requirement, function correctly, and still place its operator in breach of data protection law. The chain records authorization state, never facts about the person: anything that describes the subject rather than the permission belongs off-chain.
The following MUST NOT be written to chain state or events:
- Any identifier that carries meaning outside this protocol, in any form, including hashed and including encrypted. This covers an account address, a name, a medical record number, a date of birth, an email address and a biological sequence. A hash of such an identifier remains personal data, and encryption does not remove that status. The single permitted exception is the subject commitment of rule 7, which is generated for one grant and denotes nothing outside it.
- An unsalted hash of any identifier drawn from an enumerable space. An address space is enumerable, so a bare hash of an address can be reversed by brute force and yields a pseudonym at best.
- Data from which the underlying record can be reconstructed, including partial or aggregate derivatives where the population is small.
- Date elements finer than a year, and geography finer than a coarse region, that describe the
subject or the subject's data. The grant's own timestamps (
notBefore,expiresAt,lastUsedAt) describe the authorization and not the person, and are permitted. - The plain-language instrument text.
termsRefMUST hash a versioned template shared across many subjects, never a per-subject executed document, which would be a commitment to personal data. - Free-text purpose or condition strings. Use registered codes and the profile hash.
- A stable subject identifier reused across grants. The subject MUST be referenced on-chain only as
subjectCommit, a commitment to a subject key that is generated for that grant, drawn from at least 128 bits of entropy, and derived from no pre-existing identifier. A fresh key MUST be used for each grant, so that two grants concerning the same person are not linkable by an observer. - Session identifiers or other behavioral identifiers. A session identifier has no on-chain enforcement value, because a contract cannot verify that a session existed, and publishing one makes an individual's interactions linkable.
Zero-subject profile
An implementation MAY support a zero-subject profile, in which a Bind carries no on-chain subject
authentication and revocation happens only by an off-chain process. The profile applies to Bind
alone: grant MUST revert when subjectCommit is zero, so every grant has a subject who can
withdraw it. Where a Bind carries a zero subjectCommit, grantId MUST be zero and the
implementation MUST reject every on-chain subject-signed path for it. The Content Credentials profile
below uses it for a public work.
Grant tokens
An implementation MAY additionally represent grants as soulbound ERC-1155 tokens in a reserved
identifier range. Where it does, the grant token MUST be minted to the grantee only. A subject-side
mint MUST NOT be performed, because it would write the subject's account address into transfer state
and events and so republish exactly the identifier that subjectCommit exists to keep off-chain.
Content Credentials profile
This subsection is OPTIONAL. It is not a separate standard. A deployment MAY bind a grant, or a subject-less authorship claim, to a Coalition for Content Provenance and Authenticity (C2PA) Content Credential so that a viewer can establish who committed to a piece of content and, when the content carries someone's data, whether that person's consent still stands. A conforming core implementation need not implement it, and an implementation that does implement it remains a conforming ERC-8356 implementation.
Referenced specifications. The terms manifest, claim, hard binding, ingredient and X.509 claim signature are those of the C2PA Technical Specification, version 2.5. An identity assertion is the one defined by the Creator Assertions Working Group (CAWG) Identity Assertion specification, version 1.3. The verifier's trust list is the list of trust anchors the verifier applies to X.509 claim signatures, for example the C2PA trust list, and the verifier declares which list it uses.
Two graphs stay two graphs. A C2PA manifest already carries an ingredient graph: the assets a
derivative was made from. This ERC carries a consent graph: parentGrantId attenuation and scopeRef
leaves. The profile MUST NOT collapse one into the other. Revoking a parent asset orphans its
derivatives through the C2PA ingredient chain, and FLAG_DESTROY_DERIVATIVES carries the subject's
instruction to destroy them (see Derivative destruction); revoking a grant does not rewrite any C2PA
manifest. Withdrawal of consent is not erasure of authorship, and the two graphs
answer different questions.
Content commitment. The content is committed as
keccak256(abi.encodePacked(salt, sha256(content))), where salt is a fresh 32-byte value and
sha256(content) is the SHA-256 of the exact bytes. abi.encodePacked of two bytes32 values is
their concatenation, so this is keccak256(salt || sha256(content)). The salt is off-chain content,
not on-chain state; it MUST carry at least 128 bits of entropy (Privacy rule 7) and MUST NOT be
published on chain. A manifest commitment over the finalized C2PA bytes is formed the same way,
keccak256(salt || sha256(manifest)), with an independent salt.
Field definitions. biocid is a uniform resource identifier (URI) per
RFC 3986 that names the content and resolves only through
an access-controlled resolver under the owner's authority; resolution happens off chain and the string
carries no meaning on chain. The profile is written for the scheme biocid, of the form
biocid://<authority>/<path>, which is this profile's own name for such an identifier and is not
registered with the Internet Assigned Numbers Authority (IANA); another scheme that meets the same
resolver rule is permitted. ingredientsRoot is the root of a sorted-pair Merkle tree, built as in
the Merkle construction above, whose leaves are keccak256(bytes.concat(keccak256(h))) for each
ingredient hash h, the SHA-256 value the C2PA manifest records for that ingredient; it is zero when
the content has no ingredients. snpBloom is a 32-byte commitment binding the work to material derived from
deoxyribonucleic acid (DNA), and is zero when the work is not DNA-bound; a deployment commonly builds it as a Bloom
filter over single-nucleotide-polymorphism (SNP) positions, and this profile fixes only its width and
its inclusion in Bind, not its construction. The binding pointer carried in the C2PA claim is the
tuple (chain id, verifying contract address, attestor, grantId, biocid) in a manifest
assertion, with grantId zero for a public work. Those five fields are normative. The assertion
label is implementation-defined and published by the implementation, and the pointer carries no
subject information.
Binding ceremony. The order is normative. Bind is an on-chain attestation of the sealed C2PA
claim, not a field inside it. Putting Bind inside the hashed claim would make manifestCommitment
unknowable at signing time and would let a relayer swap the sealed bytes after the author has
signed. A C2PA X.509 author assertion or a CAWG identity assertion, if present, is a separate
signature and is not this Bind.
- The attestor computes
contentCommitmentas above. - For a work carrying a subject's data,
grantis called withscopeRefequal to thecontentCommitment(or a Merkle root containing it), which yields thegrantIdthat the next step embeds. For a public work, no grant is created (see Permanence, below). - The C2PA claim is assembled (content hash, ingredients, the binding pointer,
biocid) without the EIP-712Bind, and the claim generator produces its X.509 signature over those finalized bytes. - The
manifestCommitmentis computed over those finalized bytes,keccak256(salt || sha256(manifest)), with an independent salt. - The author (for a public work) or the subject (for a work carrying their data) signs the EIP-712
Bindtyped data below. The signature covers thecontentCommitment, themanifestCommitment, thebiocid, therevocableflag, the C2PAingredientsRoot, thesubjectCommit, thesnpBloomand thegrantId, so none of those can change after signing without invalidating the signature. The lab's X.509 claim is separate:Bindis always authored by the subject or the public author. bindContentrecords the binding, against the grant for a work carrying a subject's data.
The Bind typed data. The profile reuses this ERC's EIP-712 domain (name: "ConsentGrant",
version: "1", with the chain id and verifying contract). It introduces no ERC-191 scheme. The domain
already carries the chain id and verifying contract, so the message carries only the content and policy
tuple:
Bind(bytes32 contentCommitment,bytes32 manifestCommitment,string biocid,bool revocable,bytes32 ingredientsRoot,bytes32 subjectCommit,bytes32 snpBloom,bytes32 grantId,uint256 nonce)
manifestCommitment is inside Bind so a relayer cannot substitute a different sealed C2PA after the
author has signed. biocid is a string, so EIP-712 includes keccak256(bytes(biocid)) in the
digest, and the contract needs only that hash: bindContent takes biocidHash, equal to
keccak256(bytes(biocid)), and rebuilds the same digest. That is what stops an attestor from
swapping the URI after the author has signed. The raw URI, which may embed an identifier that carries
meaning outside this protocol, never appears in state, events or calldata, satisfying Privacy rules 1
and 2. snpBloom is a commitment, never raw genotype calls. For a public work revocable is false,
subjectCommit is zero (the zero-subject profile) and grantId is zero. For a work carrying a
subject's data revocable is true, subjectCommit is the grant's subjectCommit, and grantId is
that grant. grantId is inside Bind so that nobody can rebind the signature to another grant of the
same subject, for example a sub-grant held by the grantee.
An implementation MUST verify the Bind signature with ERC-1271 support
(SignatureChecker or equivalent) against an explicit attestor address, so a smart-account
subject can author Bind and a signature over different fields cannot bind as a recovered
stranger. For a grant-bound work the attestor MUST open subjectCommit. The Bind nonce is the
current value of bindNonces(attestor), a counter per attestor that is independent of
nonces(bytes32), because a public work has no subjectCommit to key a counter by. bindContent MUST reject a zero manifestCommitment.
On-chain binding. A conforming binding implementation SHOULD expose IContentBinding:
interface IContentBinding /* is IERC165 */ {
struct Binding {
address attestor;
bytes32 contentCommitment;
bytes32 manifestCommitment;
bytes32 ingredientsRoot;
bytes32 snpBloom;
bytes32 biocidHash;
bytes32 grantId; // zero for a public work
bytes32 subjectCommit; // zero for a public work
bool revocable;
}
event ContentBound(
bytes32 indexed bindingId, address indexed attestor,
bytes32 indexed contentCommitment, bytes32 grantId);
/// bindingId = keccak256(abi.encode(attestor, contentCommitment)).
function bindContent(
bytes32 contentCommitment, bytes32 manifestCommitment, bytes32 ingredientsRoot,
bytes32 subjectCommit, bytes32 snpBloom, bool revocable, bytes32 biocidHash,
uint256 nonce, address attestor, bytes calldata bindSig,
bytes32 grantId, bytes32[] calldata scopeProof, bytes32 subjectSalt
) external returns (bytes32 bindingId);
/// Recompute a commitment from a disclosed salt and hash.
function verifyContentDisclosure(bytes32 salt, bytes32 contentSha256, bytes32 contentCommitment)
external pure returns (bool);
function verifyManifestDisclosure(bytes32 bindingId, bytes32 salt, bytes32 manifestSha256)
external view returns (bool);
/// The stored binding; a `bindingId` that is not bound returns an all-zero struct.
function getBinding(bytes32 bindingId) external view returns (Binding memory);
/// The nonce the next `Bind` signed by `attestor` must carry.
function bindNonces(address attestor) external view returns (uint256);
/// False if `bindingId` is not bound. True for a bound public work; for a bound work
/// carrying a subject's data, true only if
/// `isGrantActive` is true for its grant and `isLeafRevoked(grantId, contentCommitment)` is false.
function isBindingActive(bytes32 bindingId) external view returns (bool);
}
The ERC-165 interface identifier of IContentBinding is 0x70304dcd, and an implementation that
exposes it MUST return true for that identifier from supportsInterface.
A binding is identified by bindingId = keccak256(abi.encode(attestor, contentCommitment)). Keying
it by contentCommitment alone would let anyone who sees a pending bindContent copy its
contentCommitment, sign a Bind of their own as another attestor and bind it first, so that the
author's binding reverts as already bound. Anyone may submit bindContent: the signature, not the
caller, authorizes it. bindContent MUST accept the Bind signature via ERC-1271 against
attestor, MUST consume bindNonces(attestor), MUST reject a bindingId that is already bound,
MUST emit ContentBound, and MUST, when grantId is
non-zero, require revocable be true, the grant be active, its subjectCommit match, the attestor open that commitment,
and contentCommitment be the grant's scope leaf (equality for a single-leaf grant; the same Merkle
inclusion checkAccess uses for a root-scoped grant). When grantId is zero it MUST require
revocable be false. verifyManifestDisclosure recomputes the manifest commitment from the
disclosed salt and compares it with the one stored for bindingId.
The binding stores commitments only. It MUST NOT store the biocid, the salt, the raw content hash,
or any storage Uniform Resource Locator (URL). Following Privacy rules 1 and 3, the binding does not store the C2PA bytes; those
are resolved off chain through the manifestCommitment. The calldata of bindContent carries
subjectSalt when grantId is non-zero, which is public (see Opening the commitment), and it
carries biocidHash, never the URI.
URI profile. In the Content Credentials profile the biocid field MUST hold a biocid URI or another URI that
resolves only through an access-controlled resolver under the owner's authority. It MUST NOT be a raw
cloud-storage path (for example gs:// or s3://), a direct object-storage URL, or any signed or
presigned URL. A
signed URL is an ungated, unrevocable, unaudited bearer capability that survives consent withdrawal and
cannot be erased, which contradicts this ERC's revocability and erasure guarantees.
Verifier requirements. A conforming verifier, given content, the disclosed salts, and the manifest,
from which it reads the binding pointer (chain id, verifying contract address, attestor,
grantId, biocid), MUST treat the failure of any of the following as no valid provenance claim.
bindingId below is keccak256(abi.encode(attestor, contentCommitment)) for the pointer's
attestor:
- if the pointer's
grantIdis non-zero,isGrantActive(grantId)is true andisLeafRevoked(grantId, contentCommitment)is false, which isisBindingActive(bindingId); for a public work, withgrantIdzero, this check is skipped; verifyContentDisclosureandverifyManifestDisclosureboth return true;- the C2PA hard binding matches the content, and the X.509 signature validates against the verifier's trust list (see Referenced specifications), including certificate revocation;
getBinding(bindingId)returns a binding whosegrantIdequals the pointer'sgrantId, whoseingredientsRootequals the root recomputed from the manifest's ingredient hashes (zero when it has none), and whosebiocidHashequalskeccak256(bytes(biocid))for the pointer'sbiocid; whengrantIdis non-zero, itssubjectCommitequalssubjectOf(grantId). The contract verified the attestor'sBindsignature when it accepted the binding.
The on-chain status and the X.509 result combine restrictive-wins. This lattice is normative in this ERC. It is not a companion note. A verifier that implements the profile MUST apply it:
| Grant state | X.509 / C2PA result | Verifier output |
|---|---|---|
isBindingActive is true, or no grant (public work) | valid | valid provenance |
| any | untrusted, revoked, or expired | no valid claim |
the grant or an ancestor is SUSPENDED | valid | no valid claim, until resume |
the grant or an ancestor is terminal (REVOKED_BY_SUBJECT, RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER, EXHAUSTED), the content's leaf is withdrawn, the current time is outside [notBefore, expiresAt), or useCount has reached usesMax | valid | no valid claim |
SUSPENDED withholds the claim only while the hold lasts, and the claim is valid again after
resume. A grant before notBefore withholds it until then; after expiresAt it does not return.
effectiveStatus identifies a suspended or terminal ancestor; it never reports the time window. Every terminal status is as restrictive as REVOKED_BY_SUBJECT. agentStatus does not
enter the lattice: a revoked agent leg changes who may exercise the grant, not whether the subject's
consent to the content stands. Untrusted and revoked are both invalid for this lattice. A public work has no on-chain row; only the X.509 and disclosure checks apply, and its claim
is permanent.
Permanence. A grant that cannot be revoked would contradict this ERC, whose premise is that
the subject can always withdraw. So a permanent work is expressed by the absence of a grant, not by a
grant that cannot be revoked. A public paper, blog post, or EIP carries a Bind signed with
revocable = false and a zero subject and mints no grant; a work carrying a subject's data always
carries a revocable grant. The Zero-subject profile defined above is the vehicle for the first case.
Rationale
Why the token is a status anchor and not the instrument. A signature proves control of a key, not
that a particular human assented. Whether an authorization is valid also turns on facts a contract
cannot observe, including whether the signer had authority to act for the subject and whether any
material representation in the instrument was false. Adjacent work reached the same conclusion:
ERC-8328 states that its stored records are "attributable assertions, not proof that the reported
action occurred or was lawful," and ERC-8226 states that "The content of metadata, such as off-chain legal
text, cannot be verified on-chain." This standard therefore claims weight as evidence
and ordering, not legal operative effect, with one exception: revocation status, which relying parties
read directly and which is operative for them.
Why not a profile of ERC-8226. ERC-8226 is a two-party delegation keyed (agent, principal, target), in
which the principal owns the asset and the caps are denominated in transfer quantity. This standard
is irreducibly three-party, and its subject holds no asset and signs no transaction at exercise time.
ERC-8226 checks at each use that a mandate has not been revoked, but it reads the principal's
eligibility at the compliance provider only when a mandate is granted or extended, and does not
re-read it while the mandate is live; a freeze applied by an enforcer halts evaluation without
revoking. For an irreversible disclosure, and under regimes whose triggers are knowledge and ease of
withdrawal, an eligibility checked at grant time only is not sufficient. Finally, ERC-8226's metadata
field is a 32-byte pointer that it forbids using for enforcement decisions, so the one place a
purpose or an instrument could live carries no force of its own. The two compose: an agent may hold
an ERC-8226 mandate over a payment asset and a grant under this standard over a data asset.
Why not simply a Verifiable Credential with a status list. For the instrument itself, a W3C
Verifiable Credential is the better carrier, and this standard says so. termsRef hashes the
versioned template referenced from the credential's termsOfUse, never the per-subject
credential instance: hashing the instance would be a commitment to personal data, which Privacy
rule 5 forbids. What a VC status list cannot provide is a revocation that is public,
consensus-ordered, and not retractable by the issuer. A Bitstring Status List is fetched from an
issuer-controlled endpoint that can be rewritten or taken offline. The on-chain revocation is the
part that must not be under the issuer's unilateral control, and it is the only part this standard
puts on-chain.
Why purpose is a registry code and not a free hash. Purpose vocabularies used in practice are
classification systems with parent and child terms, so equality over a hash produces false denials: a grant for
a broad permitted use will not match a request labelled with a narrower one that the ontology says it
permits. This standard therefore specifies coarse equality over registered codes on-chain, with
hierarchy reasoning performed off-chain by the relying party, and requires the registry entry to pin
the ontology release so a code's meaning cannot drift. purposeProfileRef carries the hash of the
full canonical profile, including any parameters, because several widely used modifiers are
parameterized (a disease-specific permission needs a disease, a geographic restriction needs a
region, a time limit needs a duration) and no published vocabulary specifies how the parameter
attaches. This standard specifies it in the Purpose profile paragraph of the Specification, where
the sorted-array rule is a choice made by this standard, not a convention inherited from elsewhere.
Why grants are soulbound. A transferable consent grant is a right of access that can be sold to a
person's data. Consent runs to a named recipient; non-assignment is the property, not a
limitation. Delegation is expressed by attenuated subGrant, which cannot exceed its parent and
cascades on revocation.
Why no per-access event. See Privacy and Data Protection under Security Considerations.
Prior Art
- ERC-5006 gives an ERC-1155 token a time-bounded
userrole. Two-party: the owner grants over their own token. This specification adds the third principal and the purpose. - ERC-4907 is the ERC-721 sibling of the above.
- ERC-8226 delegates scoped, time-bounded, financially capped authority to an
agent, keyed
(agent, principal, target). Its caps are denominated in transfer quantity and itsmetadatafield is a 32-byte pointer that it forbids using for enforcement decisions, so it has no place to put an instrument or a purpose. - ERC-8328 logs subject-linked compliance events and models a subject, a beneficiary and an actor. It is a reporting interface: its records are "attributable assertions, not proof that the reported action occurred or was lawful", and nothing consults its outcomes.
- Entriken and Uribe (2020), "Biosample permission token with non-fungible tokens" set out the
permitter,permiteeand permit model this specification builds on, using ERC-721 to publish permit status and to resolve a permit recursively back to the property owner. It establishes the three-role framing and the public-status requirement. What it does not do is bind a permit to a declared purpose, give the agent an independently revocable leg, or make thepermitter's withdrawal operative for a relying party at access time. - ERC-8004 supplies agent identity. Its
agentIdis an ERC-721 token id andagentWalletis a reserved, signature-verified field. The Specification recommends resolving anEXTERNAL_REGISTRYagent through it rather than defining a parallel agent model. - ERC-6617 defines bit-based permissions. The
opsvalues here are fixed rather than delegated to it because a grant minted by one party is evaluated by another. - World Wide Web Consortium (W3C) Verifiable Credentials 2.0 is the better carrier for the
instrument itself, and this specification treats it as such:
termsRefandpurposeProfileRefare hashes of the versioned templates referenced from a credential's normativetermsOfUse, not hashes of the per-subject credential and not replacements for it. Only revocation status is placed on-chain, because only revocation must be outside the issuer's unilateral control. A status list is fetched from an issuer-controlled endpoint that can be rewritten or taken offline; a consensus-ordered revocation cannot. - ERC-7053 indexes content provenance, and the Ethereum Attestation Service (EAS) attests arbitrary claims, but neither carries a revocable consent that a verifier is required to honor restrictive-wins, and neither reuses a purpose-bound consent domain as the authorship domain.
- C2PA and CAWG. The C2PA and CAWG identity-assertion work carries an author identity into a manifest but has no on-chain revocation a verifier must observe. The novelty the Content Credentials profile adds over that body of work is narrow and specific: a mutual, salted, joint content-and-consent binding whose runtime validity is the restrictive-wins combination of an X.509 credential and a revocable on-chain status.
Backwards Compatibility
This standard introduces no changes to existing token behaviour. It is asset-standard agnostic:
assetContract and assetTokenId may name an ERC-721 or ERC-1155 token, and an implementation can additionally
represent grants as soulbound ERC-1155 tokens in a reserved identifier range; the Grant tokens
paragraph of the Specification states the minting rule for that case. Where a time-boxed user
role over an ERC-1155 asset is all that is required, ERC-5006 is sufficient and this standard is
unnecessary. Where an agent identity and payment account are required, taking agent from an
ERC-8004 identity registry avoids defining a parallel agent model.
Security Considerations
A signed Bind stays usable until its nonce is consumed. A signed Grant carries a deadline. A
signed Bind does not, because bindContent already takes 13 parameters and a 14th would make it
impractical to compile. An attestor who signs a Bind and decides not to submit it should advance
bindNonces(attestor) by binding something else. A signed Bind of a public work is an authorship
claim its author already chose to publish. A signed Bind of a work carrying a subject's data names a
grant and a subjectCommit, and fails once that grant is no longer active.
Enforcement is advisory unless the caller is verified. checkAccess is only as strong as the
implementation's verification of msg.sender. An implementation that accepts an agent address as a
parameter provides no agent authorization at all. The same failure mode appears off-chain: an
eth_call with a client-chosen from does not authenticate the agent. This is stated as a
normative requirement above because it is the most likely implementation error, and it is the
deployment shape the Motivation describes (a data holder checking a grant before release).
A claimed agent identity is not an authenticated one. ASSERTED_UNVERIFIED exists so that an
unproven claim can be recorded honestly rather than disguised as a principal. It does not
satisfy an agent constraint (see Agent verification in the Specification).
Compromised session keys. Where agentKind == SESSION_KEY, the key authenticates a session, not
the software behind it. revokeAgent is the containment primitive, and it is deliberately callable
by the agent and its operator as well as the grantee so that containment does not require the
grantee to be reachable.
Unbounded delegation. maxDepth and the attenuation invariants exist because a delegation chain
without them is privilege escalation. A small maxDepth keeps
isGrantActive cheap.
No reinstatement. A function that flips a revoked grant back to active destroys the property that a revocation is final, and would let an operator undo a withdrawal. Re-granting mints a new identifier so that the history distinguishes the two.
Privacy and Data Protection
The binding privacy requirements are the Privacy rules in the Specification. This subsection explains why they exist and what they leave open.
A hash of a personal identifier remains personal data, and encryption does not remove that status, so the only on-chain reference to the subject is a commitment generated for one grant. The subject commitment is a pseudonym and nothing stronger: it remains personal data while it can be linked to a person, and the erasure argument rests on destroying the key, not on the commitment being free of linkage.
Per-access events are left out for this reason. An event stream keyed to a subject publishes an access-pattern timeline. Access frequency and timing are themselves revealing, and on a permissioned chain with a known participant set they are attributable. The hash-chain-plus-commitment design preserves tamper-evidence and ordering over the records that were appended, while publishing only a periodic head and a count. It does not prove that every access was recorded.
Deployment. Deploying on a permissioned network with an identifiable operator is advisable, because it permits a clear allocation of controller responsibility. On a permissionless network there is a live argument that validators become joint controllers of the personal data in the state and logs they process, which is a materially worse position for the subject and for the operator.
The governing constraint. If a deployment cannot render every on-chain artifact anonymous by deleting off-chain material, then consent may not be an available lawful basis for it in some jurisdictions. Implementers are advised to verify that this holds before relying on consent, rather than after.
subjectCommit is retained in state so subject-authored acts can be authorized without publishing an
account address. The zero-subject profile in the Specification covers deployments with no on-chain
subject authentication.
Copyright
Copyright and related rights waived via CC0.