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-1820, which replaces ERC-820 and fixes an incompatibility introduced by the Solidity 0.5 compiler.
This article translates, summarizes, and supplements the material linked below.
ERC-1820 fixes a compatibility issue affecting ERC-820 after the Solidity update. As the two standards are otherwise functionally equivalent, this article focuses on the proposal's overview, the fix, and the relevant contract code.
I have also covered other ERCs.
Overview
The standard provides a registry contract through which contracts and accounts can register the interfaces they support and the contracts implementing those interfaces.
It also maintains compatibility with ERC-165.
Contracts and externally owned accounts can advertise functionality implemented either directly or through a separate implementing contract. Anyone can query the registry to determine whether an address supports a particular registered interface and identify its implementer.
The registry can be deployed at the same deterministic address on different compatible blockchains.
An interface hash whose final 28 bytes are zero is interpreted as an ERC-165 interface identifier. For these identifiers, the registry can query ERC-165 support on the target contract.
The registry also provides caching functionality for ERC-165 support, which can reduce the cost of repeated queries when the cache is appropriately maintained.
The original announcement reproduced in the Japanese article states:
:information_source: ERC-1820 has superseded ERC-820. :information_source: ERC-1820 fixes the incompatibility in the ERC-165 logic which was introduced by the Solidity 0.5 update. Have a look at the official announcement, and the comments about the bug and the fix. Apart from this fix, ERC-1820 is functionally equivalent to ERC-820.
:warning: ERC-1820 MUST be used in lieu of ERC-820. :warning:
In other words, ERC-1820 replaces ERC-820 to resolve the ERC-165 compatibility problem introduced by Solidity 0.5. Developers should use ERC-1820 rather than the superseded registry.
The bug report explains that the new Solidity compiler enforces padding of call arguments. A compiled supportsInterface(bytes4 interfaceID) function checks whether the calldata after the four-byte selector contains at least one 32-byte argument word. The earlier noThrowCall implementation supplied only eight bytes in total, causing the called contract to revert. Increasing the input length to 0x24 bytes allowed the reported test to pass.
The reporter also noted uncertainties about the analysis and whether the issue should be attributed to the compiler or the specification, but raised it so the community could investigate.
The compatibility issue arises because Solidity 0.5 enforces the ABI argument padding requirements more strictly.
Consider TestERC165.sol, which includes supportsInterface(bytes4 interfaceID) for checking whether a contract supports an interface.
A correctly ABI-encoded call contains a four-byte function selector followed by a 32-byte argument word. ERC-820's noThrowCall supplied only 0x8 bytes, which was insufficient for the new compiler's checks.
Changing the call size to 0x24 bytes supplies the complete argument word and resolves the reported revert.
Compiler changes can therefore affect previously functioning integrations, particularly where hand-written low-level calls do not follow the complete ABI encoding convention.
Contract Code
The following is the definition of noThrowCall in ERC-820.
function noThrowCall(address _contract, bytes4 _interfaceId)
internal view returns (uint256 success, uint256 result)
{
bytes4 erc165ID = ERC165ID;
assembly {
let x := mload(0x40) // Find empty storage location using "free memory pointer"
mstore(x, erc165ID) // Place signature at beginning of empty storage
mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature
success := staticcall(
30000, // 30k gas
_contract, // To addr
x, // Inputs are stored at location x
0x08, // Inputs are 8 bytes long
x, // Store output over input (saves space)
0x20 // Outputs are 32 bytes long
)
result := mload(x) // Load the result
}
}The following is its definition in ERC-1820.
function noThrowCall(address _contract, bytes4 _interfaceId)
internal view returns (uint256 success, uint256 result)
{
bytes4 erc165ID = ERC165ID;
assembly {
let x := mload(0x40) // Find empty storage location using "free memory pointer"
mstore(x, erc165ID) // Place signature at beginning of empty storage
mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature
success := staticcall(
30000, // 30k gas
_contract, // To addr
x, // Inputs are stored at location x
0x24, // Inputs are 36 (4 + 32) bytes long
x, // Store output over input (saves space)
0x20 // Outputs are 32 bytes long
)
result := mload(x) // Load the result
}
}The principal difference concerns the length of the call input. This change resolves the incompatibility introduced by Solidity 0.5.
Input Length
ERC-820
0x08- Eight bytes.
- The ERC-165 function selector occupies four bytes, and the interface ID itself occupies four bytes.
- This omits the remaining padding required for the ABI-encoded argument word and can cause the called function to revert.
ERC-1820
0x24- 36 bytes: four bytes for the function selector and 32 bytes for the ABI-encoded argument.
- This accommodates Solidity 0.5's argument validation and resolves the compatibility problem.
Purpose of the Function
Both implementations use a static call to query a contract's interface support while handling failed calls without automatically propagating their reverts.
This allows the registry to determine whether the target contract supports a particular interface.
ERC-1820's noThrowCall increases the input size to 36 bytes, making the low-level call conform to the ABI argument padding requirements enforced by Solidity 0.5.
Conclusion
ERC-1820 replaces ERC-820 and fixes its ERC-165 compatibility issue while preserving the registry's core functionality.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.


