Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC-2770, which proposes a mechanism for verifying signatures and forwarding transactions to execute meta-transactions.
This article translates, summarizes, and expands on the proposal below.
I have also covered a variety of other EIPs.
Overview
ERC-2770 proposes an extensible forwarder for processing meta-transactions. The forwarder's primary responsibilities are to verify signed requests on-chain and provide the original signer's address to the ultimate destination contract. The mechanism follows ERC-712. Extensible structs allow additional type information to be displayed in a wallet-readable format.
For more on ERC-712, see the following article.
[EIP-712] Understanding Typed Structured Data Hashing and Signing
The forwarder contract aims to provide a generic, reusable mechanism that supports a wide range of meta-transaction use cases.
Motivation
There is increasing demand for ways to let users interact with smart contracts without holding ETH. Meta-transactions provide a means of meeting this demand.
With meta-transactions, a user (an EOA) signs the transaction details, and another party (a relayer) submits that data in an actual Ethereum transaction.
In this case, however, the contract cannot use msg.sender to identify the signer.
That is because msg.sender contains the relayer's address.
The signature must therefore be recovered, and the original signer's address provided in a trustworthy manner.
With this forwarder contract, multiple gas relays and relay recipients can share a single trusted signature verification implementation. This provides the following benefits.
- Less duplicated on-chain code
- Improved security and reliability
- Consistency across the meta-transaction framework
ERC-2770 thus aims to provide a foundation for safer and more efficient meta-transactions.
Specification
Technical Overview of the Forwarder
Basic Operation
The contract accepts signed typed data and its ERC-712 signature, verifies the signature, and forwards the transaction to the destination contract.
The signer's address is also appended to the transaction data, allowing the destination contract to identify the actual signer by reading the end of msg.data (in accordance with ERC-2771).
For more on ERC-2771, see the following article.
[ERC-2771] Understanding Meta-Transactions That Let Another Address Pay Gas Fees
Registering the ForwardRequest Struct
The transaction struct handled by the forwarder, ForwardRequest, has the following fixed format.
ForwardRequest
struct ForwardRequest {
address from;
address to;
uint256 value;
uint256 gas;
uint256 nonce;
bytes data;
uint256 validUntil;
}A struct containing the basic information required to execute a meta-transaction. It groups information such as the signer, destination, amount to send, gas limit, and expiration.
Parameters
from- Address of the externally owned account that created the request.
to- Address of the contract to call.
value- Amount of Ether to send with the call.
gas- Gas limit for the call.
nonce- Unique value used to prevent signature replay.
data- Actual data passed to the contract call.
validUntil- Last block number at which the request is valid.
- A value of 0 means it never expires.
registerRequestType
function registerRequestType(string typeName, string typeSuffix)Registers an extended struct with the forwarder in advance.
Custom typed structs (such as extended requests) can be registered for signature verification.
The typeSuffix is a struct definition that conforms to ERC-712.
Arguments
typeName- Name of the struct to register.
typeSuffix- Type description of the extended struct (compatible with ERC-712).
verify
function verify(
ForwardRequest forwardRequest,
bytes32 domainSeparator,
bytes32 requestTypeHash,
bytes suffixData,
bytes signature
) view;Verifies whether a signature is valid.
It checks whether the signature based on the ForwardRequest and its extended fields was actually produced by the request's signer.
The signature structure conforms to ERC-712.
Arguments
forwardRequest- Request struct to verify.
domainSeparator- Domain identifier that prevents signatures from being confused across applications (as specified by ERC-712).
requestTypeHash- Type hash of a registered struct.
suffixData- Additional field data covered by the signature.
signature- Signature to verify.
execute
function execute(
ForwardRequest forwardRequest,
bytes32 domainSeparator,
bytes32 requestTypeHash,
bytes suffixData,
bytes signature
)
public
payable
returns (
bool success,
bytes memory ret
)Executes the transaction after verification.
It calls verify internally and calls the specified destination only if the signature is valid.
It appends the signer's address (forwardRequest.from) to the end of msg.data when forwarding the call.
The nonce is updated regardless of whether the execution succeeds, preventing replay attacks.
Arguments
forwardRequest- Request struct to execute.
domainSeparator- Identifier for domain separation.
requestTypeHash- Hash of a registered struct.
suffixData- Additional field data covered by the signature.
signature- Signature to verify.
Return Values
success- Whether the operation at the destination succeeded.
ret- Data returned by the destination.
Generating suffixData
Additional data to be signed for an extended struct is supplied as suffixData.
Here is one example.
calculateSuffixData
function calculateSuffixData(ExtendedRequest request) internal pure returns (bytes) {
return abi.encode(request.x, keccak256(request.z), hashExtraData(request.extraData));
}Generates additional signing data (suffixData) for an extended request.
It hashes the struct's z and extraData fields, encodes them with the additional field x, and returns the result.
Arguments
request- A struct of type
ExtendedRequest.
- A struct of type
Return Values
bytes- Additional data used for signing.
hashExtraData
function hashExtraData(ExtraData extraData) internal pure returns (bytes32) {
return keccak256(abi.encode(
keccak256("ExtraData(uint256 a,uint256 b,uint256 c)"),
extraData.a,
extraData.b,
extraData.c
));
}Calculates the hash of an ExtraData struct.
It hashes the ExtraData portion used in the signature according to the rules of ERC-712.
Arguments
extraData- A struct of type
ExtraData.
- A struct of type
Return Values
bytes32- Hash value.
ExtraData
struct ExtraData {
uint256 a;
uint256 b;
uint256 c;
}A struct nested inside the extended struct ExtendedRequest.
It defines three arbitrary additional fields as integers so that they can be included in the signed data.
Parameters
a- First field of the extended data.
b- Second field of the extended data.
c- Third field of the extended data.
Retrieving the Signer's Address
The destination contract (the recipient) must extract the actual sender from the signer's address appended to the end of msg.data, rather than using the caller (msg.sender).
This design follows ERC-2771.
Additional Notes
Continuing to identify end users using msg.sender as usual would limit the future growth of Ethereum's DApp ecosystem.
Users would have to hold ETH before they could interact with smart contracts.
This restriction makes many smart contract use cases impractical and keeps the barrier to entry high. DApp adoption consequently stalls, creating a vicious cycle: users cannot access DApps without ETH, fewer use cases emerge, and adoption fails to grow.
Meta-transactions that do not require users to hold ETH address this problem.
The validUntil field, which specifies request expiration, uses a block number instead of a timestamp.
This design integrates more easily with block-based timers commonly used in the EVM, enabling more precise control.
Security Considerations
All contracts supporting this forwarding mechanism process external forwarding requests on a trusted basis. The forwarder contract can therefore execute arbitrary operations on behalf of arbitrary accounts, making it a critical trust anchor.
The contract itself must be free of the following problems.
- Vulnerabilities
Bugs or security flaws in the contract could allow malicious requests to perform unauthorized operations.
- Centralization
If signature verification or request structures could be tampered with by a small group of administrators, the reliability of the entire system would suffer.
The robustness and decentralization of the forwarder contract are therefore key to the security and reliability of the overall meta-transaction system.
Citation
Alex Forshtat (@forshtat), Dror Tirosh (@drortirosh), "ERC-2770: Meta-Transactions Forwarder Contract [DRAFT]," Ethereum Improvement Proposals, no. 2770, July 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2770.
Conclusion
This article covered ERC-2770, a proposal for verifying signatures and forwarding transactions to execute meta-transactions. I hope this explanation was helpful.
If you have any questions, feel free to contact me via Twitter direct messages.
I also share information on other platforms, which you are welcome to explore.



