ERC-7015 · Review · ERC · 2023-05-11
ERC-7015: NFT Creator Attribution
NFT contracts emit a signed `CreatorAttribution` event at deployment, so platforms can credit the real creator even when someone else (a smart wallet, relayer or first collector) paid for the deploy.
What problem does it solve?
NFT platforms usually treat whoever deployed a collection's contract as its creator. That breaks more and more often: creators use smart wallets, platforms sponsor gas, or "lazy" flows let the first collector deploy the contract when they mint. In each case the deployer is not the artist, and the wrong account gets the credit.
ERC-7015 lets the creator sign the creation parameters off-chain. Whoever deploys, the contract verifies that signature and records it in an event that platforms can check.
How it works
- Creator signs. The creator signs an EIP-712 typed message describing the creation, for example name, symbol, metadata URI or price. The struct is up to the app; only its hash (
structHash) is needed later. The EIP-712 domain'sverifyingContractis the NFT contract's address, which can be computed before deployment. - Contract verifies and emits. During the deployment transaction, the NFT contract checks the signature and emits:
event CreatorAttribution(
bytes32 structHash,
string domainName,
string version,
address creator,
bytes signature
);
- Platforms check. An indexer rebuilds the EIP-712 digest from
domainName,version, the chain id and the emitting contract asverifyingContract, then recovers the signer fromsignature. If it matchescreator, attribution must go tocreator, not to the transaction sender.
chainId and verifyingContract are not in the event because they are implied by the transaction and the emitter. The reference implementation supports smart-account creators via ERC-1271 as well as EOAs.
Sample code
Contract side (abridged from the reference implementation):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
abstract contract ERC7015 is EIP712 {
event CreatorAttribution(bytes32 structHash, string domainName, string version, address creator, bytes signature);
error Invalid_Signature();
constructor() EIP712("ERC7015", "1") {}
function _attribute(bytes32 structHash, address creator, bytes memory sig) internal {
bytes32 digest = _hashTypedDataV4(structHash);
if (!SignatureChecker.isValidSignatureNow(creator, digest, sig)) revert Invalid_Signature(); // EOA or ERC-1271
emit CreatorAttribution(structHash, "ERC7015", "1", creator, sig);
}
}
Platform side, checking an EOA creator from the event (ethers v6):
import { TypedDataEncoder, concat, keccak256, recoverAddress } from "ethers";
const { structHash, domainName, version, creator, signature } = log.args;
const domainSep = TypedDataEncoder.hashDomain({
name: domainName, version, chainId, verifyingContract: log.address,
});
const digest = keccak256(concat(["0x1901", domainSep, structHash]));
const ok = recoverAddress(digest, signature).toLowerCase() === creator.toLowerCase();
Things to know
- Status: Review. Not Final yet.
- The event must be emitted in the deployment transaction, so existing NFT contracts cannot adopt it after the fact.
- It proves that an address consented, not who the person behind it is.
- Creators should read what they are signing; a phishing site could trick them into signing attribution for a collection they did not intend.
- ERC-5375 tackles a similar problem with off-chain data. ERC-7015 keeps the proof fully on-chain and can cover a whole collection.