はじめに

ファンジブルトークンをミントする

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)

パラメータ

ミント操作に合わせて以下のパラメータをカスタマイズしてください:

パラメータ説明
mintAddressトークンミントアドレス
destinationAddressトークンを受け取るウォレットアドレス
amountミントするトークン数

仕組み

ミントプロセスには3つの手順が含まれます。使用するツールによって、手動で実行する必要があるかどうかが異なります。以下の手順はumiに焦点を当てています:

  1. 宛先トークンアカウントを見つける - findAssociatedTokenPdaを使用して受取人のトークンアカウントを特定
  2. 必要に応じてトークンアカウントを作成 - createTokenIfMissingを使用して受取人がトークンアカウントを持っていることを確認
  3. トークンをミント - mintTokensToでミントを実行

要件

追加のトークンをミントするには、ミント権限者である必要があります - ミント権限者として指定されたウォレットのみが新しいトークンをミントできます

重要な注意事項

  • 使用するツールによって、小数点以下桁数を考慮する必要があるかどうかが異なります。amountは小数点以下桁数を考慮する必要があります(例:9桁の場合、1トークンのミントにはamount: 1_000_000_000が必要)
  • 任意のウォレットアドレスにミントできます—トークンアカウントが存在しない場合は作成されます
  • ミント権限者のみが新しいトークンをミントできます