ERC-6997 ERC-721 with a Transfer Validation Step (ERC-721 with transaction validation step.)

Review · NFTs & multi-token · created 2023-05-07

An ERC-721 extension that locks transfers and approvals of an NFT into a pending validation state instead of executing them immediately, requiring a separate validation step before they actually take effect. This prevents an NFT from being immediately drained even if a wallet is compromised.

Why it is needed

On Ethereum, transfers and approvals of NFTs (unique digital assets recorded on the blockchain) execute instantly with a single signature from the owner. If a wallet's private key leaks or a user signs a malicious request via phishing, there is no way to reverse the NFT transfer. The very structure that gives the blockchain its strength, placing full responsibility for data on the user, also becomes its weakness. There have been many real cases of NFT theft, and the conventional way to prevent theft, moving NFTs into a cold wallet (a storage wallet not connected to the internet), makes NFTs inconvenient to use. By placing a validation step before every transfer and approval, a thief would need to obtain both the user's address and the validator address at the same time, making for a much stronger anti-theft system.

What to implement

In depth

Rules for locking transfers and approvals

Any operation that changes NFT ownership, such as transferFrom/safeTransferFrom, SHALL create a pending TransferValidation and emit the ValidateTransfer event, and SHALL NOT transfer ownership. Likewise, any operation that turns on an approval, such as approve/setApprovalForAll, SHALL create an ApprovalValidation and emit the ValidateApproval event, and SHALL NOT turn on the approval. The actual ownership transfer and approval activation are performed by the respective operations that validate each request.

An exception for transfers by approved accounts

If a transfer is called not by the owner but by an already-approved account, it MUST execute immediately without validation. This rule exists to accommodate every current marketplace that requires an approval in order to move an NFT directly. In other words, since validation has already occurred at the approval step, a transfer based on that approval works exactly as before.

Validation is one-time

When validating a TransferValidation or ApprovalValidation, the valid field MUST be set to true, and the same request MUST NOT be validated again. The operation that validates a TransferValidation transfers NFT ownership, and the operation that validates an ApprovalValidation turns on the approval. In the reference implementation, attempting to validate a request that is already valid reverts, and for individual approvals it also checks whether the owner at the time of the request still holds the token.

Interface and implementation requirements

The TransferValidation struct holds the from, to, tokenId, and valid fields, and the ApprovalValidation struct holds the owner, approve, tokenId, approveAll, and valid fields. The isValidatorContract() function MUST be implemented as public. transferValidation(uint256 transferId) and approvalValidation(uint256 approveId) MAY be implemented as public or external, and totalTransferValidations() and totalApprovalValidations() MAY be implemented as pure or view.

The validation method is not specified by the standard

This standard only defines the validation functionality and does not specify how it should be used. The validation operations are defined as internal, and it is up to the implementer to decide what scheme to validate with. For example, a single validator address could be connected to a dapp to let a user manage their validation requests, and this validator could be used for every NFT or only for some users. It could also be implemented as a wrapper contract around an existing ERC-721, allowing a one-to-one conversion with existing NFTs. Any third-party protocol can define any way it wants to call these validation functions.

Backward compatibility

This standard is an extension of ERC-721 and is compatible with every operation except transferFrom/safeTransferFrom/approve/setApprovalForAll. These four operations are redefined to create a validation request instead of transferring ownership or turning on an approval. In the reference implementation, a call that turns off full approval (setApprovalForAll with approved set to false) executes immediately without validation.

Proposal status

This proposal is currently in Review status. As a standard still under review, its content may change.

Things to watch out for

Original ERC · ← ERCs