ERC-7513 Executable Smart NFTs (Smart NFT - A Component for Intent-Centric)
Draft · NFTs & multi-token · created 2023-09-06
Defines a 'smart NFT' that combines an NFT with smart contract execution logic. A holder of the NFT can execute the code embedded within it, and ownership of the code itself can be proven and traded as the NFT.
Why it is needed
Smart contracts still present a high barrier to entry for ordinary users, and NFTs remain stuck in repetitive uses such as proving ownership of artwork, game items, or physical assets. The source text points out three problems arising from this gap. First, users who want smart, convenient features sacrifice security by handing their private keys to automation bots. Second, individual developers lack the resources to turn the features they build into market-ready products. Third, despite the 'code is law' philosophy, there is no on-chain infrastructure to safely transfer ownership of a smart contract or its code. This proposal attempts to bind a piece of code to an NFT so that holding it grants execution rights, letting users use features and trade code ownership on-chain without sharing a private key.
What to implement
function execute(bytes memory data) external payable returns (bool);: Executes the core logic of the smart NFT. It takes the required arguments packed into a single bytes parameter, and the implementation must call validatePermission to confirm the call is legitimate.function validatePermission() external view returns (bool);: Queries the Smart-Manager to confirm that this smart NFT has passed verification and that the caller is permitted to use it.function auditTo(uint256 tokenId, bool isValid) external returns (bool);: A trusted verifier audits the smart NFT and changes its status to VERIFIED or DENIED.
In depth
Three objects and three roles
The spec defines interfaces for three objects: the Smart-NFT, which holds the execution logic; the Smart-Manager, which manages registration and verification status; and the Intent-Proxy, which bundles calls to multiple Smart-NFTs. It also defines three roles that interact with these objects: the developer, who implements and registers code; the verifier, who audits the code and renders a judgment; and the user, who holds and executes the NFT. Code submitted by developers is reviewed by verifiers, and users may only execute verified code by virtue of holding the NFT.
The two functions a Smart-NFT must implement
Before requesting registration with the Smart-Manager, the developer must implement two core interfaces. execute MUST take only a single bytes parameter, which encodes the arguments the smart NFT requires. The implementation MUST also call validatePermission to determine whether the call is legitimate. validatePermission is a function that queries the Smart-Manager to confirm that the smart NFT has passed verification and that the caller is permitted to use it.
Five verification states
The Smart-Manager interface defines five states for a smart NFT. UNREGISTERED is the state of not yet being registered. DEREGISTERED is the state of having been registered and then removed. UNVERIFIED is registered but has not yet gone through the verification process. VERIFIED has passed verification and is safe to use. DENIED has failed verification and may pose a security risk, so it must not be used. verificationStatusOf MUST return the current verification stage of the specified smart NFT.
Registration, auditing, and access determination in Smart-Manager
register is the function through which a developer requests registration by submitting the smart NFT's creation code (creationCode) and total supply (totalSupply); on success it returns the tokenId and implementation address (implAddr), and the smart NFT MUST be marked as UNVERIFIED. auditTo SHOULD be restricted to trusted verifiers and changes the status to VERIFIED or DENIED. isAccessible determines whether a user can use a specific smart NFT, and MUST consider both ownership of the tokenId NFT and whether it has passed verification. The Smart-Manager implementation SHOULD also inherit ERC-1155.
Intent-Proxy and the Action struct
The Intent-Proxy defines an Action struct. tokenId (uint256) is the token ID of the target smart NFT to call, and executeParam (bytes) is the encoded argument defined by the target smart NFT's execute. executeIntent takes an array of desired actions and batch-executes the specified smart NFTs. By abstracting on-chain interactions into multiple feature-module NFTs that can be bundled together, the design lets users focus on their intent rather than on how to operate multiple dapps.
Why ERC-1155 is used
The source text gives two reasons for choosing ERC-1155 as the primary contract rather than creating a new NFT standard. The first is reusability. ERC-1155 introduces the concept of 'shares', so holding even one or more shares grants the right to use that smart NFT's features. It draws an analogy: owning multiple units of the same model of smartphone does not grant extra features, it only lets you use the features of each device. The second is seamless integration with existing markets. Because smart NFT trading can ride directly on current NFT trading platforms, adoption becomes easier for both developers and users. In terms of backward compatibility, all features of ERC-1155, including ERC-165 detection, are retained.
The challenge of decentralized verifiers
In this protocol, verifiers play the key role of reviewing code for security, functionality, and compliance, but the source text acknowledges three difficulties in a decentralized setting. First, specialized programming skill and blockchain knowledge are required, so not just anyone can take on the role. Second, unlike centralized audit firms, it is hard to judge a verifier's expertise and diligence in a decentralized environment, which can lead to faulty audits or abuse. Third, there is a management problem of coordinating the work of multiple verifiers and ensuring consistency of audits across different contracts.
Still in draft stage
This proposal's status is Draft. Because the function names, state definitions, and structure of the spec may change or discussion may stall going forward, the latest source text should be checked before implementing or citing it.
Things to watch out for
- Malicious verifiers: Since the verification step involves human judgment, there is a risk that a verifier could deliberately approve a malicious smart NFT. The source text states that reducing this risk requires stricter verification mechanisms, careful selection of verifiers, penalty measures, and ultimately stricter consensus criteria.
- Verification oversight errors: Even without malicious intent, a smart NFT implementation may be excessively complex, or a vulnerability in the Solidity compiler may cause issues to be missed during verification. The source text suggests using additional auditing tools or having auditTo require audits from multiple verifiers to lower the likelihood of this occurring.