-
Notifications
You must be signed in to change notification settings - Fork 819
Add ERC: Encrypted Hashed Arguments and Calls #1361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cfries
wants to merge
30
commits into
ethereum:master
Choose a base branch
from
finmath:feature/ERC-EncryptedCallArguments
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add ERC: Encrypted Hashed Arguments and Calls #1361
cfries
wants to merge
30
commits into
ethereum:master
from
finmath:feature/ERC-EncryptedCallArguments
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Contributor
Author
|
Note: The post on ethereum-magicians.org is still pending... |
abcoathup
reviewed
Nov 23, 2025
|
The commit b9e3cf4 (as a parent of 9edb4bb) contains errors. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We propose an ERC for executing function calls with encrypted arguments (and optionally encrypted
call descriptors) via a stateless decryption oracle. The goal is to support use-cases like
privacy-preserving order books or conditional DvP flows, while keeping the standard itself
as generic as possible.
The design is about when arguments and call descriptors become visible on-chain, not about
making calls or value flows permanently unlinkable. Once a request is fulfilled, anyone can
correlate the fulfilled call with the original requester via the standardized events.
Simple Summary
This ERC standardizes how smart contracts can request a function execution with encrypted arguments,
optionally with an encrypted call descriptor, using a stateless decryption oracle (a Call Decryption Oracle).
It separates
and defines how an off-chain oracle decrypts and executes such calls.
Abstract
This ERC defines a data format and contract interface for executing smart contract calls where:
EncryptedHashedArguments), andEncryptedCallDescriptor), orCallDescriptor).The encrypted arguments and the call descriptor are not directly bound on-chain. Instead, an on-chain
contract (the target or an orchestration contract) stores a hash commitment to the plaintext arguments
and later verifies that the decrypted argument payload matches the stored commitment.
An on-chain call decryption oracle contract offers a request*/fulfill* pattern to request a call
with encrypted arguments, which is fulfilled if admissible.
An off-chain call decryption oracle listens to standardized events, decrypts payloads, enforces any
off-chain access-control policy, and calls back into the on-chain oracle to perform the requested call.
The ERC is compatible with existing decryption-oracle designs such as ERC-7573 and can be implemented
as an extension of such oracles.
The contract receiving the decrypted arguments can pass these on to other contracts, which can, if necessary,
validate the arguments against the previously stored hash commitment.
The decrypted arguments are transported as
(uint256 requestId, bytes argsPlain)to allow correlating the callto the request. Here
argsPlainis an ABI-encoding of a typed argument list (depending on the business logic).Motivation
Privacy- and conditionality-preserving protocols often need to:
Existing work like ERC-7573 focuses on a specific decryption-oracle use-case with fixed callbacks (e.g. DvP).
This ERC generalizes that pattern to a generic function execution mechanism, designed around:
Exemplary Use-Cases
Order Book Build Process avoiding Front Running
A possible use-case is the construction of an auction / order book preventing front-running, where
the proposals can be made during a predefined phase.
Here participants submit their proposals as encrypted hashed arguments, which are stored inside a smart
contract. Once the order phase is closed, the smart contract calls the call decryption oracle (passing
itself as the callback target) to receive the decrypted arguments in a call that will build the order book.
Specification
1. Encrypted arguments
Encrypted arguments are independent of any particular call descriptor and can be reused.
Upon (off-chain) encryption (initialization) a hash of the (plain) arguments is generated
accompanying the encrypted arguments to allow later verification.
Normative requirements (EncryptedHashedArguments)
For producers of
EncryptedHashedArguments:where
argsPlainis anabi.encode(args...)byte sequence and part of theArgsDescriptor(see below).The producer MUST set
ciphertextto the encryption of exactlyabi.encode(argsDescriptor)under the key identified by
publicKeyId, whereargsDescriptoris anArgsDescriptoras defined below.The producer MUST set
argsHashto the value computed above.A call decryption oracle implementation MAY provide a command line tool or endpoint
to generate
EncryptedHashedArgumentsfrom plaintext arguments.This ERC does not standardize the encryption algorithm or key management; those are implementation-specific (similar to ERC-7573).
Implementations SHOULD document how
publicKeyIdis derived from the underlying key material.Argument Descriptor structure (normative for eligibility)
Prior to encryption, the arguments are bundled with an (optional) list of
eligibleCallers, to allow aCall Decryption Oracle to enforce eligibility of the requester in a consistent way. This prevents decryption
by other contracts through observing encrypted arguments and requesting a call to the call decryption oracle.
This ERC standardizes the layout of the decrypted payload as:
In this case, producers set
The
eligibleCallerlist is not visible to on-chain contracts; it is only used off-chain by theoracle operator to decide whether to honor a decryption request.
2. Call descriptor
A call descriptor defines:
Plain vs. Encrypted Call Descriptors
A call descriptor can be:
CallDescriptoris passed in clear on-chain.CallDescriptoris wrapped into:Normative requirements (CallDescriptor and EncryptedCallDescriptor)
EncryptedCallDescriptor, the ciphertext MUST be the encryptionof exactly
abi.encode(CallDescriptor)under the key identified bypublicKeyId.3. Oracle interface
The oracle exposes a request/fulfill pattern. Requests are cheap and do not require on-chain decryption; fulfillment is called by an off-chain operator after decryption.
4. Target contract
A common pattern is that the target contract
encArgtogether with its hashargsHash,where
argsHashis the hash of the plaintext argument payload.requestIdreturned byrequestCall/requestEncryptedCall, and passes thisrequestIdalong with
argsHashto the call target (may be the same contract) in the same transaction.The call target then receives the decrypted argument payload
argsPlain(under a callback selector)from the call decryption oracle, with the corresponding
requestIdand recomputes the hash and comparesit to the stored value.
For example, the producer of
EncryptedHashedArgumentsmay chooseThe target (or router) contract can then do:
In this pattern:
argsHashis the hash commit ofargsPlaincreated upon off-chain argument construction.requestIdis the technical identifier assigned by the Call Decryption Oracle when the request is issued.It is useful for correlation, logging and mapping inside routers, but is not required for the hash check.
argsPlainfield passed tofulfill*is the exact byte payload used to computeargsHash. The callback(target or router) decodes
argsPlainto recover the business arguments.executeWithVerification(uint256 requestId, bytes argsPlain)callback,perform the verification and decoding, and then call an already deployed target contract with its original typed
function signature.
Implementations SHOULD register the
(requestId, argsHash)mapping in the same transactionthat issues the request to the oracle, to avoid any race where a very fast oracle operator
could attempt to fulfill a request before the mapping is written on-chain. Even if the mapping
is missing, the callback pattern above will cause the fulfillment to revert (due to
Unknown requestId);however, registering in the same transaction provides deterministic behaviour.
Rationale
argsHash) binds arguments to a commitment stored by the receiving contract, while still allowing the arguments to be stored and passed separately as opaque bytes.abi.encodeWithSelector(selector, requestId, argsPlain)makes the on-chain oracle generic and able to support arbitrary function signatures while still providing a standard correlation identifier (requestId).executeWithVerification(uint256 requestId, bytes argsPlain), verifiesrequestIdandargsHashas above, decodesargsPlaininto typed arguments, and then calls the pre-existing target contract with its original typed function. This preserves compatibility with existing deployments while still using the standard call decryption oracle.Backwards Compatibility
This ERC is designed to coexist with ERC-7573 decryption oracles. An existing ERC-7573 implementation can be extended to implement
ICallDecryptionOraclewithout breaking existing interfaces.Reference Implementation
A non-normative reference implementation (Solidity) and a matching Java/off-chain implementation are provided separately. They illustrate:
These implementations are work-in-progress and may evolve independently of the ERC text.
Fees
Implementations MAY charge fees in ETH or ERC-20 tokens as part of their specific deployment.
Security Considerations
Oracle trust
The on-chain contract cannot verify correctness of decryption; it can only check that
keccak256(argsPlain) == argsHash.Parties must trust the oracle operator (or design an incentive/penalty mechanism) to decrypt correctly and call
fulfill*faithfully.
Replay
Implementations SHOULD mitigate replay by:
validUntilBlockinCallDescriptor, and/orAccess control
Access control is an application-level concern. A common pattern is to embed an access-control list such as
address[] eligibleCallerinside the encrypted payload (inArgsDescriptor) and have the off-chain oracleoperator enforce that the original requester is contained in that list (unless the list is empty, meaning
"any requester"). The standard does not prescribe a particular access-control mechanism beyond this guidance.
Traceability and non-mixing
This ERC is not intended to act as a mixer or general-purpose anonymization service for payments or calls.
Its purpose is to defer the disclosure of arguments (and optionally the call descriptor) until fulfillment.
Implementations SHOULD preserve the ability for off-chain indexers and observers to correlate
CallFulfilledevents with the correspondingCallRequested/EncryptedCallRequestedevents,for example by strictly adhering to the
requestIdlinkage defined in this ERC.Once a request is fulfilled, an observer can always reconstruct which
requesterinitiated the requestand which call and arguments were eventually used. Protocols that deliberately try to break this
correlation or to hide value flows are out of scope of this ERC.