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 ERC5453, which relies on ERC5750, a standard for extending method behavior, to propose mechanisms such as multiple function calls in a single transaction.
The following material is translated, summarized, and supplemented with explanations.
As of October 17, 2023, 5453 was at the Last Call stage.
I have also covered various other ERCs.
Overview
This Ethereum Improvement Proposal (EIP) builds on ERC5750.
Its primary objective is to establish a general protocol for authorizing multiple function calls within the same transaction.
This differs from conventional approaches.
Previous approaches, such as ERC2612 for ERC20 and ERC4494 for ERC721, generally authorize only one action (transfer for ERC20 or safeTransferFrom for ERC721) and involve a single approver, requiring two transactions: a permit(...) transaction followed by another transaction, such as a transfer.
For more on ERC5750, see the following article.
[ERC5750] Extending Method Behavior With Additional Data
For more on ERC20, see the following article.
For more on ERC721, see the following article.
This EIP, however, provides a way to authorize different actions and accept multiple endorsements from any number of endorsers in one transaction. This is useful in many scenarios, including multisignature contracts requiring multiple signatures and threshold signatures requiring particular conditions to be met.
The protocol can accept multiple endorsements for a specific function call in a particular contract within the same transaction. Operations that previously required two transactions can therefore be completed in one, improving efficiency. In particular, a contract can accept endorsements from multiple endorsers with specified roles to authorize different operations in the same transaction, increasing flexibility and security.
Motivation
The protocol supports the following features.
Concurrent Endorsement and Function Execution
A user can authorize a specific operation in a contract and execute it in the same transaction. This allows multiple operations to be performed in a single transaction.
Additional Endorsements From Other Users
Additional endorsements from other users can be accepted. Multiple users can therefore endorse the same transaction.
Payment by Another User
Another user can pay the gas fees for a transaction. This allows transaction costs to be shared among multiple users.
Multisignature Support
Multisignature functionality is available when multiple endorsers are required. Multiple users can cooperate to authorize a contract operation.
Joint Actions
Multiple users can coordinate to execute transactions. Multiple endorsers can cooperate to execute a specific operation.
Cumulative Voting
Endorsements can be accumulated and combined. When multiple endorsements are required, they can be processed together.
Offline Signing
Signatures can be generated offline and added to a transaction later. This improves security and flexibility and allows transaction preparation in environments without Internet connectivity.
The protocol provides numerous features for managing contract operations more flexibly, securely, and efficiently.
Specification
Interfaces
The interfaces and structures referenced here are as follows.
pragma solidity ^0.8.9;
struct ValidityBound {
bytes32 functionParamStructHash;
uint256 validSince;
uint256 validBy;
uint256 nonce;
}
struct SingleEndorsementData {
address endorserAddress; // 32
bytes sig; // dynamic = 65
}
struct GeneralExtensionDataStruct {
bytes32 erc5453MagicWord;
uint256 erc5453Type;
uint256 nonce;
uint256 validSince;
uint256 validBy;
bytes endorsementPayload;
}
interface IERC5453EndorsementCore {
function eip5453Nonce(address endorser) external view returns (uint256);
function isEligibleEndorser(address endorser) external view returns (bool);
}
interface IERC5453EndorsementDigest {
function computeValidityDigest(
bytes32 _functionParamStructHash,
uint256 _validSince,
uint256 _validBy,
uint256 _nonce
) external view returns (bytes32);
function computeFunctionParamHash(
string memory _functionName,
bytes memory _functionParamPacked
) external view returns (bytes32);
}
interface IERC5453EndorsementDataTypeA {
function computeExtensionDataTypeA(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address endorserAddress,
bytes calldata sig
) external view returns (bytes memory);
}
interface IERC5453EndorsementDataTypeB {
function computeExtensionDataTypeB(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address[] calldata endorserAddress,
bytes[] calldata sigs
) external view returns (bytes memory);
}ValidityBound
struct ValidityBound {
bytes32 functionParamStructHash;
uint256 validSince;
uint256 validBy;
uint256 nonce;
}Overview A struct containing information about the validity of a smart contract call.
Parameters
functionParamStructHash- The hash of the function call's parameter structure.
validSince- A timestamp (Unix time) indicating the start of the validity period.
validBy- A timestamp (Unix time) indicating the end of the validity period.
nonce- A numeric value used as a unique identifier.
SingleEndorsementData
struct SingleEndorsementData {
address endorserAddress;
bytes sig;
}Overview A struct containing a single endorsement.
Parameters
endorserAddress- The endorser's address.
sig- A variable-length byte array containing signature data (typically
65bytes).
- A variable-length byte array containing signature data (typically
GeneralExtensionDataStruct
struct GeneralExtensionDataStruct {
bytes32 erc5453MagicWord;
uint256 erc5453Type;
uint256 nonce;
uint256 validSince;
uint256 validBy;
bytes endorsementPayload;
}Overview A struct containing general extension data. It contains information related to ERC5453.
Parameters
erc5453MagicWord- A specific hash used as an identifier for the ERC5453 protocol.
erc5453Type- A numeric value indicating the ERC5453 type.
nonce- A numeric value used as a unique identifier.
validSince- A timestamp (Unix time) indicating the start of the validity period.
validBy- A timestamp (Unix time) indicating the end of the validity period.
endorsementPayload- A variable-length byte array containing the extension data payload.
IERC5453EndorsementCore
eip5453Nonce
function eip5453Nonce(address endorser) external view returns (uint256);Overview
Retrieves the unique identifier (nonce) of the specified endorser.
Details
This function returns the unique identifier (nonce) associated with the specified endorser address.
The unique nonce is a distinct value incremented each time an endorser performs a specific operation.
Arguments
endorser- The address of a user or account.
Return Value
nonce- The endorser's unique identifier.
isEligibleEndorser
function isEligibleEndorser(address endorser) external view returns (bool);Overview Checks whether the specified address is a valid endorser.
Details
Returns true if the specified endorser address is a valid endorser.
A valid endorser is an address authorized to sign specific operations or transactions.
Arguments
endorser- The endorser's address.
Return Value
isEligibletrueif the specified address is a valid endorser, andfalseotherwise.
IERC5453EndorsementDigest
computeValidityDigest
function computeValidityDigest(
bytes32 _functionParamStructHash,
uint256 _validSince,
uint256 _validBy,
uint256 _nonce
) external view returns (bytes32);Overview Computes a digest for verifying the validity of an endorsement.
Details
This function computes a digest using _functionParamStructHash (the function parameter hash), _validSince (the start of validity), _validBy (the end of validity), and _nonce (a unique identifier).
The digest uniquely identifies the endorsement information and is used for signature verification.
Arguments
_functionParamStructHash- The hash of the function parameters.
_validSince- The start of the validity period.
_validBy- The end of the validity period.
_nonce- A unique identifier.
Return Value
digest- The digest for verifying the validity of the endorsement.
computeFunctionParamHash
function computeFunctionParamHash(
string memory _functionName,
bytes memory _functionParamPacked
) external view returns (bytes32);Overview Computes a function parameter hash from the function name and packed parameter bytes.
Details
This function computes the function parameter hash using _functionName and _functionParamPacked (the packed parameter bytes).
The hash uniquely identifies the function parameters and is involved in generating and verifying endorsements.
Arguments
_functionName- A string containing the function name.
_functionParamPacked- The packed parameter bytes.
Return Value
paramHash- The function parameter hash.
IERC5453EndorsementDataTypeA
computeExtensionDataTypeA
function computeExtensionDataTypeA(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address endorserAddress,
bytes calldata sig
) external view returns (bytes memory);Overview
Computes extension data of type A using the supplied arguments.
Details
This function is used to compute type A data within the contract. Type A extension data contains information about a user and helps verify the validity of a signed transaction. The function takes specific arguments, uses them to generate type A data, and returns the result. This enables verification of whether a transaction is valid.
Arguments
nonce- The transaction nonce.
- A unique transaction identifier.
validSince- The beginning of the transaction's validity period.
validBy- The end of the transaction's validity period.
endorserAddress- The signer's address, corresponding to the account that signed the transaction.
sig- The transaction signature data, used to verify the authenticity of the transaction.
Return Value
Returns the computed type A extension data as bytes.
IERC5453EndorsementDataTypeB
computeExtensionDataTypeB
function computeExtensionDataTypeB(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address[] calldata endorserAddress,
bytes[] calldata sigs
) external view returns (bytes memory);Overview
Computes extension data of type B using the supplied arguments.
Details
This function is used to compute type B data within the contract. Type B extension data helps verify the validity of a transaction signed by multiple signers. The function takes specific arguments, uses them to generate type B data, and returns the result. This enables verification of whether a transaction is valid.
Arguments
nonce- The transaction nonce.
- A unique transaction identifier.
validSince- The beginning of the transaction's validity period.
validBy- The end of the transaction's validity period.
endorserAddress- An array of signer addresses, containing the accounts that signed the transaction.
sigs- An array of transaction signature data, containing each signer's signature.
Return Value
Returns the computed type B extension data as bytes.
Behavioral Specification
Under ERC5750, which defines general extensibility for method behavior, compliant methods with bytes extraData as their final parameter can follow ERC5453 to represent authorization from particular users.
A method complying with this EIP must also comply with ERC5750.
As the final parameter, the caller must supply bytes extraData containing the Solidity-encoded layout of GeneralExtensonDataStruct specified in the Section Interfaces.
The following discussion assumes that bytes extraData is decoded into GeneralExtensonDataStruct.
Within the decoded GeneralExtensonDataStruct, the caller must set GeneralExtensonDataStruct.erc5453MagicWord to keccak256("ERC5453-ENDORSEMENT").
The caller must set GeneralExtensonDataStruct.erc5453Type to one of the supported values.
This EIP provides a way for methods following ERC5750 to represent authorization from specific users.
The caller must populate specific information in extraData and decode it to supply the correct authorization information.
This enables contracts to extend different methods and manage authorization information effectively.
uint256 constant ERC5453_TYPE_A = 1;
uint256 constant ERC5453_TYPE_B = 2;If GeneralExtensonDataStruct.erc5453Type is ERC5453_TYPE_A, GeneralExtensonDataStruct.endorsementPayload must be the ABI-encoded bytes of SingleEndorsementData.
If GeneralExtensonDataStruct.erc5453Type is ERC5453_TYPE_B, GeneralExtensonDataStruct.endorsementPayload must be the ABI-encoded bytes of a dynamic array of SingleEndorsementData.
Each SingleEndorsementData contains two elements.
endorserAddress- This field is an address representing the endorser who produced the signature.
sig- This field contains a
65-byte ECDSA (secp256k1) signature. - The signature is generated using the private key of the signer corresponding to
endorserAddress.
- This field contains a
Each sig signature is produced over a hash called validityDigest.
This hash is computed using EIP712 hashTypeDataV4 based on the hashStruct of the ValidityBound data structure.
ERC5453 represents authorization from specific users using SingleEndorsementData, which contains the signer's address and signature, stored in ABI-encoded form within GeneralExtensonDataStruct.
This ensures that authorization information is properly structured and verified.
bytes32 validityDigest =
eip712HashTypedDataV4(
keccak256(
abi.encode(
keccak256(
"ValidityBound(bytes32 functionParamStructHash,uint256 validSince,uint256 validBy,uint256 nonce)"
),
functionParamStructHash,
_validSince,
_validBy,
_nonce
)
)
);functionParamStructHash is computed as follows.
bytes32 functionParamStructHash = keccak256(
abi.encodePacked(
keccak256(bytes(_functionStructure)),
_functionParamPacked
)
);
return functionParamStructHash;_functionStructure is constructed in the form methodName(type1 param1, type2 param2, ...).
It represents the function name and the types of its parameters.
For example:
transfer(address to, uint256 amount)This structure represents the function signature.
_functionParamPacked is the byte sequence obtained by ABI-encoding and concatenating the individual function parameters.
For example, if the function parameters are (address, uint256), this field contains the ABI-encoded parameter bytes.
An individual endorsement is considered valid if endorserAddress matches ecrecover(validityDigest, signature) or EIP1271(endorserAddress).isValidSignature(validityDigest, signature) == ERC1271.MAGICVALUE.
In other words, the signature is verified as authentic.
A compliant method can set a threshold for the number of valid endorsements in the same ERC5453_TYPE_B endorsementPayload.
When multiple endorsements are required, the required number can therefore be specified.
validSince and validBy specify an endorsement's validity period.
They can be specified either as block numbers or timestamps.
Implementers must find a way to indicate explicitly whether validity is defined in block numbers or timestamps.
This allows the validity period to be specified clearly and verified correctly.
ERC5453 establishes specific rules for function structures, parameters, and endorsement verification. This enables a secure and reliable endorsement process.
Additional Details
The authors chose two distinct types for the ERC5453 protocol: ERC5453_TYPE_A (a single endorsement) and ERC5453_TYPE_B (multiple endorsements sharing a contract-wide nonce).
These choices accommodate different use cases.
First, ERC5453_TYPE_A involves a single endorsement.
It represents an individual endorsement from a particular user.
This type is suitable for use cases supported by existing protocols such as ERC2612 and ERC4494.
In ERC5453_TYPE_B, multiple endorsements share the same nonce and are coordinated at the contract level.
This enables more complex endorsement patterns, such as threshold endorsements.
Defining new ERC5453_TYPE_ values can support an even wider range of endorsement types.
The proposal also includes both validSince and validBy for validity.
This allows the endorsement validity period to be configured flexibly.
Because adoption of ERC5081 was considered unlikely, these two numeric fields were added to the protocol to support validity periods at the smart contract level.
The ERC5453 protocol is designed to support different use cases by offering multiple endorsement types and flexible validity periods.
Backwards Compatibility
This design assumes bytes calldata extraData to make the most of future changes and extensibility.
extraData is an additional data field supplied during contract function calls, providing flexibility for future changes and features.
One advantage of this design is its compatibility with many contracts that comply with existing ERC standards.
For example, contracts following existing standards such as ERC721 and ERC1155 can use extraData to integrate new functionality easily.
Contracts that do not support this design, such as ERC20, can subsequently add extraData support through wrapper contracts or proxy upgrades.
This enables a wide range of contracts to accommodate future changes and incorporate new functionality.
Using extraData provides contracts with an open and flexible approach to future changes and extensions that can be applied to various ERC standards.
Reference Implementation
In addition to the algorithm for verifying the validity of signatures produced by particular signers, the following reference implementations are provided.
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "./IERC5453.sol";
abstract contract AERC5453Endorsible is EIP712,
IERC5453EndorsementCore, IERC5453EndorsementDigest, IERC5453EndorsementDataTypeA, IERC5453EndorsementDataTypeB {
// ...
function _validate(
bytes32 msgDigest,
SingleEndorsementData memory endersement
) internal virtual {
require(
endersement.sig.length == 65,
"AERC5453Endorsible: wrong signature length"
);
require(
SignatureChecker.isValidSignatureNow(
endersement.endorserAddress,
msgDigest,
endersement.sig
),
"AERC5453Endorsible: invalid signature"
);
}
// ...
modifier onlyEndorsed(
bytes32 _functionParamStructHash,
bytes calldata _extensionData
) {
require(_isEndorsed(_functionParamStructHash, _extensionData));
_;
}
function computeExtensionDataTypeB(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address[] calldata endorserAddress,
bytes[] calldata sigs
) external pure override returns (bytes memory) {
require(endorserAddress.length == sigs.length);
SingleEndorsementData[]
memory endorsements = new SingleEndorsementData[](
endorserAddress.length
);
for (uint256 i = 0; i < endorserAddress.length; ++i) {
endorsements[i] = SingleEndorsementData(
endorserAddress[i],
sigs[i]
);
}
return
abi.encode(
GeneralExtensionDataStruct(
MAGIC_WORLD,
ERC5453_TYPE_B,
nonce,
validSince,
validBy,
abi.encode(endorsements)
)
);
}
}_validate
function _validate(
bytes32 msgDigest,
SingleEndorsementData memory endersement
) internal virtual {
require(
endersement.sig.length == 65,
"AERC5453Endorsible: wrong signature length"
);
require(
SignatureChecker.isValidSignatureNow(
endersement.endorserAddress,
msgDigest,
endersement.sig
),
"AERC5453Endorsible: invalid signature"
);
}Overview
Verifies the supplied message digest and single endorsement data.
Details
This function is used within the AERC5453Endorsible contract to verify whether a single endorsement is valid. Endorsement data contains the signer's address and signature data. Verification checks that the signature length is correct and that the signature is valid for the supplied message digest.
Arguments
msgDigest- The message digest.
- The hash of the message being verified.
endersement- A struct representing a single endorsement.
- It contains the signer's address and signature data.
onlyEndorsed
modifier onlyEndorsed(
bytes32 _functionParamStructHash,
bytes calldata _extensionData
) {
require(_isEndorsed(_functionParamStructHash, _extensionData));
_;
}Overview
A modifier that allows a specified function to execute only if it has been endorsed.
Details
Before calling the function, _isEndorsed is used to verify the endorsement's validity.
If the endorsement is valid, the function is allowed to execute.
If the endorsement is invalid, the function call fails.
Arguments
_functionParamStructHash- The hash of the function call's parameter structure.
_extensionData- Extension data.
computeExtensionDataTypeB
function computeExtensionDataTypeB(
uint256 nonce,
uint256 validSince,
uint256 validBy,
address[] calldata endorserAddress,
bytes[] calldata sigs
) external pure override returns (bytes memory) {
require(endorserAddress.length == sigs.length);
SingleEndorsementData[] memory endorsements = new SingleEndorsementData[](endorserAddress.length);
for (uint256 i = 0; i < endorserAddress.length; ++i) {
endorsements[i] = SingleEndorsementData(
endorserAddress[i],
sigs[i]
);
}
return abi.encode(
GeneralExtensionDataStruct(
MAGIC_WORLD,
ERC5453_TYPE_B,
nonce,
validSince,
validBy,
abi.encode(endorsements)
)
);
}Overview
Computes type B extension data.
Details
This function generates type B data using the specified arguments. Type B data contains a nonce, validity period, signer addresses, and signature data. It uses this information to generate type B data, encodes it as bytes, and returns the result.
Arguments
nonce- The transaction nonce.
- A unique transaction identifier.
validSince- The beginning of the transaction's validity period.
validBy- The end of the transaction's validity period.
endorserAddress- An array of signer addresses.
- It contains the addresses of the accounts that signed the transaction.
sigs- An array of transaction signature data containing each signer's signature.
Return Value
This function returns the computed type B data as bytes.
Type B data contains endorsement information encoded in a format that other contracts can use.
EndorsableERC721 Reference Implementation
The following is a reference implementation of EndorsableERC721 that provides behavior similar to ERC4494.
pragma solidity ^0.8.9;
contract EndorsableERC721 is ERC721, AERC5453Endorsible {
//...
function mint(
address _to,
uint256 _tokenId,
bytes calldata _extraData
)
external
onlyEndorsed(
_computeFunctionParamHash(
"function mint(address _to,uint256 _tokenId)",
abi.encode(_to, _tokenId)
),
_extraData
)
{
_mint(_to, _tokenId);
}
}mint
function mint(
address _to,
uint256 _tokenId,
bytes calldata _extraData
)
external
onlyEndorsed(
_computeFunctionParamHash(
"function mint(address _to,uint256 _tokenId)",
abi.encode(_to, _tokenId)
),
_extraData
)
{
_mint(_to, _tokenId);
}Overview
Mints a new token and assigns it to the _to address.
Details
This function mints a new token in an ERC721 contract and assigns it to the specified address _to.
It also requires an endorsement and verifies the supplied _extraData.
If the endorsement is valid, the new token is minted to _to.
Arguments
_to- The address to which the token will be assigned.
_tokenId- The ID of the new token.
_extraData- Additional endorsement data.
ThresholdMultiSigForwarder Reference Implementation
This is a reference implementation of ThresholdMultiSigForwarder (a threshold multisignature forwarder). Like a Gnosis Safe wallet, this implementation allows multiple endorsers to cooperate in calling an external contract.
Executing a particular transaction through this contract generally requires meeting a condition, or threshold. For example, if three endorsers are required, all three must sign the transaction. Once the required number of endorsers has signed, the transaction is executed.
This mechanism improves security when important transactions require multiple trusted endorsements. Rather than relying on one individual or entity, it requires consent from multiple parties. This helps prevent unauthorized or mistaken transactions and improves reliability and security.
pragma solidity ^0.8.9;
contract ThresholdMultiSigForwarder is AERC5453Endorsible {
//...
function forward(
address _dest,
uint256 _value,
uint256 _gasLimit,
bytes calldata _calldata,
bytes calldata _extraData
)
external
onlyEndorsed(
_computeFunctionParamHash(
"function forward(address _dest,uint256 _value,uint256 _gasLimit,bytes calldata _calldata)",
abi.encode(_dest, _value, _gasLimit, keccak256(_calldata))
),
_extraData
)
{
string memory errorMessage = "Fail to call remote contract";
(bool success, bytes memory returndata) = _dest.call{value: _value}(
_calldata
);
Address.verifyCallResult(success, returndata, errorMessage);
}
}forward
function forward(
address _dest,
uint256 _value,
uint256 _gasLimit,
bytes calldata _calldata,
bytes calldata _extraData
)
external
onlyEndorsed(
_computeFunctionParamHash(
"function forward(address _dest,uint256 _value,uint256 _gasLimit,bytes calldata _calldata)",
abi.encode(_dest, _value, _gasLimit, keccak256(_calldata))
),
_extraData
)
{
string memory errorMessage = "Fail to call remote contract";
(bool success, bytes memory returndata) = _dest.call{value: _value}(
_calldata
);
Address.verifyCallResult(success, returndata, errorMessage);
}Overview
Transfers tokens and data to a specified address and calls an external contract.
Details
This function transfers the specified token value _value and data _calldata to the address _dest and calls an external contract.
It requires an endorsement and verifies the supplied _extraData.
If the call fails, an error message is thrown.
Arguments
_dest- The destination address.
_value- The amount of tokens to transfer.
_gasLimit- The gas limit.
_calldata- Call data.
_extraData- Additional endorsement data.
Security Considerations
Replay Attacks
Replay attacks are a type of attack against cryptographic authentication.
Specifically, they reuse an existing signature to bypass the intended verification of a signature for the same message.
Such attacks may affect implementations relying on this EIP.
This is because all smart endorsements described here are public cryptographic signatures that anyone can obtain.
Implementers must consider different replay scenarios, including separate deployments of the same smart contract, deployments of similar smart contracts, and versions of the same contract on another chainId.
The nonce, validSince, and validBy fields can limit the attack surface, but eliminating all risks may be difficult.
Phishing Attacks
Phishing attacks also warrant attention. A malicious attacker may deceive a user into signing a smart endorsement that appears legitimate. In reality, the data corresponds to a malicious application.
Replay attacks circumvent cryptographic authentication, while phishing attacks deceive users into signing data for malicious smart contracts. Implementers must take measures to address these attacks.
Citation
Zainan Victor Zhou (@xinbenlv), "ERC-5453: Endorsement - Permit for Any Functions [DRAFT]," Ethereum Improvement Proposals, no. 5453, August 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5453.
Conclusion
This article covered ERC5453, which relies on ERC5750 for extending method behavior and proposes mechanisms such as multiple function calls in a single transaction. I hope you found it useful.
If you have questions, feel free to contact me by direct message on Twitter.
I also share information on other platforms, so feel free to explore them.


