--- eip: 8504 title: Dependency frames for leanSPHINCS signatures description: A frame mode that declares the leanSPHINCS signatures a transaction depends on, verified outside the EVM and carried beside it author: Ivan Litteri (@ilitteri) discussions-to: https://ethereum-magicians.org/t/eip-8504-dependency-frames-for-leansphincs-signatures/30448 status: Draft type: Standards Track category: Core created: 2026-11-17 requires: 8141 --- ## Abstract This EIP adds a frame mode to [EIP-8141](./eip-8141.md) frame transactions: the dependency verification frame. It executes no code. Its data is a list of `(scheme, data_hash, verification_key_hash)` triples, the transaction's dependencies. Each triple names the scheme of its dependency, and this EIP defines a single scheme, leanSPHINCS, a stateless hash-based signature scheme. A leanSPHINCS dependency states that `data_hash` is signed under the public key `verification_key_hash`, and a `data_hash` of 32 zero bytes stands for the transaction's own signature hash. Signatures are not part of the transaction. They travel beside it in the mempool and in the block, which carries one signature per distinct dependency of its transactions, and every node verifies them. The block header commits to the signatures the block carries. Smart accounts read their dependencies through the existing frame introspection instructions and approve on them. A later upgrade can replace the per-signature witnesses with a single aggregate proof of all dependencies, as [EIP-8288](./eip-8288.md) does, and can add dependencies of other kinds, such as proofs, without changing transactions or accounts. ## Motivation Post-quantum accounts need a signature scheme whose security does not rest on the hardness of discrete logarithms. leanSPHINCS is one. It is stateless, so a key can sign from several devices and be restored from a backup without tracking which one-time keys it has used, and its only primitive is Keccak-256, which every client already implements. Its cost is size: a signature is 7,740 bytes, more than a hundred times a secp256k1 signature, and a block of such transactions carries hundreds of kilobytes of signatures that every node downloads, verifies and keeps. The lasting fix is aggregation: a block carries one recursive proof that all of its signatures are valid, and nodes verify that proof in place of each signature. The proof systems that would do this are still changing, and building every block would require running a prover. Post-quantum accounts should not wait for them, but they do need, from the start, the interface that aggregation will keep. Accounts are long-lived, and their validation code fixes where a signature is looked for. An account that looks in one place cannot use an aggregate that answers in another without changing its code. Signatures are also not the only thing that will be verified outside the EVM. Proofs follow, and a proof's witness is hundreds of kilobytes, too large for a transaction to carry. A transaction will then declare what it depends on, and the witness will travel beside it until a block's aggregate proof answers for it. This EIP puts signatures on that model from the start: a transaction declares, the witness travels beside it, and the block answers for it. This EIP therefore fixes what aggregation keeps, and leaves for later only what it replaces: - A transaction declares the signatures it depends on in a dependency verification frame. The frame is covered by the transaction's signature hash, and accounts read it with `FRAMEPARAM` and `FRAMEDATACOPY`. Aggregation changes neither. - The frame is the only declaration. A signature carried inside the transaction would need an entry of its own, naming the same scheme, key and message a second time, and a rule to keep the two consistent. - Signatures travel beside the transaction, in the mempool and in the block. Nodes, wallets and tools handle a transaction together with its witnesses from the start, so when an aggregate proof takes the place of the signatures, only what accompanies the block changes. - The block header commits only to the signatures a block carries. A block's dependencies are derived from its transactions, so an aggregate proof can later commit to them in whatever form it needs. - The scheme is the leanSPHINCS definition an aggregate proof verifies, so keys created under this EIP stay usable once signatures are aggregated. - Signatures are checked outside the EVM and before execution. A node verifies a block's signatures in parallel with executing it, and a mempool node rejects a transaction with a missing or invalid signature before simulating it. Allowing only leanSPHINCS keeps this upgrade to one scheme, with one parameter set and a fixed verification cost. Other dependency kinds, such as proofs, can arrive with aggregation: the frame format already names the scheme of each dependency. ## 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](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174). ### Constants | Name | Value | | --- | --- | | `DEP_VERIFY_FRAME_MODE` | `4` | | `LEANSPHINCS_SCHEME` | `0x10` | | `MAX_DEPENDENCIES_PER_FRAME` | `256` (provisional) | | `LEANSPHINCS_VERIFICATION_GAS` | `3000` (provisional) | | `LEANSPHINCS_SIGNATURE_SIZE` | `7740` (provisional) | Values marked provisional are placeholders. They will be set based on measurements before this EIP is scheduled for a network upgrade. `ATOMIC_BATCH_FLAG`, `compute_sig_hash`, `FRAMEPARAM` and `FRAMEDATACOPY` are defined in [EIP-8141](./eip-8141.md). ### Dependency Verification Frame This EIP adds `DEP_VERIFY_FRAME_MODE` to the set of mode values accepted by EIP-8141's static constraint on `frame.mode`. No other mode value becomes valid. A frame with this mode is a dependency verification frame. It declares dependencies and executes no code. #### Encoding The frame's `data` is the concatenation of `k` triples, each 96 bytes long. Each triple consists of: - `scheme`: 31 zero bytes followed by one byte identifying the scheme. The only scheme is `LEANSPHINCS_SCHEME`. - `data_hash`: 32 bytes containing the message to be signed. A value of 32 zero bytes stands for the signature hash of the containing transaction, as specified in [Dependencies](#dependencies). - `verification_key_hash`: 32 bytes containing the leanSPHINCS public key. Since the key is already 32 bytes, it is used directly without hashing. #### Constraints A transaction is invalid if any of its dependency verification frames fails any of the checks below. `chunks(b, n)` splits `b` into consecutive pieces of `n` bytes. ```python for i, frame in enumerate(tx.frames): if frame.mode != DEP_VERIFY_FRAME_MODE: continue assert len(frame.data) % 96 == 0 k = len(frame.data) // 96 assert 1 <= k <= MAX_DEPENDENCIES_PER_FRAME for triple in chunks(frame.data, 96): assert triple[:31] == bytes(31) assert triple[31] == LEANSPHINCS_SCHEME assert frame.target is None assert frame.value == 0 assert frame.flags == 0 # The frame must not belong to an atomic batch. Its own flags are zero, # so only the preceding frame's batch flag needs to be checked. assert i == 0 or tx.frames[i - 1].flags & ATOMIC_BATCH_FLAG == 0 assert frame.limits.execution == k * LEANSPHINCS_VERIFICATION_GAS assert frame.limits.state == 0 ``` `None` denotes EIP-8141's absent target, not the zero address. The frame's `resolved_target` is therefore `tx.sender`, and `FRAMEPARAM(0x00, i)` returns the sender's address. Contracts identify a dependency verification frame by its `mode`, not its target. These checks apply in addition to EIP-8141's static constraints, which also apply to dependency verification frames. #### Execution and Receipt Executing a dependency verification frame performs no call, accesses no account and changes no state. The frame consumes its entire `limits.execution`. Like any other frame, it produces an EIP-8141 frame receipt, with `status = 1`, `gas_used.execution` equal to the frame's `limits.execution`, `gas_used.state = 0`, and no logs. ### Dependencies A dependency is a triple `(scheme, data_hash, verification_key_hash)`. The dependency `(LEANSPHINCS_SCHEME, m, pk)` states that the 32-byte message `m` is signed under the leanSPHINCS public key `pk`. A transaction's dependencies are derived from the triples in all of its dependency verification frames. Each zero `data_hash` is replaced with the transaction's signature hash, and the resulting triples are sorted and deduplicated. A block's dependencies are the combined dependencies of all its transactions, also sorted and deduplicated. ```python def data_triples(frame): return [(t[31], t[32:64], t[64:96]) for t in chunks(frame.data, 96)] def dependencies(tx): return deduplicate_and_sort([ (scheme, compute_sig_hash(tx) if data_hash == bytes(32) else data_hash, verification_key_hash) for frame in tx.frames if frame.mode == DEP_VERIFY_FRAME_MODE for (scheme, data_hash, verification_key_hash) in data_triples(frame) ]) def block_dependencies(block): return deduplicate_and_sort([ dependency for tx in block.transactions for dependency in dependencies(tx) ]) def deduplicate_and_sort(deps): out = [] for dep in sorted(deps): if len(out) == 0 or dep != out[-1]: out.append(dep) return out ``` Triples are ordered first by `scheme` as an integer, then by `data_hash`, and finally by `verification_key_hash`. The two 32-byte fields are compared byte by byte. A `data_hash` of 32 zero bytes serves as a placeholder for `compute_sig_hash(tx)`. A transaction cannot include its own signature hash directly in a frame, because that hash covers the frame's `data`. The substitution occurs only in `dependencies(tx)`: the frame's encoded `data` remains unchanged, so `compute_sig_hash` covers the zero bytes and `FRAMEDATACOPY` returns them. Any nonzero `data_hash` is an explicit message, signed as encoded. Transactions that declare the same scheme, explicit message and public key therefore share the same dependency. A transaction MAY declare the same triple more than once, either within a frame or across several frames. These repeated declarations contribute only one dependency. The requirements for satisfying dependencies are specified in [Signatures in the Mempool](#signatures-in-the-mempool) and [Signatures in the Block](#signatures-in-the-block). ### Reading Dependencies During Execution This EIP introduces no new instruction. Contracts read dependency verification frames using EIP-8141's existing frame introspection instructions: - `FRAMEPARAM(0x02, i)` returns the `mode` of frame `i`. A dependency verification frame has mode `DEP_VERIFY_FRAME_MODE`. - `FRAMEPARAM(0x04, i)` returns `len(data)` for frame `i`. - `FRAMEDATACOPY(memOffset, dataOffset, length, i)` copies the `data` of frame `i` into memory. The data is read as encoded, so a zero `data_hash` remains 32 zero bytes. An account with public key `pk` typically approves a transaction when one of its dependency verification frames contains the triple `(LEANSPHINCS_SCHEME, bytes(32), pk)`. Validation code can read a dependency verification frame's data even when that frame appears later in the transaction. ### leanSPHINCS leanSPHINCS is a stateless hash-based signature scheme. It is SLH-DSA, as specified in FIPS 205[^1], instantiated with Keccak-256 and with WOTS+C as its one-time signature. This EIP uses leanSPHINCS as specified by the Cryptography/Sphincs module of the ethereum/EthLib repository at commit `c4474ed422d83b6b735ef802ee43960abe1b788f`. That module defines the parameters, the hash layout, the encodings of keys and signatures, and verification. A Rust implementation is available in the `lean_sphincs` crate of the leanEthereum/leanVM repository at commit `92a97c919b2f2d6fe09853090b6b23f781ecec07`. It reproduces the module's test vectors byte for byte. `LEANSPHINCS_SCHEME` identifies leanSPHINCS with exactly one parameter set. After this EIP is activated, that parameter set does not change: any other parameter set is a different scheme and takes a new `scheme` value. The following parts of the scheme are fixed: - A public key is 32 bytes, the size of a triple's `verification_key_hash`. In a dependency, `verification_key_hash` contains the public key. - A message is 32 bytes, the size of a triple's `data_hash`. - This EIP uses the scheme only through `leansphincs_verify`, as specified below. The following parts are provisional. They will be fixed before this EIP is scheduled for a network upgrade: - The parameter set. The module currently specifies a single parameter set, under which a public key is the 16-byte `PK.seed` followed by the 16-byte `PK.root`, a key signs at most `2^30` messages, and verification performs a constant 515 Keccak-f[1600] permutations. - The size of a signature, `LEANSPHINCS_SIGNATURE_SIZE`. - The gas costs that depend on the scheme: `LEANSPHINCS_VERIFICATION_GAS` and the costs specified in [Gas Accounting](#gas-accounting). - Both commits. Before this EIP moves to Last Call, the parameter set and the test vectors will be part of this EIP, in place of the references to the commits. This EIP uses the scheme through the following function: | Function | Description | | --- | --- | | `leansphincs_verify(pk: Bytes32, msg: Bytes32, signature: bytes) -> bool` | Return whether `signature` is a valid signature of `msg` under the public key `pk`. Return `False`, without raising, if `signature` is not `LEANSPHINCS_SIGNATURE_SIZE` bytes long | `leansphincs_verify` applies the module's `verify` to the public key and the signature, decoded with its `decodePublicKey` and `decodeSignature`. #### Satisfying a Dependency A byte string `witness` satisfies a dependency when `satisfies(dependency, witness)` returns `True`: ```python def satisfies(dependency, witness): scheme, data_hash, verification_key_hash = dependency if scheme != LEANSPHINCS_SCHEME: return False return leansphincs_verify(verification_key_hash, data_hash, witness) ``` Here `dependency` is a triple as returned by `dependencies(tx)`, so its `data_hash` is the message itself. A declaration with a zero `data_hash` is therefore satisfied by a signature over the transaction's signature hash. [^1]: ```csl-json { "id": "https://doi.org/10.6028/NIST.FIPS.205", "type": "report", "title": "Stateless Hash-Based Digital Signature Standard", "author": [ { "literal": "National Institute of Standards and Technology" } ], "issued": { "date-parts": [[2024, 8, 13]] }, "publisher": "National Institute of Standards and Technology", "publisher-place": "Gaithersburg, MD", "collection-title": "Federal Information Processing Standards Publication", "number": "205", "URL": "https://doi.org/10.6028/NIST.FIPS.205", "DOI": "10.6028/NIST.FIPS.205" } ``` ### Signatures in the Mempool TBD ### Signatures in the Block TBD ### Gas Accounting TBD ## Rationale TBD ## Backwards Compatibility TBD ## Security Considerations Needs discussion. ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md).