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-7604, which adapts the mechanism of ERC-2612 to ERC-1155 tokens to improve the user experience of the approve and transferFrom flow.
This article translates, summarizes, and supplements the material linked below.
I have also covered other EIPs.
Overview
The permit approval flows introduced by ERC-2612 and ERC-4494 significantly improve the user experience for ERC-20 and ERC-721 tokens.
This proposal extends the permit mechanism to ERC-1155. Because ERC-1155 requires both a tokenId and a value to be considered, a separate standard is proposed.
A permit allows a token holder to authorize a third party to submit an approval and potentially execute a transfer while paying the transaction fees.
Normally, to allow a third party such as an application operator to transfer tokens on a user's behalf, the user must call approve to grant permission.
This requires an on-chain transaction and therefore some ETH to pay for gas. Requiring users to acquire ETH first can be inconvenient.
ERC-2612 and ERC-4494 instead allow the approval authorization to be expressed as a signature. Once the contract verifies that signature, a third party can submit the approval and perform the authorized transfer, potentially within the same transaction.
The user therefore does not need to hold ETH for the approval transaction if another party pays the fees.
See the following article for ERC-2612.
[ERC-2612] Performing ERC-20 Approvals and Transfers in One Transaction
See the following article for ERC-4494.
[ERC-4494] Applying ERC-2612-Style Permit Approvals to NFTs
The proposed standard also uses ERC-5216.
ERC-5216 proposes a mechanism through which an ERC-1155 token holder can approve another address to spend part of the holder's balance for a particular tokenId.
See the following article for more information about ERC-5216.
[ERC-5216] Approving Another Address to Spend Part of an ERC-1155 Token Balance
See the following article for ERC-20.
See the following article for ERC-721.
See the following article for ERC-1155.
Motivation
ERC-2612 and ERC-4494 provide permit mechanisms for ERC-20 and ERC-721, respectively. This proposal introduces an equivalent mechanism for ERC-1155.
Specification
The following three functions must be added to implementations of ERC-1155 and ERC-5216.
interface IERC1155Permit {
function permit(address owner, address operator, uint256 tokenId, uint256 value, uint256 deadline, bytes memory sig) external;
function nonces(address owner, uint256 tokenId) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}Executing permit must set the allowance returned by allowance(owner, spender, tokenId) to the specified value for the particular tokenId, increment nonces(owner, tokenId) by 1, and emit the Approval event defined in ERC-5216.
The following conditions must also be satisfied.
- The current block timestamp is less than or equal to
deadline. - The token owner (
owner) is not the zero address. - The nonce for the specified
tokenId(nonces[owner][tokenId]) matches the current nonce used for the authorization. - The signature sig is valid under the applicable signature scheme, such as secp256k1, ERC-2098, or ERC-1271.
keccak256(abi.encodePacked(
hex"1901",
DOMAIN_SEPARATOR,
keccak256(abi.encode(
keccak256("Permit(address owner,address spender,uint256 tokenId,uint256 value,uint256 nonce,uint256 deadline)"),
owner,
spender,
tokenId,
value,
nonce,
deadline))
));If these conditions are not satisfied, execution of permit fails.
See the following article for ERC-2098.
[ERC-2098] Making Ethereum Signatures More Compact
See the following article for ERC-1271.
[ERC-1271] Verifying Signatures with Smart Contracts
The DOMAIN_SEPARATOR must be defined in accordance with EIP-712. It must distinguish the contract and chain to prevent replay attacks across domains.
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes(version)),
chainid,
address(this)
));The signed message therefore has the following structure.
{
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "version",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"Permit": [
{
"name": "owner".
"type": "address"
},
{
"name": "spender",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"primaryType": "Permit",
"domain": {
"name": erc1155name,
"version": version,
"chainId": chainid,
"verifyingContract": tokenAddress
},
"message": {
"owner": owner,
"spender": spender,
"tokenId": tokenId,
"value": value,
"nonce": nonce,
"deadline": deadline
}
}}Additionally, the permit function must check that the signer is not the zero address.
The mechanism does not rely on msg.sender (the address executing the function), so any address may call permit.
EIP-165
The proposal requires EIP-165.
EIP-165 makes it easy to determine whether another NFT contract implements the proposed interface. The interface ID returned for the interface defined by this proposal is 0x7409106d.
See the following article for ERC-165.
[ERC-165] Checking Whether a Contract Supports a Specific Interface
Additional Notes
The permit function allows an authorized safeTransferFrom operation without requiring a separate approval transaction from the token owner.
The format is designed to avoid calls to unexpected code. A nonces mapping provides replay protection.
A common use case is a relayer submitting a permit on behalf of the owner.
The relayer can choose whether to submit the permit. If this is a concern, the owner can limit the authorization's validity by setting deadline to a time in the near future.
The original proposal also describes using uint(-1) as the maximum unsigned integer value to create a permit without an effectively relevant expiration time. Modern Solidity uses type(uint256).max for that value.
The EIP-712 message format is adopted because it is already used by ERC-2612 and ERC-4494 and is widely supported by wallet providers.
ERC-2612 focuses on the approved value, whereas ERC-4494 focuses on the approved tokenId.
This proposal accounts for both tokenId and value in the approval authorized by permit. Because ERC-1155 does not natively support amount-based approvals, ERC-5216 is required.
ERC-2612 separates signatures into v, r, and s components. This proposal instead uses a variable-length byte array to support EIP-2098 compact signatures of 64 bytes alongside other signature formats.
The 64-byte compact encoding differs from the conventional 65-byte representation consisting of r, s, and v. It packs the parity bit into the encoded signature rather than storing a separate byte for it.
Security
The security considerations correspond to those described in the following article.
[ERC-4494] Applying ERC-2612-Style Permit Approvals to NFTs
Citation
calvbore (@calvbore), emiliolanzalaco (@emiliolanzalaco), "ERC-7604: ERC-1155 Permit Approvals [DRAFT]," Ethereum Improvement Proposals, no. 7604, January 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7604.
Conclusion
ERC-7604 proposes extending ERC-2612-style permit approvals to ERC-1155 tokens to improve the user experience of token approvals and transfers.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.



