NFTs and collections
Non-fungible tokens on Lotus: SLP NFT1 and ALP collections, how to create and send them, the pages, the routes and the limits.
Lotus has two kinds of non-fungible tokens. Both are ordinary transactions: the node colours and verifies them in its token indexes, and consensus knows no token. A transaction that breaks a token rule is valid and destroys the tokens it spends, so use a wallet that builds token transactions.
| SLP NFT1 | ALP collection | |
|---|---|---|
| Made of | A group and its children | A collection and its items |
| One item | One child, quantity 1 | Any supply: 1 is unique, more are editions |
| Who can add | Whoever holds group tokens | The holder of the collection's mint baton |
| Picture | The document URL and its SHA-256 | The URL of the item |
SLP NFT1 #
The group is an SLP token. A child is created by a transaction whose first input spends at least one group token; that token is consumed. To create several children, first split the group into outputs of 1.
The document URL is an https:// address, or blob:<sha256> for a file on chain. Wallets show an external picture only after you agree to load it.
ALP collections #
A collection is an ALP token that keeps a mint baton and whose genesis data is LNC1 with no flag. An item is an ALP token with no decimals, created by one transaction that holds the genesis of the item (it names the collection and the item number) and a mint of the collection that spends its baton. An item is shown in a collection only when both are valid, so the node's own ALP check proves that the holder of the collection made it.
Send and burn #
Sending an item is a token send. To burn one on purpose, the wallet asks you to confirm and names the token. Check a transaction before you broadcast it with POST /api/v1/txs/token-check; POST /api/v1/txs/broadcast-checked refuses one that would destroy tokens, unless the request names them in allow_burn.
Pages and routes #
Tokens, ALP, Collections (12.5.13, /dashboard/tokens/alp/collections) shows a collection, an item and the items of an address.
Route under /api/v1 | Content |
|---|---|
alp/token/<id> | The token, with the genesis data |
alp/collection/<id>/items?owner=&limit=&cursor= | The items of a collection and their owners |
alp/address/<address>/items | The items an address holds |
slp/token/<id>, slp/nft/<id> | An SLP token; an NFT1 group or child |
