This document describes how this scaffold maps the EIP into code.
The EIP authorization item:
[chain_id, address, nonce, y_parity, r, s]
In code:
pkg/eip7702/types.godefinesAuthorizationpkg/eip7702/authorization.gocomputes the digest:keccak(0x05 || rlp([chain_id, address, nonce]))
- Signing returns
y_parity,r,sin RLP-ready form - Verification includes:
- chain-id compatibility (
0or current chain) - low-S check
- signer recovery
- chain-id compatibility (
EIP-7702 writes delegated code as:
0xef0100 || address
In code:
pkg/eip7702/delegation.goDelegationCode(delegate)ParseDelegationCode(code)IsClearCodeAuthorization(delegate)for0x0address case
Set-code tx payload is encoded in strict field order using RLP.
In code:
pkg/eip7702/types.godefinesSetCodeTxpkg/eip7702/setcode_tx.goEncodePayload()EncodeTypedTransaction()=>0x04 || payload
Batching is demonstrated using an executeBatch((address,uint256,bytes)[]) ABI pattern.
In code:
pkg/batching/batching.goEncodeExecuteBatch(calls)EncodeFunctionCall(...)
For EIP-4337 compatibility examples:
pkg/userop/types.godefinesUserOperationpkg/userop/client.gobuilds and sendseth_sendUserOperation
The example program (examples/send-userop/main.go) prints payload by default and submits only when BUNDLER_RPC_URL is set.
This repository intentionally avoids client-internal state transition logic and consensus rules. It focuses on:
- App-layer encoding/signing
- Interop with wallet/bundler flows
- Testable primitives for codelab usage
For production, pair this with:
- chain-specific transaction signing support for type
0x04 - simulation infrastructure
- robust key management