NFTs are currently difficult to buy, sell and hold on the Stellar network. This new standard for NFTs allows for them to be managed using Stellar’s Turing Signing Servers to facilitate the buying and selling of NFTs along with adding features.
This is the typical process you’ll go through to create a new NFT:
- Gather NFT data such as name, image etc
- Upload image to IPFS to retrieve the image CID and image URL
- Create the new Stellar asset issuer account
- Elect/Create distributor account, add trust line and send integer number of tokens from issuer
- Define the Asset TOML using the new issuer details, asset information plus image URL
- Define the NFT TOML file, upload to IPFS and record the CID
- Update the asset with a single sandwich transaction:
- Define royalties via managed data
- Define the asset domain
- Add the signer turrets
- Lock account
Assets are named NFT and the issuer account is the unique identifier that is associated with the account. This allows wallets to display NFTs in separate areas to the fungible assets.
It is necessary to define the number of NFTs that are to be created at the start of the creation of the NFT. Normally this will be 1 for a single NFT, or some other integer if you are issuing more than one.
Once you complete creation of your NFT you’ll lock the account, so make sure the supply is defined.
Example of a Asset TOML file for an NFT - this is the traditional TOML file required to document a Stellar asset:
[DOCUMENTATION]
ORG_URL="https://theorg.url"
[[CURRENCIES]]
code="NFT"
issuer="GCACKMQHO44XQC7JAKLDDZDUPPZH7LXUPHP7HHJ2VCTIVELSXNKOWYIJ"
name="Title of the NFT"
desc="Supporting description of the NFT"
image="https://ipfs.io/ipfs/QmRwPzCAjYRPPePykh4umGcrdRCeNuupAjqsN8NHNi2fXm"
This is uploaded to IPFS, the resulting CID is stored in the asset Managed Data. Example of a NFT TOML file for an NFT:
{
"name":"Title of the NFT",
"description":"Supporting description of the NFT",
"image":"ipfs://QmRwPzCAjYRPPePykh4umGcrdRCeNuupAjqsN8NHNi2fXm",
"url":"https://ipfs.io/ipfs/QmRwPzCAjYRPPePykh4umGcrdRCeNuupAjqsN8NHNi2fXm",
"code":"NFT",
"issuer":"GCACKMQHO44XQC7JAKLDDZDUPPZH7LXUPHP7HHJ2VCTIVELSXNKOWYIJ",
"supply":5,
"conditions":"Optional conditions depending on royalty policy defined in the txFunctions",
"domain":"task.io/actasia",
"attributes" :
{
"Number of organizers 组织者人数" : "5",
"Estimated number of animals reached" : "20~50",
"Events photos_1" : "https://ipfs.io/ipfs/QmRwPzCAjYRPPePykh4umGcrdRCeNuupAjqsN8NHNi2fXm"
},
}
- Domain field = creator profile of the NFT
Royalty payments are to be entered as a manage data entry for the issuing account. However, there are two entries that are not for royalties. They are as follows:
- ipfshash” = “” to the issuer account
- “nft_initial_account_holder” - the stellar address of the first “owner” to sell it, so we can determine if this is the first sale or a consecutive sale
After these two entries are added the royalties for the remaining parties that are involved with the NFT. The following layout is how to add the royalties as a manage data keypair:
royalty_role-link_xxx_initial_ongoing : wallet_address
- xxx is the percentage of the sale price of the NFT that the organisation is taking. It is a number with out the percentage symbol
- "role-link" is the royalty association (i.e. how the account is related to this payment)
The following is an example of how these royalties can be laid out:
- royalty_campaign_xxx_initial : wallet_address
- royalty_campaign_xxx_ongoing : wallet_addreess
The turrets that hold the txFunctions that manage the buying and selling of the NFTs need to have signing rights on the account to enable the trustlines of the asset being traded. To do so there is a list of public keys that need to be added to the issuing account as a signer.
The following public keys are to manage selling NFTs
INSERT PUBLIC KEYS HERE
The following public keys are to manage buying NFTs
INSERT PUBLIC KEYS HERE
Once all of the above details have been completed for the issuing account the original signing key is to be removed from the account. This then forces all transactions to be facilitated through the use of the txFunctions and the royalties that are implemented in the issuing account will be paid.
NFTs created using this method will be managed through two functions that run on the Stellar Turret Signing Server. The two functions are NFT-Buy-txFunction and NFT-Sell-txFunction. These functions take in the same values which are listed below.
Var walletAddr = "GBPDHJ6MJFCBFHABJAL75SUH627MDC4MKYY5IQJGUIWRD6YI74CYWGBW";
var nftCode = "NFT";
var nftIssuer ="GBRGA7JCOFLEA7W3MA33LQC3UY2QGRNWRSU2U2OQWVYKTSIC6AJWFYBA";
var price = 10.00;
var quantity = 1;
The txFunctions operate through API calls and responses, there is a list of the URLs at which the txFunctions are located that the wallet can make the buy and sell calls to. To do so a POST request is made with an aut
The post requests require that an authorisation token is used, this is a bearer token and can be made using the following runkit example. This token is per turret and can be set up to satisfy both the buy and sell function. It uses a claimable balance which the turret will keep track on and claim once enough requests have been made for the functions that have been assigned to the turret.
- Authorisation Token link: https://runkit.com/mootz12/60d1f69582e0580013bb591e
- Further Authorisation information: https://tyvdh.github.io/stellar-tss/#section/Authentication
Once the authorisation token has been built then the request can be made using the following steps:
- User selects to sell/buy an NFT.
- The wallet takes the request and the input values as listed above and makes a POST request to the turret on behalf of the wallet.
- The wallet will complete this task based on how much security is determined
- The turret sends a result of an XDR along with a signature for the transaction.
- There will be multiple responses and multiple signatures based on the security level.
- The wallet will then combine multiple signatures with the XDR that the turrets returned.
- The wallet will then submit the transaction with the signatures to the network along with the signature from the seller.