Some NFT use-cases require to have dynamic data associated with a non-fungible token that can change during its lifetime. Examples for dynamic data:
- cryptokitties that can change color
- intellectual property tokens that encode rights holders
- tokens that store data to transport them across chains
The existing metadata standard does not suffice as data can only be set at minting time and not modified later.
## Abstract
Non-fungible tokens (NFTs) are extended with the ability to store dynamic data. A 32 bytes data field is added and a read function allows to access it. The write function allows to update it, if the caller is the owner of the token. An event is emitted every time the data updates and the previous and new value is emitted in it.
## Motivation
The proposal is made to standardize on tokens with dynamic data. Interactions with bridges for side-chains like xDAI or Plasma chains will profit from the ability to use such tokens. Protocols that build on data tokens like [distributed breeding](https://ethresear.ch/t/a-distributed-breeding-function/5264) will be enabled.
*@dev Reads the data of a specified token. Returns the current data in
* storage of `tokenId`.
*
*@param tokenId The token to read the data off.
*
*@return A bytes32 representing the current data stored in the token.
*/
function readData(uint256 tokenId) external view returns (bytes32);
/**
*@dev Updates the data of a specified token. Writes `newData` into storage
* of `tokenId`.
*
*@param tokenId The token to write data to.
*@param newData The data to be written to the token.
*
* Emits a `DataUpdated` event.
*/
function writeData(uint256 tokenId, bytes32 newData) external;
}
```
## Rationale
The suggested data field in the NFT is used either for storing data directly, like a counter or address. If more data is required the implementer should fall back to authenticated data structures, like merkle- or patricia-trees.
The proposal for this ERC stems from the [distributed breeding proposal](https://ethresear.ch/t/a-distributed-breeding-function/5264) to allow better integration of NFTs across side-chains. [ost.com](https://ost.com/), [Skale](https://skalelabs.com/), [POA](https://poa.network/), and [LeapDAO](https://leapdao.org/) have been part of the discussion.
## Backwards Compatibility
🤷♂️ No related proposals are known to the author, hence no backwards compatibility to consider.