시작하기

대체 가능 토큰 발행하기

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발행할 토큰 수

작동 방식

발행 과정은 세 단계를 포함하며, 사용하는 도구에 따라 수동으로 실행해야 할 수도 있고 아닐 수도 있습니다. 다음 단계는 umi에 초점을 맞추고 있습니다:

  1. 대상 토큰 계정 찾기 - findAssociatedTokenPda를 사용하여 수신자의 토큰 계정을 찾습니다
  2. 필요시 토큰 계정 생성 - createTokenIfMissing을 사용하여 수신자가 토큰 계정을 가지고 있는지 확인합니다
  3. 토큰 발행 - mintTokensTo로 발행을 실행합니다

요구 사항

추가 토큰을 발행하려면 민트 권한자여야 합니다 - 민트 권한자로 지정된 지갑만 새 토큰을 발행할 수 있습니다

중요한 참고 사항

  • 사용하는 도구에 따라 소수점 자릿수를 고려해야 할 수도 있고 아닐 수도 있습니다. amount는 소수점 자릿수를 고려해야 합니다 (예: 9자리의 경우, 1토큰 발행에 amount: 1_000_000_000 필요)
  • 모든 지갑 주소로 발행할 수 있습니다—토큰 계정이 없으면 생성됩니다
  • 민트 권한자만 새 토큰을 발행할 수 있습니다