LSP8 - Identifiable Digital Asset
Non-Fungible assets such as ERC721 and ERC1155 tokens have a lot of limitations in terms of metadata, secure transfers, asset representation, and asset interaction. This causes problems for users seeking, full control over which assets they accept or not, more complex NFT functionality, and a simple user experience while creating, buying, and exchanging assets.
LSP8-IdentifiableDigitalAsset is the standard that aims to solve all problems mentioned above by:
- Allowing more secure transfers via force boolean parameter.
- More asset metadata via LSP4-DigitalAssetMetadata.
- More asset representation via bytes32 tokenIds.
- More interaction between the asset contract and the asset sender/recipient via token hooks.
What does this Standard represent?
LSP8-IdentifiableDigitalAsset is a standard that aims to describe non-fungible assets. The term Non-fungible means that each asset is unique and different. They are distinguishable from each other and therefore not interchangeable.
The current NFT standards such as ERC721 and ERC1155 lack asset representation as they define the tokenIds as Numbers
(uint256). Each token from the NFT collection will be defined and queried based on this tokenId, which is normally incremental.
LSP8-IdentifiableDigitalAsset define the tokenIds as bytes32. The choice of bytes32 tokenIds allows a wide variety of applications including numbers, contract addresses, and hashed values (ie. serial numbers).
The bytes32 tokenId can be interpreted as a:
- Hashed Value::
- Contract Address:
TokenIds represented as smart contract address allow the creation of more complex NFTs. When each tokenId is a contract that have its own ERC725Y storage. For instance in a video game, by changing the features and metadata of the tokenId based on the game rules.
The current token standards don't enable attaching metadata to the contract in a generic and flexible way, they set the name, symbol, and tokenURI. This is limiting for a digital asset that may want to list the creators, the community behind it, and to have the ability to update the metadata of the token and the tokenIds over time depending on a certain logic (Evolving tokens).
To ensure a flexible and generic asset representation, the token contract should use the LSP4-DigitalAsset-Metadata. In this way, any information could be attached to the token contract.
The Metadata defined by the ERC725Y Data Keys can be set for each tokenId, not just for the whole NFT collection. Check LSP8 ERC725Y Data Keys in the LSP8 Standard Document.
It is expected in the LUKSO's ecosystem to use smart contract based accounts to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens but they will be mainly used to control these accounts and not to hold tokens.
To ensure a safe asset transfer, an additional boolean parameter was added to the transfer and mint functions:
- If set to False, the transfer will only pass if the recipient is a smart contract that implements the LSP1-UniversalReceiver standard.
It's advised to set the force bool as False when transferring or minting tokens to avoid sending them to the wrong address.
- If set to True, the transfer will not be dependent on the recipient, meaning smart contracts not implementing the LSP1-UniversalReceiver standard and EOAs will be able to receive the tokens.
Implementing the LSP1-UniversalReceiver standard will give a sign that the contract knows how to handle the tokens received.
These methods will make external calls to the
universalReceiver(...) functions of both the sender and recipient.
This function could perform more complex logic, like delegating the call to the
LSP1UniversalReceiverDelegate contract. This contract can contain custom logic for each user. For instance, a user could decide to re-transfer the tokens to another address once they are transferred to his UP.
The current NFTs standards act as registry contracts that keep track of the ownership of each tokenId. They do not implement functionalities to notify the recipient that it has received some tokens or to notify the sender that it has sent some tokens.
During an ERC721 token transfer, the ownership of the tokenId is changed from the sender address to the recipient address without further interaction.
During an LSP8 token transfer, as well as updating the tokenId owenrship, both the sender and recipient are informed of the transfer by calling the
universalReceiever(...) function on their profiles.
In this way, users are informed about the NFT transfers and can decide how to react on the transfer, either by accepting or rejecting the tokens, or implementing a custom logic to run on each transfer with the help of LSP1-UniversalReceiverDelegate.