ERC-8356 Purpose-scoped third-party data consent (Purpose-Bound Third-Party Data Consent)
Draft · Other · created 2026-07-30
A standard that lets a data subject delegate access to information about themselves to a third party, scoped by purpose, duration, and count, while allowing the delegate's authority alone to be revoked separately or the entire consent to be publicly revoked at any time.
Why it is needed
Once consent is granted, data passes through multiple institutions and is processed into multiple forms, but every delegation standard so far has used a two-party structure where an asset owner lends authority over their own asset to someone else. By contrast, in cases like medical information where the person giving consent differs from the person who benefits from that information, the scope of authority must narrow progressively as it is passed along, and it must be possible to switch off only the intermediary standing in between (such as a software agent) independently. Existing standards have no such structure. There is also no standard that enforces purpose in code, and the GA4GH Passport tokens currently used for genomic data access have no revocation list, so access can persist until expiration, and status can only be checked once per hour, meaning that even after consent is withdrawn it takes time before access is actually cut off.
What to implement
event ConsentSubGranted(bytes32 indexed grantId, bytes32 indexed parentGrantId, uint16 depth);: Emitted together after ConsentGranted when a sub-grant is created via subGrant, announcing the parent grant and the delegation depth.event ConsentRevoked(bytes32 indexed grantId, bytes32 indexed by, uint8 status, bytes32 reasonCode);: Emitted whenever a grant transitions to a terminated state, recording who (by) changed it, to what state, and with what reason code.event AgentRevoked(bytes32 indexed grantId, address indexed agent, bytes32 reasonCode);: Emitted when only the agent's authority is cut off via a call to revokeAgent.event ScopeLeafRevoked(bytes32 indexed grantId, bytes32 leaf);: Emitted when consent for a specific resource (leaf) is revoked via revokeScopeLeaf.event GrantSuspended(bytes32 indexed grantId, address indexed by, bytes32 reasonCode);: Emitted when a grant is temporarily suspended via a call to suspend, recording the caller.event GrantResumed(bytes32 indexed grantId, address indexed by);: Emitted when a temporary suspension is lifted via a call to resume.event UsageCommitted(bytes32 indexed grantId, uint64 epoch, bytes32 headHash, uint32 count);: Emitted when the head of an off-chain usage-record hash chain is committed on-chain via commitUsage.function revokeBySubject(bytes32 grantId, bytes32 reasonCode, bytes32 subjectSalt) external;: The subject directly revokes their own grant. It takes effect immediately and unconditionally, and no one can block it.function renounceByGrantee(bytes32 grantId) external;: The grantee voluntarily returns a grant it received.function revokeAgent(bytes32 grantId, bytes32 reasonCode) external;: The grantee, the agent, or the agent operator cuts off only the agent's authority while keeping the grant itself intact.function revokeScopeLeaf(bytes32 grantId, bytes32 leaf, bytes32 subjectSalt) external;: The subject revokes consent for only a single specific resource while keeping the overall grant intact.function suspend(bytes32 grantId, bytes32 reasonCode) external;: The grantee or the agent operator temporarily suspends a grant in order to respond to an incident.function resume(bytes32 grantId) external;: Only the party recorded in suspendedBy can call this to lift the suspension and return the state to ACTIVE.function terminateByIssuer(bytes32 grantId, bytes32 reasonCode) external;: An account with isIssuer set to true ends the grant as part of terminating the program or research itself.function commitUsage(bytes32 grantId, uint64 epoch, bytes32 headHash, uint32 count) external;: Periodically commits the head of an off-chain usage-record hash chain on-chain to reflect the usage count.function isGrantActive(bytes32 grantId) external view returns (bool);: Returns whether current access is valid, taking into account the grant and all its ancestor grants.function effectiveStatus(bytes32 grantId) external view returns (uint8);: Returns a single display status by tracing back through ancestors. isGrantActive must be used to determine actual authorization.function isLeafRevoked(bytes32 grantId, bytes32 leaf) external view returns (bool);: Checks whether the given leaf has been revoked anywhere in this grant or its ancestors.function subjectOf(bytes32 grantId) external view returns (bytes32 subjectCommit);: Returns the grant's subjectCommit value.function nonces(bytes32 subjectCommit) external view returns (uint256);: Returns the current nonce value that the subjectCommit used in its grant call, to prevent replay.function revocationEpoch() external view returns (uint256);: A global counter that increments on every call that could lead to a revocation, signaling when caches should be revalidated.function purposeRegistry() external view returns (address);: Returns the address of the registry contract that resolves purpose codes. A value of 0 means no registry is set.function maxDepth() external view returns (uint16);: Returns the maximum delegation depth this implementation allows.function isIssuer(address account) external view returns (bool);: Checks whether the given account holds issuer authority to call terminateByIssuer.function getGrant(bytes32 grantId) external view returns (ConsentGrant memory);: Reads back all stored fields of a grant. A nonexistent grant returns a struct with every field zeroed.function termOf(uint32 code) external view returns (string memory iri, bytes32 releaseHash);: Returns the ontology term (IRI) that a registered purpose code points to, along with the hash of that ontology release.function isNarrowing(uint32 childCode, uint32 parentCode) external view returns (bool);: Checks whether a child purpose code is registered as a narrowing relation of its parent purpose code.
In depth
A three-party structure: subject, grantee, and agent
This standard divides parties into three: the subject who consents, the grantee who receives access rights, and the agent who can actually exercise those rights on the grantee's behalf. The subject is not the party who benefits. Existing standards like ERC-4907, ERC-5006, and ERC-8226 were all two-party structures in which the asset owner themselves lends out rights, but handling cases such as medical data, where the party who consents differs from the party who benefits, requires a third-party subject concept. Grants are issued against an existing asset token (assetContract, assetTokenId), so the fact of consent is recorded in that asset's history.
The ConsentGrant struct and status values
A grant is stored as a ConsentGrant struct holding the fields scopeRef, purposeProfileRef, termsRef, parentGrantId, assetTokenId, subjectCommit, grantee, notBefore, expiresAt, agent, ops, purposeCode, status, flags, depth, agentKind, agentStatus, suspendedBy, lastUsedAt, useCount, usesMax, usageEpoch, usageCount, agentOperator, and assetContract, using 11 storage slots (0 through 10) in total. status takes one of 7 values: NONE, ACTIVE, REVOKED_BY_SUBJECT, RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER, SUSPENDED, or EXHAUSTED. Input is accepted not as the full ConsentGrant but as a narrower GrantInput struct, because passing the full struct as a function argument would push the ABI decoder past the EVM stack limit and fail to compile.
Creating consent with subjectCommit and an EIP-712 signature
The subject does not leave their address directly on chain. Instead only the commitment subjectCommit = keccak256(abi.encode(subjectSalt, subjectKey)) is left, and subjectSalt carries at least 128 bits of entropy and is never stored or emitted in an event. The grant function allows only (a) a direct call where msg.sender equals subjectKey, or (b) a case where subjectKey has signed EIP-712 typed data named Grant. The nonce consumes the nonces(subjectCommit) value on every grant call to prevent replay, and signatures are no longer accepted once the deadline has passed.
subGrant's attenuation rules
subGrant can only be called by the parent's grantee, and the parent must be an active grant with FLAG_DELEGABLE set. The child's subjectCommit, assetContract, and assetTokenId must match the parent's, ops must be a subset of the parent's, expiresAt cannot be later than the parent's, and notBefore cannot be earlier than the parent's. purposeCode must either match the parent's or be a narrower purpose registered in the registry, and if the parent's usesMax is not 0 (unlimited), the child's must also be nonzero and cannot exceed the parent's value. When scopeRef is a Merkle root, the child's scope must be proven as a leaf under that root via scopeProof, and an unproven child scope must be rejected.
Revocation paths and irreversible states
revokeBySubject can only be called by the subject, takes effect immediately with no conditions, and cannot be blocked by the grantee, issuer, or operator. It must propagate immediately to all sub-grants, but recording every descendant in a single call could exceed the gas limit, so lazy evaluation is permitted and recommended. REVOKED_BY_SUBJECT, RENOUNCED_BY_GRANTEE, TERMINATED_BY_ISSUER, and EXHAUSTED are all terminal states that cannot be reverted back to ACTIVE. The sole exception is returning from SUSPENDED to ACTIVE via resume, which only the party recorded in suspendedBy can call. A subject's revocation is always recorded with priority over any other terminal state.
checkAccess only authenticates an on-chain caller
checkAccess verifies the agent or grantee based on msg.sender. However, calling this function off-chain via eth_call lets the caller set the from value themselves, so it provides no authentication at all. If a client sets from to the agent's address, it can get back true even without actually holding the authorization. So a party judging access off-chain must not use a standalone checkAccess call as proof of identity, and should instead require independent authentication alongside it, such as isGrantActive or effectiveStatus (which do not depend on msg.sender) plus a separate signature. When an on-chain caller goes through checkAccess within the same transaction, it is safe, because msg.sender is the actual EVM caller.
usesMax is not a cryptographic guarantee
Rather than emitting an event for every single access, an off-chain hash chain (h_i = keccak256(h_{i-1}, record_i)) is accumulated, and its head is periodically posted on-chain via commitUsage(grantId, epoch, headHash, count). Only the grantee, or an agent whose agentStatus is ACTIVE, can make this call, and once the cumulative usage count reaches usesMax, the status changes to EXHAUSTED. However, because the party posting the record on-chain is the same party being limited by usesMax, this limit is only a contractual, self-reported bound and not a cryptographically enforced value. There is no external way to detect it if a grantee simply never posts usage records at all.
A proposal still at the Draft stage
ERC-8356 is a proposal in Draft status created on July 30, 2026, and consensus on it has not yet been reached. As the body itself notes, because EIP-712 signing packs 7 fields into a single policy word, wallets have difficulty displaying the signed content to users in readable form. This limitation remains a known issue, and the design of registration authority for the purpose registry, as well as the resourceId used as a Merkle leaf, may vary by implementation. Detailed fields and function signatures may still change going forward.