ARC-0721: Aleo Non-Fungible Token Standard #36
Replies: 2 comments 2 replies
-
As an aside, if the string literal support is definitely going to be added, then instead of doing ascii encoded u128s, we should definitely change this ARC to use strings. |
Beta Was this translation helpful? Give feedback.
-
I come from Solana and have some recommendations based on my past 2 years of working on NFT infrastructure for that blockchain.
Though I think its good to look at ERC-721 and see if it can if Aleo can implement it. I don't think its what mainstream adoption requires. Instead of thinking in terms of tokens we need to think about assets both digital and real world. How can Aleo be used to represent a verity of asset types and provide a decentralized marketplace for selling, transferring, and governing ownership over such assets. Appreciate the proposal and looking forward to hearing others thoughts. |
Beta Was this translation helpful? Give feedback.
-
arc: 0721
title: Aleo Non-Fungible Token Standard
authors: fulltimemike, evanmarshall, JohnDonavon, dagarcia7
discussion: ARC-0721 Aleo Non-Fungible Token Standard
topic: Application
status: Draft
created: 2023-7-19
Abstract
NFTs on Aleo are uniquely positioned to provide a private minting experience, the basis for private identity authorization, and allow for unique collectibles where ownership does not have to be publicly broadcasted. Additionally, by having a standard for NFTs on Aleo, wallets in the ecosystem can support all contracts that implement the standard without having to build support for individual NFT collections. NFT contracts on Aleo have been popular so far, and a standard is needed to ensure uniform support across all collections.
The ethereum NFT standard could adopted fairly closely, as we could force all operations to happen in public state, however, we would rather see Aleo NFTs provide extra functionality that only a ZK L1 can provide.
This standard is meant to build on top of the foundation laid by ERC-721.
Specification
Required Architecture:
Required Structs
// NFTs must have a base folder in which their data contained with jsons are stored. The base uri struct contains 8-bit ASCII encoded text. Aleo instructions do not support strings, but NFTs need to have an accessible base uri to fetch information from.
// Different NFT projects may require more text or less text as necessary, so additional data properties can be added to the BaseURI to account for needed character length.
// The data for a base uri should be padded by 0s on the end of the struct, as 0 does not correspond to a valid ASCII character.
// An example of a BaseURI struct that matches google.com/: google.com/ to 8-bit ascii, padded with 0s on the end = 01100111011011110110111101100111011011000110010100101110011000110110111101101101001011110000000000000000000000000000000000000000
// As a u128 would be BaseURI { data1: 137489088058657146712104188238903640064u128 }
// The token id struct is used with the base uri to provide a full url to a json representing the nft data. This structure should follow the base uri example as before, with the string text being 8-bit ASCII encoded, and padded with any extra 0s on the end.
Required Records
// In order to display all NFTs corresponding to this standard across wallets, a standard NFT record has to be adopted. The minimum information needed for an NFT is the owner; the data, which corresponds to the TokenId that uniquely identifies that NFT's information in the base uri folder; and the edition, which is the nth copy of the NFT. For completely unique collections, all the editions should be 0. If collections have duplicates, then the editions should increment by one.
Required Mappings
// In order to hold NFTs in public state, we need a mapping between a representation of each unique NFT and the address of the NFT owner. Multiple NFTs can be owned by the same address, so address cannot be the key. The field key must be a bhp:256 commitment to a hash of the TokenId and edition scalar.
mapping nft_owners: field => address;
// In order to hold the base uri in public state, we need a mapping that corresponds to all of the pieces of the base uri. By having the base uri in a publicly accessible mapping, the amount of data required to be held in each individual NFT record is lessened, and the base uri is tied to the program. The base uri can be updated.
mapping base_uri: u8 => u128;
Required Functions
// In order to keep track of a user's public state, there must be a standard function for converting potentially private NFT records to public state. In this way, we can follow the blockchain history to associate a given TokenId and edition that went from private to public. In the following function, the input to the finalize is the owner address of the nft, as well as the unique field that identifies that NFT. This field must be calculated in a standardized way, in order for wallets and rpcs to keep track of which unique field identifier corresponds to which tokenId + edition. In other words, we need a reverse mapping off-chain to associate these fields with NFTs.
// In order to keep track of which unique NFT belongs to the public state, a standard function for public transference must be adopted. The receiver address and the NFT data (tokenId + edition) are necessary inputs, so that wallets and rpcs can associate a given NFT with the finalized mapping values in nft_owners.
// In order to prove that you own an NFT without revealing which NFT, we introduce a novel function + finalize construct. Calling this "burn" function will only work if you indeed own the record, which will allow an inclusion proof to be generated and shared off-chain without actually burning the record, as the finalize body is guaranteed to fail.
The ERC-721 standard allows for issuing approvals to addresses to be able to control an NFT. In Aleo, this could be done by maintaining a mapping of approved addresses to the unique identifying field for an NFT. This would allow programs to manage public NFTs, which may be necessary for swaps and escrow type contracts. As a community, we should decide whether or not approval issuance is a requirement for the NFT contract standard. The self.parent ARC (https://github.com/AleoHQ/ARCs/tree/master/arc-0030) has been added, so we should consider that this is an available method to add for this ARC.
Optional:
This section is a collection of ideas and features that NFT contracts meeting the above standard can provide.
NFTs can have a symbol associated with them. The privacy pride symbol is LION.
Public minting:
NFTs can be publicly minted using the concept of a whitelist that holds addresses in public state, and only allows those addresses to mint the NFT when minting is allowed. link example to privacy pride program
Private minting:
NFTs can be privately minted by issuing minters a claim record which a finalize block associates with a given NFT, thereby taking it out of the mintable NFT set. Then, the claim record owner can spend their claim record to redeem the NFT record that was set aside for them, which allows them to privately mint the NFT without revealing whom they are.
Private whitelist minting:
Whitelist records can be issued to minters, who must spend that whitelist record in order to mint.
Toggleable Settings:
Public mappings that maintain setting values can be a part of the contract, and can allow for unique behavior, such as:
Reference Implementations
Implementation for a public whitelist mint: https://github.com/demox-labs/art-factory/blob/v3/program/src/main.leo
Implementation for a private optional whitelist mint: https://github.com/demox-labs/art-factory/blob/v4/program/src/main.leo
Dependencies
As this is an application ARC, there are no dependencies other than what is currently available in Aleo, as well as ARC-30, if we want to include allowance issuances.
Backwards Compatibility
Not necessary.
Security & Compliance
This is an application ARC standard, so this only affects the security of managing assets on-chain. As the standard NFT contract, i.e. a pseudo-interface that must be implemented, there are not enough requirements to guarantee safety of NFTs for any given asset owner. Safety and compliance will be on a contract-by-contract basis.
References
https://eips.ethereum.org/EIPS/eip-721
https://github.com/AleoHQ/ARCs/tree/master/arc-0030
https://github.com/demox-labs/art-factory
Beta Was this translation helpful? Give feedback.
All reactions