This proposal defines the FHE Interaction Framework (FHE-IF), a framework for interactions that are computed on fully homomorphically encrypted (FHE) objects: several parties submit, pass on, compute on and update protected objects, and information is released to named audiences on valid authority, under declared trust conditions and with recorded evidence. It is meant for computable confidential interaction, with shared protected state where an activity needs it. Subjects are accounts of any kind; autonomous agents are the main intended users.
FHE-IF defines eight kinds of object: an activity scope, a crypto profile, a key context with its key epochs, a protected object, a policy version with its authorizer, an operation, a disclosure under a disclosure view, and an item of evidence. It defines two flows that are independent of each other. In the first, an operation is requested, admitted, executed on ciphertexts by a party that needs no decryption capability, and accepted, after which its outputs are objects that later operations may use while they stay encrypted. In the second, a disclosure of one object under one view to one audience is requested, authorized, and released by the holders of decryption capability, who check again at the moment of release that the release still stands.
FHE-IF fixes how these objects are identified, bound to each other, authorized, recorded and refused. It does not fix an encryption scheme, parameters, a key generation protocol, a proof system or a place where ciphertexts are stored: those are declared by a profile and a key context, and the same rules apply whatever they declare.
Motivation
Encryption of stored and transmitted data ends where computation starts. A party that is to compute on data is given the data. FHE removes that step: a party computes on ciphertexts and the result is a ciphertext. Execution environments that do this for smart contracts exist, and each has its own handles, access lists and decryption service. What they do not share is a way to say which activity a ciphertext belongs to, who may move that activity forward, what counts as its state, and who may learn which part of it. Several problems repeat:
Protection stops at the asset.ERC-7984 defines confidential balances and transfers and leaves the resolution of its pointers to the implementation. ERC-7627 defines encrypted messages between two accounts, which the recipient decrypts before anything is done with them. Neither covers an interaction in which several parties keep computing on values that nobody decrypts on the way.
Encrypted is taken for correct. A scheme defines that a decryption equals the function of the inputs under stated conditions. It does not show that an executor nobody trusts ran the function it was asked to run. A ciphertext that an executor returns is a claim.
A role is taken for a key. Calling an account an auditor enforces nothing. Whoever holds a whole decryption key decrypts whatever was encrypted under it, on or off any ledger. Whether an account can read depends on where keys and shares are, and a framework that hides this behind role names misstates what it protects.
Privacy is one switch. Activities are called private or public. In practice a client may learn the result and not the losing offers, a finance function a total and not the items, an auditor an approved record, the public that something was concluded. These are different outputs for different audiences, and none of them includes another.
Rules and keys change while work is in flight. A member leaves, a rule is tightened, a key is rotated, an authorization is revoked after a request and before the decryption. Without stated rules, implementations decide differently whether a release still happens, and information that was released cannot be taken back.
Schemes differ and will change. Exact and approximate arithmetic, bits and integers, single keys, shared keys and several keys cannot be mixed by assuming that they agree. A framework has to let them be declared and has to treat “these do not belong together” as a result of its own.
Execution privacy was left open.ERC-8338 separates the encryption of a stored skill package from execution privacy and leaves the latter to later work. Agents that sell the use of a capability, or negotiate, bid and settle with each other, need the part that was left open.
FHE-IF addresses these by making every step of such an interaction answer in full: in which scope, under which rules, with which key context and epoch, on which objects, by whom, with what evidence, and released as which view to whom.
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.
1. Terms and scope
Term
Meaning
Subject
An account: externally owned or a contract.
Activity scope
A declared range of activity: which objects, operations and disclosures belong together, under which rules. It has a controller and a status.
Crypto profile
The semantic contract of one way of computing on protected objects: data semantics, encoding, programs, correctness conditions, limits, security, compatibility.
Key context
An identified key arrangement under one profile: how the key is controlled, who can decrypt, where material is kept, what can be converted.
Key epoch
One period of a key context, with its own public material, access structure and holders.
Holder
An account that holds decryption capability of an epoch, such as a key or a share, and is recorded as such.
Protected object
An input, a state or a result, known to the ledger by a commitment.
Program
What an operation computes, identified by a hash.
Operation
A request to carry out a program on named objects, with what became of it.
Executor
The subject that carries out an operation and submits its result.
Disclosure view
A definition of what a release contains: from which objects, by which program, with which complete output.
Audience
The subject that receives a release, or everybody.
Disclosure
A request to release one object under one view to one audience, with what became of it.
Release
The act by which holders make the content of an object available to an audience.
Evidence
A record of who supports which proposition about which object, operation or disclosure, and by what mechanism.
Authorizer
The contract that answers, for one policy version, whether a subject holds a capability.
Capability
A named power that the authorizer is asked about.
The following are out of scope: encryption schemes and their parameters, key generation and resharing protocols, proof systems, the encoding of ciphertexts, transport between parties, and where ciphertexts are kept.
An organisation, a group or an economic unit is not an object of this framework. One organisation MAY take part in several scopes, one scope MAY span several organisations, and nothing is inherited from an organisation by a scope.
Every time in this framework is a number of seconds since the Unix epoch and is compared with the timestamp of the block in which a call is executed.
Homomorphic evaluation. A scheme in the sense of this framework offers encryption, evaluation of functions on ciphertexts, and decryption by those who hold the capability, such that under the conditions the profile states the decryption of an evaluated ciphertext stands in the stated relation to the function of the decrypted inputs. The relation MAY be exact or approximate. It need not be linear, dimension preserving or of equal cost for every function. An implementation MAY combine homomorphic evaluation with multi-party computation, trusted execution environments and proof systems. It MUST declare, stage by stage, what is visible to whom and on what trust. A stage that is declared as homomorphic evaluation MUST NOT require the party that evaluates to obtain the plaintext of the protected data of that stage. A computation that decrypts inside a trusted environment and computes there is not homomorphic evaluation and MUST NOT be declared as such.
2. Conformance
A registry conforms if it implements IFHEIFRegistry and the rules of sections 3 and 5 to 8. A ledger conforms if it implements IFHEIFLedger and the rules of sections 3 and 9 to 11. An authorizer conforms if it implements IFHEIFAuthorizer. Each of them MUST implement ERC-165 and report its interface.
A backend is everything off the ledger that acts for a role: it encrypts, evaluates, holds shares, contributes to releases. A backend conforms to a profile if it meets the obligations that sections 5, 6, 8 and 9 place on executors, holders and submitters.
An implementation states what it provides in a conformance statement, a document with four parts that are not levels of one another:
Part
States
Base
Which objects, bindings, states and failure semantics of this framework are implemented.
Enforcement
For each action, by what it is enforced: separate keys, threshold shares, a restricted cryptographic capability, a trusted executor, or admission by the ledger only.
Evidence
For each proposition, which mechanisms support it and whether it was verified, declared or not supported.
Records
How disclosures are recorded, who can read the records, whether and how they are anchored, and what the records cannot show.
Declaring a mechanism states that it is used. It rates nothing and MUST NOT be presented as a security level.
3. Identifiers and documents
A well-known identifier is the keccak256 hash of its name. The names of this version are:
The audience of a release to everybody is the address 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF.
An identifier that is not listed MAY be used for classes of objects, programs, mechanisms, reasons and record kinds, formed in the same way from a name in a namespace of the party that defines it.
A document is a JSON object with strings, integers, booleans, arrays and objects. Its hash is the keccak256 hash of its canonical form under RFC 8785. Documents are published by whoever declares them; the registry and the ledger hold their hashes.
Identifiers of objects are derived, so that any party can compute them before a transaction is sent. With abi.encode and abi.encodePacked as in Solidity:
The EIP-712 digest of the operation request under the domain of the ledger.
Disclosure
The EIP-712 digest of the disclosure request under the domain of the ledger.
4. Types
/// @notice Status of an activity scope.
enumScopeStatus{NONE,ACTIVE,PAUSED,CLOSED}/// @notice Status of one key epoch of a key context.
/// ACTIVE accepts inputs, operation outputs and disclosures. RETIRED accepts no new objects;
/// objects already accepted under it may still be disclosed or converted. REVOKED accepts nothing.
enumEpochStatus{NONE,ACTIVE,RETIRED,REVOKED}/// @notice What a new key epoch declares about objects of the epoch before it.
/// RETAIN keeps them under the earlier epoch. CONVERT permits operations that take inputs of the
/// earlier epoch and produce outputs of the new one. RESET revokes the earlier epoch.
enumCarryOver{NONE,RETAIN,CONVERT,RESET}/// @notice What a policy version lets later versions do with objects accepted under it.
/// NARROW_ONLY: a later version can only take authority away. GOVERN: a later version decides alone.
enumSuccessorRight{NARROW_ONLY,GOVERN}enumObjectOrigin{NONE,INPUT,OUTPUT}enumObjectStatus{NONE,PROPOSED,ACCEPTED,REJECTED}enumOperationStatus{NONE,ADMITTED,RESULT_SUBMITTED,ACCEPTED,REJECTED,FAILED,CANCELLED,EXPIRED}enumDisclosureStatus{NONE,REQUESTED,AUTHORIZED,RELEASED,REFUSED,EXPIRED}/// @notice A crypto profile: the semantic contract of one way of computing on protected objects.
structProfile{bytes32descriptorHash;bytes32evaluationClass;addressregistrant;uint64registeredAt;}/// @notice A key context. Its key material, access structure and holders are those of its epochs.
structKeyContext{bytes32profileId;addresscontroller;bytes32descriptorHash;uint32currentEpoch;}/// @notice What is declared when a key epoch is opened.
structEpochInit{bytes32materialHash;bytes32accessHash;uint16releaseQuorum;address[]holders;}structKeyEpoch{bytes32materialHash;bytes32accessHash;uint16releaseQuorum;uint16holderCount;EpochStatusstatus;CarryOvercarryOver;uint64openedAt;}structPolicyInit{bytes32policyHash;addressauthorizer;SuccessorRightsuccessorRight;}structPolicy{bytes32policyHash;addressauthorizer;SuccessorRightsuccessorRight;uint64activatedAt;}structScope{addresscontroller;bytes32descriptorHash;bytes32recordMode;uint64policyVersion;ScopeStatusstatus;}/// @notice A disclosure view: what a release under it contains, and from what it is computed.
structViewDefinition{bytes32scopeId;bytes32programHash;bytes32outputHash;bytes32keyContextId;uint64policyVersion;boolretired;bytes32[]inputClasses;}structInputSubmission{bytes32scopeId;bytes32keyContextId;uint32keyEpoch;bytes32classId;bytes32commitment;stringlocator;}structOutputSubmission{bytes32commitment;stringlocator;}structProtectedObject{bytes32scopeId;bytes32keyContextId;uint32keyEpoch;bytes32classId;bytes32viewId;bytes32commitment;bytes32originId;addresssubmitter;uint64policyVersion;ObjectOriginorigin;ObjectStatusstatus;}/// @notice An operation request. Its EIP-712 digest is the operation identifier.
structOperationRequest{bytes32scopeId;uint64policyVersion;bytes32keyContextId;uint32inputEpoch;uint32outputEpoch;bytes32programHash;bytes32viewId;bytes32outputClass;bytes32[]inputs;addressrequester;addressexecutor;uint256nonce;uint64validUntil;}structOperation{OperationRequestrequest;OperationStatusstatus;addresssubmittedBy;bytes32[]outputs;}/// @notice A disclosure request. Its EIP-712 digest is the disclosure identifier.
structDisclosureRequest{bytes32scopeId;bytes32objectId;bytes32viewId;bytes32keyContextId;uint32keyEpoch;uint64policyVersion;addressaudience;bytes32deliveryKeyHash;addressrequester;uint256nonce;uint64validAfter;uint64validUntil;}structDisclosure{DisclosureRequestrequest;DisclosureStatusstatus;uint16approvalsRequired;uint16approvals;uint16attestations;}/// @notice One piece of evidence: who supports which proposition about which subject, and how.
structEvidence{bytes32proposition;bytes32mechanism;addressattester;bytes32payloadHash;uint64recordedAt;}structAnchor{bytes32scopeId;bytes32recordKind;addressanchoredBy;uint64anchoredAt;}/// @notice Well-known identifiers. Each is the keccak256 hash of the string shown.
libraryFHEIF{// Evaluation classes of a profile.
bytes32internalconstantEVAL_HOMOMORPHIC=keccak256("fheif.evaluation.homomorphic");bytes32internalconstantEVAL_MIXED=keccak256("fheif.evaluation.mixed");bytes32internalconstantEVAL_TEST_ONLY=keccak256("fheif.evaluation.test-only");// Record modes of a scope.
bytes32internalconstantRECORD_OPEN=keccak256("fheif.record.open");bytes32internalconstantRECORD_COMMITTED=keccak256("fheif.record.committed");// Capabilities resolved by the authorizer of a policy version.
bytes32internalconstantCAP_SUBMIT_INPUT=keccak256("fheif.capability.submit-input");bytes32internalconstantCAP_REQUEST_OPERATION=keccak256("fheif.capability.request-operation");bytes32internalconstantCAP_EXECUTE_OPERATION=keccak256("fheif.capability.execute-operation");bytes32internalconstantCAP_ACCEPT_RESULT=keccak256("fheif.capability.accept-result");bytes32internalconstantCAP_REQUEST_DISCLOSURE=keccak256("fheif.capability.request-disclosure");bytes32internalconstantCAP_RECEIVE_VIEW=keccak256("fheif.capability.receive-view");bytes32internalconstantCAP_APPROVE_DISCLOSURE=keccak256("fheif.capability.approve-disclosure");bytes32internalconstantCAP_ANCHOR_RECORD=keccak256("fheif.capability.anchor-record");// The program of a view that releases an object as it is.
bytes32internalconstantPROGRAM_IDENTITY=keccak256("fheif.program.identity");// The audience of a release that is open to everybody.
addressinternalconstantAUDIENCE_PUBLIC=0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;// Propositions an item of evidence can support.
bytes32internalconstantPROP_INPUT_WELL_FORMED=keccak256("fheif.proposition.input-well-formed");bytes32internalconstantPROP_INPUT_CONSTRAINT=keccak256("fheif.proposition.input-constraint");bytes32internalconstantPROP_OPERATION_CORRECT=keccak256("fheif.proposition.operation-correct");bytes32internalconstantPROP_DECRYPTION_CORRECT=keccak256("fheif.proposition.decryption-correct");bytes32internalconstantPROP_DISCLOSURE_AUTHORIZED=keccak256("fheif.proposition.disclosure-authorized");bytes32internalconstantPROP_BUSINESS_ACCEPTED=keccak256("fheif.proposition.business-accepted");// Mechanisms by which a proposition is supported.
bytes32internalconstantMECH_NONE=keccak256("fheif.mechanism.none");bytes32internalconstantMECH_SELF_DECLARED=keccak256("fheif.mechanism.self-declared");bytes32internalconstantMECH_REEXECUTION=keccak256("fheif.mechanism.re-execution");bytes32internalconstantMECH_COMMITTEE=keccak256("fheif.mechanism.committee");bytes32internalconstantMECH_ZK_PROOF=keccak256("fheif.mechanism.zk-proof");bytes32internalconstantMECH_TEE_ATTESTATION=keccak256("fheif.mechanism.tee-attestation");bytes32internalconstantMECH_OPTIMISTIC_CHALLENGE=keccak256("fheif.mechanism.optimistic-challenge");bytes32internalconstantMECH_DESIGNATED_VERIFIER=keccak256("fheif.mechanism.designated-verifier");bytes32internalconstantMECH_LEDGER_STATE=keccak256("fheif.mechanism.ledger-state");// Reasons given when an operation fails or a request can no longer proceed.
bytes32internalconstantREASON_UNSUPPORTED=keccak256("fheif.reason.unsupported");bytes32internalconstantREASON_INCOMPATIBLE=keccak256("fheif.reason.incompatible");bytes32internalconstantREASON_UNDETERMINABLE=keccak256("fheif.reason.undeterminable");bytes32internalconstantREASON_RESOURCE=keccak256("fheif.reason.resource");bytes32internalconstantREASON_EXPIRED=keccak256("fheif.reason.expired");bytes32internalconstantREASON_NOT_YET_VALID=keccak256("fheif.reason.not-yet-valid");bytes32internalconstantREASON_SCOPE_PAUSED=keccak256("fheif.reason.scope-paused");bytes32internalconstantREASON_SCOPE_CLOSED=keccak256("fheif.reason.scope-closed");bytes32internalconstantREASON_POLICY_SUPERSEDED=keccak256("fheif.reason.policy-superseded");bytes32internalconstantREASON_EPOCH_NOT_USABLE=keccak256("fheif.reason.epoch-not-usable");bytes32internalconstantREASON_VIEW_RETIRED=keccak256("fheif.reason.view-retired");bytes32internalconstantREASON_NOT_AUTHORIZED=keccak256("fheif.reason.not-authorized");// Kinds of record that can be anchored by commitment.
bytes32internalconstantKIND_DISCLOSURE_RECORD=keccak256("fheif.record-kind.disclosure");bytes32internalconstantKIND_BATCH_ROOT=keccak256("fheif.record-kind.batch-root");}
5. Crypto profiles
A profile is registered by its descriptor hash and an evaluation class. Anybody MAY register a profile. A registered profile never changes; a changed descriptor is another profile.
The evaluation class is one of:
Class
Meaning
fheif.evaluation.homomorphic
Every operation under the profile is homomorphic evaluation in the sense of section 1.
fheif.evaluation.mixed
Some stages are not. The descriptor MUST list the stages and mark each one in which protected data is visible in plaintext, with the party it is visible to and the trust it rests on.
fheif.evaluation.test-only
The profile protects nothing. It exists to exercise flows. A consumer MUST NOT treat objects of such a profile as confidential.
A profile descriptor MUST state:
Dimension
Content
Data semantics
Exact or approximate; the type of values; encoding, scaling and packing; the range of inputs; behaviour on overflow and reduction; for approximate values, what an error means.
Programs
Which operations are supported and how a program, circuit or model version is identified.
Correctness conditions
For which inputs, parameters and extent of computation the stated relation holds; what is known about the probability of failure or the confidence of an error bound. These are stated apart from data semantics: an exact scheme can fail to decrypt correctly, and an approximate one can give a bound that holds with a stated probability.
Limits
Depth, resources, time, and what refresh or conversion is available.
Security
Parameters; the attack model they are chosen for; the model under which decrypted results may be released and the protection that model requires; whether inputs are proven well formed; whether an output hides how it was computed.
Compatibility
Which keys, parameters, encodings and versions of an implementation can be combined.
Evidence
For each proposition of section 9.5 that the profile supports, the mechanism, what is compared, and when two results count as the same.
The following rules apply to every backend:
An object, key or request of a profile that a party does not know MUST be recognised as unknown and refused.
Objects of different profiles, key contexts or key epochs MUST NOT be treated as compatible unless a conversion is declared for them. A conversion needs a declared mechanism, an authorization and stated semantics.
A backend MUST NOT fall back to a weaker protection without failing.
Where a party cannot determine whether a protected operation is supported or was carried out correctly, the result is “unsupported” or “undeterminable”. It is never a success.
A failure that is detected is reported as a failure. A profile MUST NOT claim that every incorrect result is detected unless it states the mechanism that detects it.
A profile distinguishes three sources of error and MUST NOT present one as covering another: the difference between an original model or function and the program it was turned into, the error of the encrypted computation itself, and the error of the model with respect to the world. Evidence that a program was carried out says nothing about the other two.
6. Key contexts and key epochs
A key context is identified, has a controller and belongs to one profile. A number of an epoch alone identifies nothing: a reference to key material is always the pair of key context and epoch.
A key context descriptor MUST state, as four separate things that can be combined freely:
Dimension
Examples
Control of the key
Generated by one party; generated jointly so that no party holds the whole key; generated in a trusted environment.
Access structure of decryption
One holder; all of n holders; t of n holders; a structure with several keys in which each input has its own.
Custody and execution environment
Holders keep their own shares; a service keeps the shares; shares are kept in trusted environments.
Conversion
None; key switching between named epochs; re-encryption towards a named recipient key.
A descriptor MUST state by what each boundary it claims is enforced. Two different numbers of approvals or of holders written into a policy over one key give no different cryptographic thresholds: where a difference is claimed, the descriptor MUST say whether it rests on separate key contexts, on a special access structure or on the policy of a service. A structure in which one key can derive another exists only where the profile declares the construction; it is never assumed.
Key material is of five kinds, and holding one implies nothing about another:
Material
Used to
Is not
Signing key of a subject
Show who made a request or gave an authorization.
A capability to decrypt.
Public encryption key
Put an input under a key context.
A right to read.
Evaluation material
Carry out the declared operations and conversions.
A decryption key.
Decryption key or share
Decrypt alone or together with others.
The rules about who may ask for a release.
Delivery key of an audience
Receive what a release makes available to that audience only.
A capability to decrypt anything else.
Public keys and evaluation material that the profile allows to be public MAY be published. A decryption key or a share MUST NOT be published in the clear. Where and how sealed secret material is kept is stated by the descriptor.
Epochs. An epoch has a material hash, an access hash, a set of holders, a release quorum and a status:
Status
New inputs and outputs
Release of its objects
Input to a declared conversion
ACTIVE
yes
yes
no
RETIRED
no
yes
yes
REVOKED
no
no
no
Opening an epoch declares what becomes of the objects of the epoch before it: RETAIN (they stay under the earlier epoch, which is retired), CONVERT (as RETAIN, and operations that take inputs of the earlier epoch and produce outputs of the new one are admitted), or RESET (the earlier epoch is revoked). Incrementing a number is not a rotation: a new epoch MUST carry the hash of its own material and its own holders, and a backend MUST generate that material anew.
The following are separate and change independently of each other: the key epoch, the policy version, the source of membership or qualification that an authorizer reads, and time. Adding a subject that may receive one view does not require a new epoch.
A subject that controls a scope, a subject that controls a key context and a holder are three roles. None implies another. A subject that takes part in the activity of a scope is not thereby a holder, and a holder that leaves the activity keeps the shares of the epochs it was a holder of. That a subject can no longer read later objects is true only from an epoch whose material was generated without it.
7. Scopes, policy versions and capabilities
A scope has a controller, a descriptor, a record mode, a current policy version and a status: ACTIVE, PAUSED or CLOSED. A closed scope does not reopen. A scope admits the key contexts whose objects it accepts; a key context MAY be admitted by several scopes and a scope MAY admit several key contexts.
The descriptor of a scope MUST declare what the scope exposes, surface by surface: who takes part; inputs; intermediate state; outputs; programs and models; timing, counts and the linkage of requests; and in which form anything public is public. A single statement that a scope is private is not a declaration. Fields of ledger records are public; a scope that needs them hidden MUST use the committed record mode of section 9.6 or a mechanism it names, and MUST NOT rely on a label.
Policy versions. A policy version consists of the hash of a policy document, the address of an authorizer and a successor right. The controller of a scope activates the next version. Earlier versions remain readable.
An object is bound, when it is accepted, to the policy version in force. For authority over an object that was accepted under an earlier version:
if that earlier version has the successor right NARROW_ONLY, a subject holds a capability only if the authorizer of the earlier version and the authorizer of the current version both say so, and the number of approvals a release needs is the higher of the two;
if it has the successor right GOVERN, the current version decides alone.
A later version therefore cannot widen who may compute on, request or receive what was accepted before it, unless the version under which it was accepted reserved that from the start. A new authorization that the rules of the earlier version provide for remains possible, because the authorizer of the earlier version gives it.
Capabilities. The ledger asks the authorizer of a policy version whether a subject holds a capability with respect to a class of objects and a resource:
Capability
Asked when
Resource
fheif.capability.submit-input
an input is registered
zero
fheif.capability.request-operation
an operation is requested, once for every input
program hash
fheif.capability.execute-operation
a result is submitted or a failure is reported
program hash
fheif.capability.accept-result
a result is accepted or rejected
program hash
fheif.capability.request-disclosure
a disclosure is requested, and again at release
view identifier
fheif.capability.receive-view
a disclosure is requested, and again at release; asked of the audience
view identifier
fheif.capability.approve-disclosure
a disclosure is approved or refused
view identifier
fheif.capability.anchor-record
a commitment is anchored
record kind
No capability includes another. Controlling a scope, controlling a key context, being a holder, executing, approving and receiving are separate. Reading is always expressed as a view over a class of objects; an output of one round that becomes an input of the next does not change who may read it.
An identity, a credential, a membership, a listing or a decision of a group MAY be what an authorizer reads to reach its answer. None of them is a capability by itself, and none of them gives decryption capability.
What is public needs no capability to be observed or verified. The capability to execute concerns what the ledger admits. Where evaluation material is public, anybody can compute on ciphertexts off the ledger, and this framework does not claim otherwise; only an admitted and accepted result is an object of the scope.
An authorizer that lets a capability be passed on MUST allow it only in a form that is the same or narrower, and MUST refuse where it cannot decide that the form is narrower.
/// @title FHE Interaction Framework: authorizer of a policy version
/// @notice Answers, for one policy version of one scope, whether a subject holds a capability.
/// How the answer is reached (a table of grants, a membership list, a credential, a proof, a
/// decision of a group) is the authorizer's own business. The ledger asks and never assumes.
interfaceIFHEIFAuthorizer{/// @notice Whether `subject` holds `capability` over objects of `classId` with respect to `resource`.
/// @param scopeId The activity scope.
/// @param policyVersion The policy version the answer is given for.
/// @param subject The account asked about. For a release open to everybody it is the public audience address.
/// @param capability One of the capability identifiers.
/// @param classId The class of the object concerned, or zero when no object is concerned.
/// @param resource The program hash for operation capabilities, the view identifier for disclosure
/// capabilities, the record kind for anchoring, or zero.
functionisAuthorized(bytes32scopeId,uint64policyVersion,addresssubject,bytes32capability,bytes32classId,bytes32resource)externalviewreturns(bool);/// @notice How many separate approvals a release of `viewId` over an object of `classId` to
/// `audience` needs before it is authorized. Zero means none.
functionrequiredApprovals(bytes32scopeId,uint64policyVersion,bytes32classId,bytes32viewId,addressaudience)externalviewreturns(uint256);}
Registry interface.
/// @title FHE Interaction Framework: registry of profiles, key contexts, scopes and views
interfaceIFHEIFRegistry{eventProfileRegistered(bytes32indexedprofileId,bytes32descriptorHash,bytes32indexedevaluationClass,addressindexedregistrant,stringuri);eventKeyContextCreated(bytes32indexedkeyContextId,bytes32indexedprofileId,addressindexedcontroller,bytes32descriptorHash,stringuri);eventKeyContextControlTransferred(bytes32indexedkeyContextId,addressindexedprevious,addressindexednext);eventEpochOpened(bytes32indexedkeyContextId,uint32indexedepoch,bytes32materialHash,bytes32accessHash,uint16releaseQuorum,address[]holders,CarryOvercarryOver);eventEpochStatusChanged(bytes32indexedkeyContextId,uint32indexedepoch,EpochStatusstatus);eventScopeCreated(bytes32indexedscopeId,addressindexedcontroller,bytes32descriptorHash,bytes32recordMode,stringuri);eventScopeControlTransferred(bytes32indexedscopeId,addressindexedprevious,addressindexednext);eventScopeStatusChanged(bytes32indexedscopeId,ScopeStatusstatus);eventPolicyActivated(bytes32indexedscopeId,uint64indexedversion,bytes32policyHash,addressindexedauthorizer,SuccessorRightsuccessorRight);eventKeyContextAdmitted(bytes32indexedscopeId,bytes32indexedkeyContextId);eventKeyContextDismissed(bytes32indexedscopeId,bytes32indexedkeyContextId);eventViewDefined(bytes32indexedviewId,bytes32indexedscopeId,bytes32indexedprogramHash,bytes32outputHash,bytes32keyContextId,bytes32[]inputClasses,uint64policyVersion);eventViewRetired(bytes32indexedviewId);errorZeroValue();errorAlreadyExists(bytes32id);errorUnknownProfile(bytes32profileId);errorUnknownKeyContext(bytes32keyContextId);errorUnknownEpoch(bytes32keyContextId,uint32epoch);errorUnknownScope(bytes32scopeId);errorUnknownView(bytes32viewId);errorNotController(addresscaller);errorInvalidHolders();errorInvalidCarryOver();errorInvalidEpochStatus(EpochStatusstatus);errorInvalidScopeStatus(ScopeStatusstatus);errorKeyContextNotAdmitted(bytes32scopeId,bytes32keyContextId);// Profiles
/// @notice Registers a crypto profile. The identifier binds the descriptor to its evaluation class.
functionregisterProfile(bytes32descriptorHash,bytes32evaluationClass,stringcalldatauri)externalreturns(bytes32profileId);functionprofileOf(bytes32profileId)externalviewreturns(Profilememory);// Key contexts
/// @notice Creates a key context under `profileId` and opens its first epoch. The caller controls it.
functioncreateKeyContext(bytes32salt,bytes32profileId,bytes32descriptorHash,stringcalldatauri,EpochInitcalldatafirstEpoch)externalreturns(bytes32keyContextId);/// @notice Opens the next epoch. The epoch before it becomes RETIRED, or REVOKED under RESET.
functionopenEpoch(bytes32keyContextId,EpochInitcalldatainit,CarryOvercarryOver)externalreturns(uint32epoch);/// @notice Revokes an ACTIVE or RETIRED epoch. Nothing proceeds under a revoked epoch.
functionrevokeEpoch(bytes32keyContextId,uint32epoch)external;functiontransferKeyContextControl(bytes32keyContextId,addressnext)external;functionkeyContextOf(bytes32keyContextId)externalviewreturns(KeyContextmemory);functionepochOf(bytes32keyContextId,uint32epoch)externalviewreturns(KeyEpochmemory);/// @notice Whether `account` may attest releases under `epoch`.
functionisHolder(bytes32keyContextId,uint32epoch,addressaccount)externalviewreturns(bool);// Scopes and policy versions
/// @notice Creates an activity scope with its first policy version. The caller controls it.
functioncreateScope(bytes32salt,bytes32descriptorHash,stringcalldatauri,bytes32recordMode,PolicyInitcalldatafirstPolicy)externalreturns(bytes32scopeId);/// @notice Activates the next policy version of a scope.
functionupdatePolicy(bytes32scopeId,PolicyInitcalldatanext)externalreturns(uint64version);functionpauseScope(bytes32scopeId)external;functionresumeScope(bytes32scopeId)external;/// @notice Closes a scope. A closed scope does not reopen.
functioncloseScope(bytes32scopeId)external;functiontransferScopeControl(bytes32scopeId,addressnext)external;functionadmitKeyContext(bytes32scopeId,bytes32keyContextId)external;functiondismissKeyContext(bytes32scopeId,bytes32keyContextId)external;functionscopeOf(bytes32scopeId)externalviewreturns(Scopememory);functionpolicyOf(bytes32scopeId,uint64version)externalviewreturns(Policymemory);functionisKeyContextAdmitted(bytes32scopeId,bytes32keyContextId)externalviewreturns(bool);// Disclosure views
/// @notice Defines a disclosure view of a scope. The identifier is derived from every argument.
functiondefineView(bytes32scopeId,bytes32programHash,bytes32outputHash,bytes32keyContextId,bytes32[]calldatainputClasses)externalreturns(bytes32viewId);/// @notice Retires a view. No release proceeds under a retired view.
functionretireView(bytes32viewId)external;functionviewOf(bytes32viewId)externalviewreturns(ViewDefinitionmemory);}
8. Disclosure views
Who may learn what is expressed first as an output and then as a release of that output. A disclosure view is defined by the controller of a scope and binds:
the scope and the policy version at definition;
the range of inputs, as classes of objects;
the program, by hash;
the complete output, by the hash of a view output document that states the layout, what the output contains, what it leaves out and, for approximate values, its precision;
the key context.
The audience, conditions and validity of a release are not part of a view. They are bound by the authorization and by the disclosure request. “Public” is an audience, not a form of output: the same view can be released to one subject or to everybody.
A view is realised in one of two ways:
Computed view. An operation names the view. Its program MUST be the program of the view and every input MUST be of a class in the range of the view. Its accepted output is an object that carries the view identifier, and only such an object can be released under the view.
Identity view. The program of the view is fheif.program.identity. An accepted object of a class in the range of the view can be released under it as it is.
The identity view is a view like any other. No subject holds it by rank: the controller of a scope and the controller of a key context have it only if the authorizer says so.
A release makes available one whole object. A view therefore bounds everything its audience can decrypt:
A backend MUST NOT deliver to an audience contributions for an object that holds more than the output the view states and rely on the audience or on a user interface to show less.
Where a scheme packs several values into one ciphertext, the positions outside the stated layout of a view output MUST be cleared, isolated or re-encapsulated as the profile states, so that they carry nothing of the inputs.
A permitted output can reveal an input. A view whose program is chosen by the requester can be the identity, and sums that differ in one input give that input. A policy that allows a view SHOULD bound which views exist over a class, who may receive them, how often, and under which conditions of aggregation; a limit on the information released over several requests MAY be declared as part of a policy.
9. Objects, operations, disclosures, evidence and records
9.1 Protected objects
An object is known to the ledger by a commitment to its content. This framework does not require a ciphertext to be on the ledger and does not forbid it: where an object is obtained, how long it is available and how its integrity is checked against the commitment are stated by the profile. A party MUST check an object against its commitment before it uses it.
An input is registered by a subject that holds the capability for its class, under an admitted key context and an ACTIVE epoch, and is accepted on registration. An output is proposed when a result is submitted and becomes accepted when the result is accepted. Only an accepted object can be an input of an operation or the object of a disclosure. An accepted object stays bound to its scope, key context, key epoch, class, view and policy version.
9.2 Operations
An operation is identified before it is computed. Its request binds the scope, the policy version, the key context, the epoch of its inputs and of its outputs, the program, the view if its output is a view output, the class of its outputs, its inputs, the requester, the executor or zero for any authorized executor, a nonce and the time until which it is valid.
A ledger MUST admit a request only if all of the following hold, and MUST revert otherwise:
the identifier was not used before;
the scope is ACTIVE, the named policy version is the current one and the time of validity has not passed;
the key context is admitted by the scope and the epoch of the outputs is ACTIVE;
the epoch of the inputs equals that of the outputs, or the epoch of the outputs directly follows it, was opened with CONVERT, and the epoch of the inputs is RETIRED;
a named view belongs to the scope, is not retired, has the named key context and the named program;
every input is accepted, belongs to the scope, and has the named key context and input epoch; and, where a view is named, a class in its range;
the requester holds fheif.capability.request-operation for the program over every input, under the rule of section 7 for objects of earlier versions.
Status
Reached by
Meaning
ADMITTED
request
The ledger admitted the request. Nothing was computed.
RESULT_SUBMITTED
the executor
Outputs were proposed. They are a claim of the executor.
ACCEPTED
a subject with fheif.capability.accept-result
The outputs are objects of the scope.
REJECTED
the same capability
The outputs are rejected.
FAILED
the executor
The executor reports, with a reason, that it cannot carry the operation out.
CANCELLED
the requester, before a result
The request is withdrawn.
EXPIRED
anybody
The operation can no longer be completed: its time passed, its scope closed, its policy version was superseded, or its output epoch is no longer ACTIVE.
Submitting a result and accepting it need the scope to be ACTIVE, the policy version of the request to be current, the time of validity not to have passed and the output epoch to be ACTIVE. An operation in flight when a policy version is superseded cannot be completed and is requested again under the new version. A pause holds an operation and a resume lets it continue.
An executor MUST act only on an operation that the ledger admitted, MUST carry out the program the request names on the objects it names, and MUST report a failure where it cannot. That a result was submitted says nothing about its correctness; what an acceptor requires before it accepts is stated by the policy and supported by evidence.
9.3 Disclosures
A disclosure request binds the scope, the object, the view, the key context and epoch of the object, the policy version, the audience, the hash of the delivery key of the audience or zero, the requester, a nonce, and the times from which and until which it is valid.
A ledger in the open record mode MUST record a request only if all of the following hold, and MUST revert otherwise:
the identifier was not used before;
the scope is ACTIVE, its record mode is open, the named policy version is the current one, and the time until which the request is valid has not passed;
the object is accepted, belongs to the scope, and has the named key context and epoch, and that epoch is ACTIVE or RETIRED;
the view belongs to the scope, is not retired and has the key context of the object; and the object carries the view identifier, or the view is an identity view and the class of the object is in its range;
the requester holds fheif.capability.request-disclosure and the audience holds fheif.capability.receive-view for the view over the class of the object, under the rule of section 7 for objects of earlier versions.
A request that binds another object, scope, key context, epoch, view or policy version than the one it is used for is a different request. A holder MUST NOT contribute to a decryption of anything but the object of a recorded disclosure, and MUST NOT treat a ciphertext as legitimate because it can be loaded or decrypted.
Status
Reached by
Meaning
REQUESTED
request, where approvals are required
Waits for approvals.
AUTHORIZED
request where none are required, or the last required approval
Holders may attest.
RELEASED
the attestation that completes the release quorum of the epoch
Final. Never changed. Holders contribute from here on.
REFUSED
a subject with fheif.capability.approve-disclosure; or anybody, once the request can never be released
Final.
EXPIRED
anybody, after the time until which the request was valid
Final.
The number of approvals a release needs is given by the authorizer. An approval is given by a subject that holds fheif.capability.approve-disclosure. Approving a release, controlling a key context and holding a share are three powers.
Release. A holder attests on the ledger that it will contribute. The ledger MUST refuse an attestation unless, in the block of the attestation:
the disclosure is AUTHORIZED;
the scope is ACTIVE and the policy version of the request is current;
the epoch is ACTIVE or RETIRED, the key context is admitted and the view is not retired;
the time is within the validity of the request;
the requester and the audience still hold their capabilities;
the caller is a holder of the epoch of the object and has not attested before.
Authority is thus checked at the release, by every holder, and not only at the request. A revocation, an expiry, a retired view, a revoked epoch, a superseded policy version or a closed scope that comes after the request and before the quorum ends the release; a pause holds it. Since no holder contributes before the quorum is complete, such an event leaves the audience with nothing. A request that was approved, a contribution that was computed, a delivery that reached the audience and content that the audience read are different facts, and a record states only the one it shows.
A holder:
MUST NOT contribute before the disclosure is RELEASED, that is, before the attestation that completes the release quorum of the epoch is included; its own attestation is not enough. It SHOULD wait until that block is final under the rule the scope declares, since a reorganisation changes the ledger and does not make released content unknown again;
MUST NOT contribute to a disclosure that is REFUSED or EXPIRED, whether or not it attested;
MUST deliver its contribution so that only the audience of the request can use it, to the delivery key the request committed to; for a release to everybody it MAY publish it;
MUST apply the protection the profile requires for released results.
What was released stays released. A revocation ends requests that were not yet released, and later objects where a later epoch excludes a subject. It does not recall content, and it does not remove a share or a key from whoever holds it.
9.4 Signed requests
A request MAY be submitted by its requester or by anybody together with a signature of the requester over the EIP-712 typed data of the request. The domain has the name FHE Interaction Framework, the version 1, the chain identifier and the address of the ledger. The types are:
EIP-712 gives no protection against replay. In this framework the digest is the identifier of the request, a ledger MUST refuse an identifier that was used, the domain binds the request to one ledger on one chain, and the request carries its own validity.
For a requester that is a contract, the ledger MUST verify the signature through ERC-1271. The answer of a contract can depend on its state and on time, so two cases are kept apart:
A signature that carries a request that is not yet admitted is verified when it is submitted, against the signer as it is then.
A request that was admitted stands by the record of the ledger. It is not verified against the signer again, and it ends by its own validity and by the rules of sections 9.2 and 9.3.
9.5 Evidence
Evidence is recorded per proposition. A record names its subject, a proposition, a mechanism, the attester, a hash of the supporting material and the time.
Proposition
States
fheif.proposition.input-well-formed
An input has the form the profile requires.
fheif.proposition.input-constraint
An input satisfies a stated constraint, such as a range or an eligibility.
fheif.proposition.operation-correct
The outputs are the named program applied to the named inputs.
fheif.proposition.decryption-correct
Released content stands in the declared relation to the object.
fheif.proposition.disclosure-authorized
A release complied with the policy in force.
fheif.proposition.business-accepted
A consumer accepts a result by its own rules.
Mechanisms are open. This version names: none, self-declared, re-execution, committee, zero-knowledge proof, attestation of a trusted execution environment, optimistic challenge, designated verifier, and the state of the ledger itself.
One subject MAY carry several records, for several propositions and by several mechanisms. There is no single flag that states that something is verified, and a ledger MUST NOT derive one.
A statement that there is no evidence, and a self-declaration, are recorded as what they are. They MUST NOT be presented as a verification.
Recording evidence changes no state of an operation or a disclosure.
A profile that names re-execution MUST state what is compared and when two results are the same. Equal bytes of ciphertexts are such a rule only where the profile establishes that a correct evaluation is deterministic.
A profile that names optimistic challenge MUST state what a challenger can obtain, how a challenge is raised and decided, and the period. A release that depends on the outcome of a challenge waits for it; a later dispute does not recall a release.
9.6 Records and anchors
A disclosure that happens through this framework MUST leave a record that can be authenticated and that binds the authorization to the object, the view and the audience. Where the record is kept, who can read it and how it is anchored are declared by the scope:
Open record mode. Requests, approvals, attestations and releases are records of the ledger, with their accounts and identifiers.
Committed record mode. Records are kept off the ledger by the parties and the bodies that audit them. The ledger holds commitments. A ledger MUST refuse open disclosure requests in a scope of this mode.
A commitment to one record is keccak256(abi.encode(recordHash, salt)) with a salt of 32 random bytes. A commitment to a batch is the root of a tree of such commitments, in which a parent is the keccak256 hash of its two children in ascending order. A record whose content can be guessed MUST NOT be committed without a salt.
That a record was committed does not show that every decryption was recorded. Open records disclose who takes part with whom, who audits whom and which activities share participants, although they hold no plaintext.
Ledger interface.
/// @title FHE Interaction Framework: ledger of protected objects, operations, disclosures and evidence
interfaceIFHEIFLedger{eventInputSubmitted(bytes32indexedobjectId,bytes32indexedscopeId,addressindexedsubmitter,bytes32classId,bytes32keyContextId,uint32keyEpoch,bytes32commitment,stringlocator);eventOperationAdmitted(bytes32indexedoperationId,bytes32indexedscopeId,addressindexedrequester,bytes32programHash,bytes32viewId);eventResultSubmitted(bytes32indexedoperationId,addressindexedexecutor,bytes32[]outputs);eventOutputProposed(bytes32indexedobjectId,bytes32indexedoperationId,bytes32commitment,stringlocator);eventResultAccepted(bytes32indexedoperationId,addressindexedacceptedBy);eventResultRejected(bytes32indexedoperationId,addressindexedrejectedBy,bytes32reason);eventOperationFailed(bytes32indexedoperationId,addressindexedreportedBy,bytes32reason);eventOperationCancelled(bytes32indexedoperationId);eventOperationExpired(bytes32indexedoperationId,bytes32reason);eventDisclosureRequested(bytes32indexeddisclosureId,bytes32indexedscopeId,bytes32indexedobjectId,bytes32viewId,addressaudience,addressrequester,uint256approvalsRequired);eventDisclosureApproved(bytes32indexeddisclosureId,addressindexedapprover,uint256approvals);eventDisclosureAuthorized(bytes32indexeddisclosureId);eventReleaseAttested(bytes32indexeddisclosureId,addressindexedholder,uint256attestations);eventDisclosureReleased(bytes32indexeddisclosureId);eventDisclosureRefused(bytes32indexeddisclosureId,addressindexedrefusedBy,bytes32reason);eventDisclosureExpired(bytes32indexeddisclosureId);eventEvidenceRecorded(bytes32indexedsubjectId,bytes32indexedproposition,bytes32indexedmechanism,addressattester,bytes32payloadHash,stringuri,uint256index);eventRecordAnchored(bytes32indexedcommitment,bytes32indexedscopeId,bytes32indexedrecordKind,addressanchoredBy);errorScopeNotActive(bytes32scopeId,ScopeStatusstatus);errorPolicyVersionMismatch(uint64named,uint64current);errorKeyContextNotAdmitted(bytes32scopeId,bytes32keyContextId);errorEpochNotUsable(bytes32keyContextId,uint32epoch,EpochStatusstatus);errorConversionNotDeclared(bytes32keyContextId,uint32inputEpoch,uint32outputEpoch);errorNotAuthorized(addresssubject,bytes32capability);errorObjectExists(bytes32objectId);errorObjectNotAccepted(bytes32objectId);errorObjectScopeMismatch(bytes32objectId);errorKeyContextMismatch(bytes32objectId);errorViewMismatch(bytes32viewId);errorInputOutOfRange(bytes32objectId,bytes32viewId);errorRequestAlreadyUsed(bytes32requestId);errorRequestExpired(bytes32requestId);errorInvalidRequest();errorInvalidSignature();errorInvalidState(bytes32id);errorNotRequester(addresscaller);errorNotDesignatedExecutor(addresscaller);errorNotKeyHolder(addresscaller);errorAlreadyRecorded(addresscaller);errorNotReleasable(bytes32disclosureId,bytes32reason);errorStillReleasable(bytes32disclosureId);errorNotExpired(bytes32id);errorRecordModeMismatch(bytes32scopeId);errorUnknownSubject(bytes32subjectId);/// @notice The registry this ledger reads scopes, key contexts and views from.
functionregistry()externalviewreturns(address);/// @notice The EIP-712 domain separator of this ledger.
functionDOMAIN_SEPARATOR()externalviewreturns(bytes32);/// @notice The identifier of an operation request: its EIP-712 digest under this ledger's domain.
functionhashOperationRequest(OperationRequestcalldatarequest)externalviewreturns(bytes32);/// @notice The identifier of a disclosure request: its EIP-712 digest under this ledger's domain.
functionhashDisclosureRequest(DisclosureRequestcalldatarequest)externalviewreturns(bytes32);// Protected objects
/// @notice Registers an input as a protected object of a scope. It is accepted on registration.
functionsubmitInput(InputSubmissioncalldatasubmission)externalreturns(bytes32objectId);functionobjectOf(bytes32objectId)externalviewreturns(ProtectedObjectmemory);// Operations
/// @notice Admits an operation requested by the caller.
functionrequestOperation(OperationRequestcalldatarequest)externalreturns(bytes32operationId);/// @notice Admits an operation on a signature of `request.requester` over the request.
functionrequestOperationWithSignature(OperationRequestcalldatarequest,bytescalldatasignature)externalreturns(bytes32operationId);/// @notice Records the outputs an executor proposes for an admitted operation.
functionsubmitResult(bytes32operationId,OutputSubmission[]calldataoutputs)externalreturns(bytes32[]memoryobjectIds);/// @notice Accepts a submitted result. Its outputs become accepted objects of the scope.
functionacceptResult(bytes32operationId)external;functionrejectResult(bytes32operationId,bytes32reason)external;/// @notice Reports that an admitted operation cannot be carried out.
functionfailOperation(bytes32operationId,bytes32reason)external;functioncancelOperation(bytes32operationId)external;/// @notice Ends an operation that can no longer be completed.
functionexpireOperation(bytes32operationId)external;functionoperationOf(bytes32operationId)externalviewreturns(Operationmemory);// Disclosures
/// @notice Records a disclosure request of the caller.
functionrequestDisclosure(DisclosureRequestcalldatarequest)externalreturns(bytes32disclosureId);/// @notice Records a disclosure request on a signature of `request.requester` over the request.
functionrequestDisclosureWithSignature(DisclosureRequestcalldatarequest,bytescalldatasignature)externalreturns(bytes32disclosureId);functionapproveDisclosure(bytes32disclosureId)external;/// @notice Records that a key holder commits to contribute to the release, after checking again that
/// the release is authorized now. The disclosure is released when the epoch's quorum has attested;
/// holders contribute only after that.
functionattestRelease(bytes32disclosureId)external;functionrefuseDisclosure(bytes32disclosureId,bytes32reason)external;functionexpireDisclosure(bytes32disclosureId)external;/// @notice Whether a release could proceed now, and if not, why.
functionisReleasable(bytes32disclosureId)externalviewreturns(boolreleasable,bytes32reason);functiondisclosureOf(bytes32disclosureId)externalviewreturns(Disclosurememory);functionhasApproved(bytes32disclosureId,addressapprover)externalviewreturns(bool);functionhasAttested(bytes32disclosureId,addressholder)externalviewreturns(bool);// Evidence
/// @notice Records evidence of the caller about an object, an operation, a disclosure or an anchor.
functionrecordEvidence(bytes32subjectId,bytes32proposition,bytes32mechanism,bytes32payloadHash,stringcalldatauri)externalreturns(uint256index);functionevidenceCount(bytes32subjectId)externalviewreturns(uint256);functionevidenceAt(bytes32subjectId,uint256index)externalviewreturns(Evidencememory);// Committed records
/// @notice Anchors the commitment of a record that is kept off the ledger.
functionanchorRecord(bytes32scopeId,bytes32recordKind,bytes32commitment)external;functionanchorOf(bytes32commitment)externalviewreturns(Anchormemory);/// @notice Whether `commitment` opens to `recordHash` with `salt`.
functionverifyRecordOpening(bytes32commitment,bytes32recordHash,bytes32salt)externalpurereturns(bool);/// @notice Whether `leaf` is a member of the batch committed by `root`.
functionverifyBatchMembership(bytes32root,bytes32leaf,bytes32[]calldataproof)externalpurereturns(bool);}
10. Failure semantics
A refusal names its ground. A ledger MUST revert with an error that names a condition that failed; where several fail, which of them is named is not specified. A request that can no longer proceed ends with one of these reasons:
Reason
Meaning
fheif.reason.unsupported
The profile or the backend does not support what was asked.
fheif.reason.incompatible
Objects, keys or parameters do not belong together.
fheif.reason.undeterminable
It cannot be determined whether the result is correct.
fheif.reason.resource
A declared limit of depth, size or time was reached.
fheif.reason.expired
The time of validity passed.
fheif.reason.not-yet-valid
The time from which a request is valid has not come.
fheif.reason.scope-paused
The scope is paused. This reason can end.
fheif.reason.scope-closed
The scope is closed.
fheif.reason.policy-superseded
The policy version of the request is no longer current.
fheif.reason.epoch-not-usable
The key epoch or key context can no longer be used for this.
fheif.reason.view-retired
The view was retired.
fheif.reason.not-authorized
A capability the request rests on is not held.
Nothing proceeds on the unknown. An absent answer, an unknown profile, an unreadable source or an undecidable condition is never read as consent.
11. Invariants
Every object has exactly one scope, key context, key epoch, class and policy version, and they never change.
Only an accepted object is an input of an operation or the object of a disclosure.
No operation is admitted across scopes, key contexts or key epochs, except a conversion to the directly following epoch that was opened with CONVERT.
An identifier of a request is used once.
An object is released only under the view it carries, or under an identity view whose range contains its class.
No disclosure becomes RELEASED without the attestations of the release quorum of the epoch of its object, each given while the release stood.
RELEASED is final.
A policy version later than that of an object does not widen authority over the object, unless the earlier version has the successor right GOVERN.
No capability follows from controlling a scope, controlling a key context, being a holder, executing or approving.
Evidence changes no state.
Nothing is accepted under an epoch that is not ACTIVE, and nothing is released under an epoch that is REVOKED.
An admitted request does not depend on a later answer of its signer.
Rationale
Scope, key context and organisation are three things. A group can run a public progress board, a quoting round among its members, a delivery to one client and an audit that needs approval. If these shared a key because they share a group, every member would read everything. Keeping the three apart lets one key context serve several scopes and one scope use several key contexts, and it makes “who is in the group” a question an authorizer answers and never a question of keys.
Views instead of levels. Levels suppose that who sees more also sees what the others see. A client, a finance function, an auditor and the public see different things, none of which includes another. Stating the output of each audience as a view, and releasing whole view outputs only, turns “who may know what” into something that is computed, committed to and checked. A field that only names a form of output, such as “aggregate”, would not say which inputs, which function, which precision or whether a result was ever cleared for release.
A release is a whole object. If a holder contributed to the decryption of a large object and the audience were trusted to look at a part, the view would be a courtesy. Requiring that the released object holds the view output and nothing else puts the boundary where the cryptography is.
Capabilities are asked, not listed. A fixed table of members in the ledger would exclude open participation, temporary qualification, credentials and decisions of groups. The ledger asks one question of one contract and takes the answer. The example authorizer is a table of grants because that is the simplest thing that answers the question.
Authority is checked at the release. Decryption cannot be undone. A request can be valid when it is made and not when it is served, so each holder asks again in the block in which it commits to contribute, and no holder contributes until the last required commitment is on the ledger. A revocation that reaches the ledger before the last required attestation therefore stops the content, not only the record. If each holder contributed after its own attestation, the audience would keep the contributions of the holders that attested first and would need fewer holders than the epoch requires for that object. Waiting for the quorum adds no transaction and costs no liveness: an audience obtains nothing before it has every required contribution in either case, and a holder that never attests lets the request expire, as it would otherwise.
A later policy version only narrows. If a controller could rewrite the rules for what was already submitted, the boundary participants agreed to would last until the next transaction of the controller. Taking the intersection of the earlier and the current answer keeps later versions able to tighten and unable to widen, and a scope that wants its later versions to govern says so in its first version, where participants can see it.
Requests in flight end with their policy version. Carrying an admitted request across a change of rules would need a rule for every combination of old request and new policy. Ending it and asking again under the new version is one rule, has one outcome and costs one transaction.
Evidence per proposition. One interaction can have a proof that an input is well formed, a re-execution of the computation, signatures of holders over a decryption and an approval of a group for the release. A single flag would say that something was verified and not what. Mechanisms are named and never ranked, because a mechanism that proves the form of an input says nothing about a computation.
Records can be commitments. A record without plaintext can still show who works with whom and who is under audit. A scope chooses whether its records are fields of the ledger or commitments on it.
Storage is declared, not prescribed. Ciphertexts of current schemes range from kilobytes to megabytes. Some deployments keep them on a chain, most do not. The ledger needs the commitment and nothing else.
Dependencies. ERC-165 identifies the interfaces. EIP-712 gives requests an identifier that any party computes off the ledger and that an agent can sign without sending a transaction. ERC-1271 is needed because agents are commonly contract accounts. No clock interface is required: a key epoch is a version and not a clock, and times are plain timestamps.
Relation to other proposals. ERC-7984 defines confidential fungible balances whose amounts are pointers; such a balance can be an object of a scope, and this framework adds what a token interface leaves to the implementation. ERC-7627 covers messages that the recipient decrypts; a message that is to be computed on while encrypted is an input here. ERC-8338 names execution privacy as later work; a program of this framework can be the protected execution of such a package. Decisions of a group under ERC-8436 can be what an authorizer reads before it counts an approval, a group under ERC-8447 can bind its activities to one or several scopes, disputes under ERC-8471 can cite operations, disclosures and evidence of this ledger, information flows under ERC-8489 can name a scope as the boundary of a mode, and a task under ERC-8414 can be settled on an accepted result. Each of these is an optional binding. None is required, and none gives a capability or decryption capability by itself. Records of operations and evidence can also be read by systems that account for work; whether work was wanted, useful or to be paid is theirs to decide and is not defined here.
Backwards Compatibility
No backward compatibility issues found. The framework introduces new contracts and changes no existing interface. Existing execution environments for encrypted computation can be described by a profile and a key context, with their own access lists and decryption services behind an authorizer and a set of holders.
Test Cases
The matching case
Two suppliers each submit a quote and a client submits a cap, all encrypted as 16 bits under a key that the three of them generated jointly; each holds one share and all three are needed to decrypt. An executor that holds no share is asked for three rounds:
best-quote: which quote is lower, and the lower quote. A tie goes to the second supplier.
cap-check: whether the lower quote does not exceed the cap.
Four views of the result: for the client whether a deal was made, who won it and at what price; for each supplier whether it won; for everybody whether a deal was made.
No object is decrypted between the rounds. A second account re-executes each round and the client accepts on that evidence. With the quotes 41250 and 39800 and the cap 40000, the client view decrypts to a deal with the second supplier at 39800, the first supplier’s view to 0, the second supplier’s view to 1 and the public view to 1. With the quotes 30500 and 31000 and the cap 30000, there is no deal and every position of the client view is 0.
The following are refused, each with the error named:
Request
Error
A supplier requests the client view.
NotAuthorized
A used disclosure request is submitted again.
RequestAlreadyUsed
The client view output is requested under the public view.
ViewMismatch
The state is requested under the client view.
ViewMismatch
A request names a policy version that is not current.
PolicyVersionMismatch
A request names another key context or key epoch than that of the object.
KeyContextMismatch
A second scope, whose controller granted itself every capability, requests or computes on an object of the first.
ObjectScopeMismatch
A request carries the signature of another account.
InvalidSignature
A holder attests before the required approvals.
InvalidState
A holder attests after the audience’s capability was revoked.
NotReleasable with fheif.reason.not-authorized
A holder attests after the validity of the request.
NotReleasable with fheif.reason.expired
A holder attests while the scope is paused.
NotReleasable with fheif.reason.scope-paused
A result is submitted, or a holder attests, after the policy version was superseded.
PolicyVersionMismatch, NotReleasable with fheif.reason.policy-superseded
An input is submitted under a retired epoch.
EpochNotUsable
A holder of a later epoch only attests for an object of an earlier one, or the reverse.
NotKeyHolder
Objects of two epochs are named in one operation.
KeyContextMismatch
An object of a revoked epoch is requested.
EpochNotUsable
A release of the state as it is to an auditor needs two approvals. After the first holder attested, the capability of the auditor is revoked: the second holder is refused and the disclosure ends REFUSED. No holder contributed, since none may before the disclosure is RELEASED, so the auditor holds nothing.
When the second supplier leaves, a new epoch is opened with RETAIN and with key material that the remaining holders and a new supplier generate. The shares of the first epoch do not open an object of the second. An object of the first epoch is still released by the holders of the first epoch, the supplier that left among them, until that epoch is revoked.
Vectors
constants.json holds the well-known identifiers, the type strings and type hashes, and the interface identifiers:
identifiers.json holds one worked derivation of every identifier of section 3 on chain 11155111, with a registry at 0x1111111111111111111111111111111111111111 and a ledger at 0x2222222222222222222222222222222222222222:
The file also holds signatures over the two requests by the account 0xADA006Ad307445C27cF1b202a96beB0F70aeeC90, which a ledger at the stated address accepts.
documents.json holds the hash of every example document.
An example authorizer: a table of grants that can be signed, passed on in narrower form, revoked and frozen
The registry and the ledger have no owner, no upgrade path and no privileged account. A key context and a scope are controlled by the account that created them.
The matching case of the test cases was run end to end against these contracts with a backend built on a threshold variant of the BFV scheme over bits: the three holders generate the key jointly, each in a process of its own that reads only its own share; the executor and the re-executing account run in processes that are given the public material only; holders seal their contributions to the delivery key of the audience. A second backend that computes on plain bits and is registered under the test-only evaluation class runs the same flow and protects nothing. In that run all roles were processes on one machine; inputs were not proven well formed and partial decryptions were not proven correct, and the conformance statement of the example says so.
Security Considerations
Whoever holds a whole key decrypts. No record on a ledger prevents a subject that holds a complete decryption key, or enough shares, from decrypting ciphertexts it can obtain, outside any recorded path. The protection of a scope is that of its key context: who generated the key, who holds what, and how many holders have to act together. A reader of a scope looks at the key context descriptor and at the holders of the epoch before anything else. A release quorum on the ledger records contributions; it is not what makes decryption impossible below the threshold. The key arrangement does that or nothing does.
Collusion. With a threshold of holders, confidentiality holds against fewer holders than the threshold and fails against the threshold. In the matching case the three parties whose data is protected are the holders, so none of them can be bypassed; a deployment that gives the shares to a service trusts that service to that extent.
Departed holders. A holder that leaves keeps its shares of the epochs it held. A new epoch keeps it from later objects; revoking an earlier epoch stops releases of that epoch’s objects through the ledger, not decryption by holders acting together outside it. Earlier objects are closed to a departed holder only by converting them to an epoch it holds no share of, or, where the profile supports it, by resharing the key to the remaining holders, which depends on the old shares being erased. Both are outside this specification.
Computation is not confined. Where evaluation material is public, anybody computes on ciphertexts. Ciphertexts are malleable by design. What the ledger controls is which results become objects and which objects are released. A deployment in which an unadmitted computation followed by a decryption would be harmful relies on holders contributing only to recorded disclosures.
Released results can endanger keys. For several schemes, including exact ones under parameters that allow a noticeable probability of incorrect decryption, an adversary that sees decrypted results of ciphertexts it helped to form can learn about the key. Exact data semantics does not rule this out. A profile states its parameters, its correctness assumption, the model under which results are released and the protection it applies, such as noise added to partial decryptions, and holders release only objects of recorded disclosures whose origin the ledger shows.
Outputs leak inputs. A view that is allowed can still reveal what it was computed from, alone or together with other views and repeated requests. Encrypted computation protects the computation; the boundary of what is released is set by which views exist and how often they are served.
Inputs. A submitter that encrypts a value outside the form a program expects can corrupt a result or learn about other inputs through a view. Unless a profile provides proofs of well-formed inputs, this is trusted, and evidence records it as declared.
Executors. A result is a claim until it is supported. Re-execution detects a wrong result where the profile makes evaluation deterministic and somebody other than the executor re-executes. It detects nothing where the acceptor and the executor act together.
Partial decryptions. A holder that contributes a wrong share can make a release fail or, in some schemes, alter what the audience obtains. Without a proof of correct contribution this is not detected by the audience.
Records are public. Open records show which accounts requested, executed, approved, attested and received what and when. Commitments hide this only with random salts, and timing remains visible.
Controllers. The controller of a scope can pause it, close it, retire views and activate policy versions. It cannot widen authority over earlier objects where the successor right is narrow-only, and it holds no capability it is not granted. The controller of a key context can open and revoke epochs and thereby stop releases; it cannot release. An authorizer is code chosen by the controller: a scope is as trustworthy as the authorizer of its policy version, and participants read it before they submit.
Signatures. A signed request can be submitted by anybody, once, on one ledger and one chain, within its validity. A contract account that changes its keys affects signatures that are not yet submitted and not requests that were admitted.
Finality. A holder that contributes before the block that completed the quorum is final can release on a state that the chain later drops.
Test-only profiles. A profile of the test-only class is public about protecting nothing. A consumer that does not read the evaluation class of the profile of a key context can take a rehearsal for protection.
Agents. An agent that receives a ciphertext does not thereby understand it. It decides, on what it can see, which protected operation to request; a backend computes; the agent receives the views it is entitled to, or passes references to objects on. Confidentiality of inputs does not hide a program or a model from the party that evaluates it: hiding a program needs the program to be protected data of an operation, which a profile declares where it provides it.