ERC-6944 ERC-5219 resolve mode
Draft · Other · created 2023-04-27
Defines a new resolve mode, "5219". A contract uses this value to announce, within the ERC-4804 address scheme, that it responds to resource requests using the ERC-5219 approach.
Why it is needed
ERC-4804 defines a way to access resources on an Ethereum contract using a web-like URL. The resolve mode is the value that determines how the contract should interpret and respond to the request, and at the time the source was written there were two options: "auto", meaning automatic resolution, and "manual", meaning manual resolution. Meanwhile, ERC-5219 defines a separate interface by which a contract receives and responds to resource requests. However, without a standard way to announce, within the ERC-4804 scheme, that a given contract responds using the ERC-5219 approach, clients cannot know in advance what format to use when sending requests to that contract. This standard connects the two standards by adding a new value, "5219", to the resolve mode.
What to implement
function resolveMode() external pure returns (bytes32 mode);: Returns this contract's ERC-4804 resolve mode. It must return "5219" to be interpreted using the ERC-5219 approach.
In depth
resolveMode return value
The resolveMode function is declared as external pure and returns a single bytes32 value. To be interpreted using the ERC-5219 approach, it must return "5219", which in hexadecimal is 0x3532313900000000000000000000000000000000000000000000000000000000. This value is interpreted case-insensitively. At the time the source was written, the other available choices were "auto", meaning automatic resolution, and "manual", meaning manual resolution.
Inheriting IDecentralizedApp
The standard interface IERC5219Resolver inherits from IDecentralizedApp. The source's comments state that IDecentralizedApp is the ERC-5219 interface. Therefore, a contract that wants to use ERC-5219 as an ERC-4804 resolve mode must not only add the resolveMode function but also implement the resource request handling functionality defined by ERC-5219. The actual method of processing requests follows the ERC-5219 specification, not this standard.
Why ERC-165 is not used
This standard does not use ERC-165 to check support. ERC-165 is a general way for a contract to be queried about whether it implements a specific interface, but the source explains that interoperability can be checked simply by calling resolveMode directly and checking its return value. From the client's perspective, resolveMode must be called anyway to learn the resolution method, so a single function call can also determine whether the ERC-5219 approach is used.
Reference implementation and backward compatibility
The source presents the abstract contract ERC5219Resolver as a reference implementation. This contract inherits from IDecentralizedApp and returns the string literal "5219" from resolveMode. Since the return type is bytes32, this value is treated as the 32-byte value starting with 0x35323139 required by the specification. The part that actually handles resource requests is left for implementers to fill in, since it is an abstract contract. The source states that no backward compatibility issues have been found.
A proposal still in Draft status
This proposal was created on April 27, 2023 and its current status is Draft. A proposal in Draft status may change or stall, so it is advisable to check the latest source before implementing it. This standard also belongs to the ERC category of the Standards Track and designates ERC-4804 and ERC-5219 as required standards, so implementing it requires reading the specifications of both standards together.
Things to watch out for
- The security considerations of the preceding standards apply as is: The original text states that this standard does not add new security considerations of its own, and that the security considerations of ERC-4804 and ERC-5219 apply as is. Implementers should review the relevant sections of both standards before implementation.