今日已更新 143 条资讯 | 累计 40588 条内容
关于我们

Building an SPL Token: Creating the Mint

Ladipo Samuel 2026年09月05日 23:30 0 次阅读 来源:Dev.to

Now that we have a mental model of how Solana works, it’s time to actually use it. We’ve talked about accounts holding state, programs containing the logic, instructions telling those programs what to do, and transactions bringing those instructions together. Creating an SPL Token Mint is a good place to see all of those concepts working together. In this part, we’ll create and initialize an SPL Token Mint on Solana Devnet, but more importantly, we’ll break down what is actually happening underneath the code. So, what exactly is a Mint? If I tell Solana to give someone 100 of a particular token, Solana first needs to know what that token is. What defines it? How divisible is it? How many units currently exist? Who has the authority to create more? That is where the Mint Account comes in. A Mint Account represents a particular type of token on Solana. It stores information about that token such as its current supply, decimals, mint authority and optional freeze authority. It does not store how many tokens I personally own. That belongs somewhere else, which we’ll get to when we talk about Token Accounts and ATAs. A simple way to separate the two is this: the Mint tells us what token exists, while a Token Account tells us how much of that token a particular owner holds. Before looking at any code, the complete process for creating our Mint looks like this: Connect to Solana Devnet Load our wallet Generate a new keypair for the Mint Calculate how much space a Mint Account needs Calculate the lamports required for the account Ask the System Program to create the account Ask the Token Program to initialize it as a Mint Put both instructions inside a transaction Sign the transaction Send and confirm it on Solana There are quite a few SDK functions involved when implementing this, but underneath all that syntax, this is really what the entire spl_init.ts file is doing. Starting with the wallet and Mint address We first load our wallet and turn it into a signer. The wallet

本文内容来源于互联网,版权归原作者所有
查看原文