はじめに
ファンジブルトークンをミントする
Last updated November 28, 2025
追加のファンジブルトークンをミントして、Solana上のトークンの流通供給量を増加させます。
トークンをミントする
以下のセクションでは、完全なコード例と変更が必要なパラメータを確認できます。これは、すでにファンジブルトークンを作成していて、より多くのトークンをミントしたい場合を想定しています。
1// To install all the required packages use the following command
2// npm install @metaplex-foundation/mpl-toolbox @metaplex-foundation/umi @metaplex-foundation/umi-bundle-defaults
3import {
4 createTokenIfMissing,
5 findAssociatedTokenPda,
6 mintTokensTo,
7} from '@metaplex-foundation/mpl-toolbox';
8import {
9 keypairIdentity,
10 publicKey,
11 transactionBuilder,
12} from '@metaplex-foundation/umi';
13import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
14import { readFileSync } from 'fs';
15
16// Initialize Umi with Devnet endpoint
17const umi = createUmi('https://api.devnet.solana.com')
18
19// Load your wallet/keypair
20const wallet = '<your wallet file path>'
21const secretKey = JSON.parse(readFileSync(wallet, 'utf-8'))
22const keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secretKey))
23umi.use(keypairIdentity(keypair))
24
25// Your token mint address and destination wallet
26const mintAddress = publicKey('<your token mint address>')
27const destinationAddress = publicKey('<destination wallet address>')
28
29// Find the destination token account
30const destinationTokenAccount = findAssociatedTokenPda(umi, {
31 mint: mintAddress,
32 owner: destinationAddress,
33})
34
35// Create the destination token account if it doesn't exist and mint tokens
36await transactionBuilder()
37 .add(createTokenIfMissing(umi, {
38 mint: mintAddress,
39 owner: destinationAddress,
40 }))
41 // Mint 100 tokens to the destination
42 .add(
43 mintTokensTo(umi, {
44 mint: mintAddress,
45 token: destinationTokenAccount,
46 amount: 100,
47 }))
48 .sendAndConfirm(umi)
49
50console.log('Minted 100 tokens')
51console.log('Mint:', mintAddress)
52console.log('To:', destinationTokenAccount)
1# Mint Additional Tokens using the Metaplex CLI
2
3# Mint tokens to your own wallet (default)
4# Usage: mplx toolbox token mint <MINT_ADDRESS> <AMOUNT>
5mplx toolbox token mint <MINT_ADDRESS> <AMOUNT>
6
7# Mint tokens to a specific recipient
8mplx toolbox token mint <MINT_ADDRESS> <AMOUNT> --recipient <RECIPIENT_ADDRESS>
9
10# Example: Mint 1000 tokens (0 decimals) to your wallet
11mplx toolbox token mint 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 1000
12
13# Example: Mint 1000 tokens (9 decimals) to your wallet
14# Amount is in smallest units: 1000 * 10^9 = 1000000000000
15mplx toolbox token mint 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 1000000000000
16
17# Example: Mint tokens to another wallet
18mplx toolbox token mint 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 1000 \
19 --recipient 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
20
21# Note: You must be the mint authority to mint additional tokens
パラメータ
ミント操作に合わせて以下のパラメータをカスタマイズしてください:
| パラメータ | 説明 |
|---|---|
mintAddress | トークンミントアドレス |
destinationAddress | トークンを受け取るウォレットアドレス |
amount | ミントするトークン数 |
仕組み
ミントプロセスには3つの手順が含まれます。使用するツールによって、手動で実行する必要があるかどうかが異なります。以下の手順はumiに焦点を当てています:
- 宛先トークンアカウントを見つける -
findAssociatedTokenPdaを使用して受取人のトークンアカウントを特定 - 必要に応じてトークンアカウントを作成 -
createTokenIfMissingを使用して受取人がトークンアカウントを持っていることを確認 - トークンをミント -
mintTokensToでミントを実行
要件
追加のトークンをミントするには、ミント権限者である必要があります - ミント権限者として指定されたウォレットのみが新しいトークンをミントできます
重要な注意事項
- 使用するツールによって、小数点以下桁数を考慮する必要があるかどうかが異なります。
amountは小数点以下桁数を考慮する必要があります(例:9桁の場合、1トークンのミントにはamount: 1_000_000_000が必要) - 任意のウォレットアドレスにミントできます—トークンアカウントが存在しない場合は作成されます
- ミント権限者のみが新しいトークンをミントできます
