This EIP provides a means to create a standard registry for locating executable scripts associated with the token.
ERC-5169 provides a client script lookup method for contracts. This requires the contract to have implemented the ERC-5169 interface at the time of construction (or allow an upgrade path).
This proposal outlines a contract that can supply prototype and certified scripts. The contract would be a multichain singleton instance that would be deployed at identical addresses on supported chains.
The registry contract will supply a set of URI links for a given contract address. These URI links point to script programs that can be fetched by a wallet, viewer or mini-dapp.
The pointers can be set permissionlessly using a setter in the registry contract.
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
The contract MUST implement the IERC7738 interface.
The contract MUST emit the ScriptUpdate event when the script is updated.
The contract SHOULD order the scriptURI returned so that the ERC-173 owner() of the contract's script entries are returned first (in the case of simple implementations the wallet will pick the first scriptURI returned).
The contract SHOULD provide a means to page through entries if there are a large number of scriptURI entries.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
This method allows contracts written without the ERC-5169 interface to associate scripts with themselves, and avoids the need for a centralised online server, with subsequent need for security and the requires an organisation to become a gatekeeper for the database.
Test cases are included in NFTRegistryTest.test.ts. Contracts, deployment scripts and registry script can be found alongside the test script.
Clone the repo and run:
The live implementation of the script registry is at 0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682 on several mainnet, L2 and testnet chains. To deploy scripts for use you can directly call the setScriptURI function:
or use the bundled ethers script, ensuring to fill in the target contract address and scriptURI:
The scripts provided could be authenticated in various ways:
Ownable interface. Once the script is fetched, the signature can be verified to match the Owner(). In the case of TokenScript this can be checked by a dapp or wallet using the TokenScript SDK, the TokenScript online verification service, or by extracting the signature from the XML, taking a keccak256 of the script and ecrecover the signing key address.If these criteria are not met:
Copyright and related rights waived via CC0.