Odak modu
Token Metadata is the information of a token, like the name, the symbol, and the logo. Notice how the various tokens in your wallet have this stuff except the token you made?
That's all metadata! This is applicable to all tokens, not just fungible currencies. On Solana, NFTs are just like any other tokens, except the metadata defines them as NFTs via attributes such as the decimals.
This is all done using the Token Metadata Program - one of the most important programs when dealing with Tokens and NFTs on the Solana blockchain. Its main goal is to attach additional data to fungible or Non-Fungible Tokens on Solana. It does this using Program Derived Addresses (PDAs) that are derived from the address of Mint Accounts.
Once we've made a shiny new token, we need to make it fancy. We'll use the Token Metadata Program to do this, here's what the generated account will look like:
This is called the Metadata Account. It can store a variety of information about a specific Token Mint Account. You'll notice there's a URI
(Uniform Resource Identifier) attribute - this points to a JSON file off-chain which is used mainly for NFTs. Since the off-chain portion isn't constrained by on-chain fees, you can store high quality graphics any other large data objects.
The Metadata account has a lot of values, you don't need to know about most of them. We'll dive into the relevant bits as we need them. Right now, we just care about the off-chain part, which is the first thing we'll need to make for Pizzacoin.
The off-chain portion follows the Metaplex token standard, which is basically a format that you need to follow for implementing metadata for different types of tokens. We tell all the apps on the network which type our token is in the Token Standard
field on the on-chain part of the Metadata account. Our options are:
NonFungible
: A non-fungible token with a Master Edition. (NFTs)FungibleAsset
: A token with metadata that can also have attributes, sometimes called Semi-Fungible. (ex. game-items)Fungible
: A token with simple metadata. (regular tokens like USDC or SOL)NonFungibleEdition
: A non-fungible token with an Edition account (printed from a Master edition, think 1 of 100).The Metaplex Token Standard is accepted throughout the industry. All the various apps, exchanges, and wallets expect tokens to conform to it. The Token Standard is set automatically by the Token Metadata program and cannot be manually updated. Here's how it figures out how to apply the correct standard:
NonFungible
.NonFungibleEdition
.FungibleAsset
.Fungible
.You can ignore what "Master Edition" means right now, Pizzacoin is entirely fungible so we'll be focusing on Fungible
tokens.
Welcome to one of the most useful SDKs on Solana. If you've ever minted an NFT on Solana, you've likely used the Metaplex SDK without knowing it. We'll use the @metaplex-foundation/js
and @metaplex-foundation/mpl-token-metadata
libraries to create a metadata account associated with our token mint. Time to give Pizzacoin an identity.
We'll start with the off-chain portion, and only once that's ready will we move on to creating the Token Metadata account.
The general workflow will be:
You are now ready to do the on-chain stuff. 4. Derive the Metadata Account PDA (the egg) 5. Create the on-chain Token Metadata account - instruction, transaction, etc.
Feeling unsure? Let's vanquish those feelings with some CODE 🤺
Sektörde en çok aranan yazılım becerilerini kazan
Yapay zeka desteği, birebir mentörlük saatleri, canlı dersler ve senin için özel hazırlanmış içeriklerle eksiklerini tamamla, düzenli geri bildirimler al ve öğrenme sürecini en verimli hale getir.
Yunus Emre Kabakcı
Patika+ mezunuPatika+ Fullstack Web Development Bootcamp mezunumuz Yunus Emre,
3 ay içinde Katar’dan aldığı teklif ile, global bir şirket olan Pavo Group’da işe başladı!
“İçerik zenginliği, mentor desteği, ileriye dönük bir network sağlaması ve dünyada en çok tercih edilen frameworkler üzerinden bir eğitim veriyor olması Patika+’ı tercih etmemin temel sebepleri oldu!“
Yorum yapabilmek için derse kayıt olmalısın!