ERC-5289 · Review · ERC · 2022-07-16
ERC-5289: Ethereum Notary Interface
An on-chain library of legal documents that wallets show to users and record as signed, so a smart contract can require agreement to terms (like an NFT license) before a call succeeds.
What problem does it solve?
NFTs are often marketed as conveying rights to a work, but in practice most carry no legally meaningful terms at all, and when they do, the license often covers only the first buyer. There is no standard way for a contract to say "you must agree to this document first", or for anyone to later check that a given address agreed to it.
ERC-5289 proposes a "notary" contract that stores links to immutable legal documents and records which addresses have signed them, plus a wallet flow that presents the document to the user before signing.
The spec itself notes that its authors are not lawyers and that it is not legal advice.
How it works
A library contract implements IERC5289Library (detectable via ERC-165):
| Function | Purpose |
|---|---|
legalDocument(documentId) |
Immutable link to the document (IPFS recommended; PDF, HTML, TeX or Markdown) |
documentSigned(user, documentId) |
Whether user has signed |
documentSignedAt(user, documentId) |
When they signed (uint64 timestamp) |
signDocument(signer, documentId) |
Records a signature; must validate and emit DocumentSigned or revert |
Documents are identified by a uint16, so one library holds up to 65,536 documents.
Requesting a signature: a contract that needs agreement reverts with an ERC-5568 wallet signal whose instruction type is 5289 and whose data is abi.encode(libraryAddress, documentId).
Signing: a compatible wallet catches that signal, calls legalDocument, displays the document, and asks the user to sign or cancel. If they agree, the wallet sends signDocument. The user can then retry the original action.
Sample code
A contract that requires a license to be signed before minting:
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;
interface IERC5289Library {
event DocumentSigned(address indexed signer, uint16 indexed documentId);
function legalDocument(uint16 documentId) external view returns (string memory);
function documentSigned(address user, uint16 documentId) external view returns (bool);
function documentSignedAt(address user, uint16 documentId) external view returns (uint64);
function signDocument(address signer, uint16 documentId) external;
}
// ERC-5568 signal, see that proposal for the exact definition
error WalletSignal24(uint24 instruction_id, bytes instruction_data);
contract LicensedMint {
IERC5289Library public immutable library_;
uint16 public constant LICENSE_ID = 1;
constructor(IERC5289Library lib) { library_ = lib; }
function mint() external {
if (!library_.documentSigned(msg.sender, LICENSE_ID)) {
revert WalletSignal24(5289, abi.encode(address(library_), LICENSE_ID));
}
// ... mint to msg.sender
}
}
Things to know
- Status: Review. It depends on ERC-5568, which is also not final, and on wallets adding support for the signing prompt.
- Whether an on-chain "signature" is legally binding depends on jurisdiction and circumstances; this standard does not settle that question.
- The spec's key security point: someone can always claim their key was stolen. Documents should therefore be permissive (granting rights, such as a license to use an image), never restrictive (imposing obligations on the signer).
signDocumenttakes no ECDSA signature by design, to stay compatible with smart-contract accounts.