機能

圧縮NFTのミント

Last updated February 24, 2026

Summary

Minting compressed NFTs adds new cNFTs to a Bubblegum Tree using the mintV2 instruction. This page covers minting with and without MPL-Core collections, and retrieving the asset ID from mint transactions.

  • Mint cNFTs to a Bubblegum Tree using the mintV2 instruction
  • Mint directly into an MPL-Core collection with the BubblegumV2 plugin
  • Retrieve the asset ID and leaf schema from the mint transaction
  • Configure metadata including name, URI, creators, and royalties

前のページでは、圧縮NFTをミントするためにBubblegumツリーが必要であることを確認し、その作成方法を見ました。今度は、与えられたBubblegumツリーから圧縮NFTをミントする方法を見てみましょう。

Bubblegumプログラムは、異なるリーフスキーマバージョン用の複数のミント命令を提供します。Bubblegum V2は、与えられたコレクションに、またはコレクションなしで圧縮NFTをミントするために使用されるmintV2という新しいミント命令を導入しています。

コレクションなしでのミント

Bubblegumプログラムは、Bubblegumツリーから圧縮NFTをミントすることを可能にするmintV2命令を提供します。Bubblegumツリーが公開されている場合、誰でもこの命令を使用できます。そうでなければ、ツリー作成者またはツリーデリゲートのみが使用できます。

mintV2命令の主要なパラメータは以下の通りです:

  • マークルツリー: 圧縮NFTがミントされるマークルツリーのアドレス。
  • ツリー作成者またはデリゲート: Bubblegumツリーからのミントを許可された権限 — これはツリーの作成者またはデリゲートのいずれかです。この権限はトランザクションに署名する必要があります。公開ツリーの場合、このパラメータは任意の権限にできますが、それでも署名者である必要があります。
  • リーフ所有者: ミントされる圧縮NFTの所有者。デフォルトではトランザクションの支払者です。
  • リーフデリゲート: ミント済みcNFTの管理を許可されたデリゲート権限(存在する場合)。そうでなければ、リーフ所有者に設定されます。
  • コレクション権限: 与えられたコレクションの管理を許可された権限。
  • Coreコレクション: 圧縮NFTが追加されるMPL-CoreコレクションNFT。
  • メタデータ: ミントされる圧縮NFTのメタデータ。NFTの名前URIコレクション作成者などの情報が含まれます。Bubblegum V2では、メタデータはusesやコレクションのverifiedフラグなど、不要なフィールドを除外したMetadataArgsV2を使用しています。

コレクションなしで圧縮NFTをミント

import { none } from '@metaplex-foundation/umi';
import { mintV2 } from '@metaplex-foundation/mpl-bubblegum';
await mintV2(umi, {
leafOwner: umi.identity.publicKey,
merkleTree: merkleTree.publicKey,
metadata: {
name: 'My NFT',
uri: 'https://example.com/my-nft.json',
sellerFeeBasisPoints: 550, // 5.5%
collection: none(),
creators: [],
},
}).sendAndConfirm(umi);

コレクションへのミント

圧縮NFTがミントされた 後に コレクションを設定して確認することも可能ですが、Bubblegum V2は圧縮NFTを指定されたコレクションに直接ミントできるようにします。Bubblegum V2は圧縮NFTをグループ化するためにMPL-Coreコレクションを使用します。同じ mintV2 命令がこのために使用されます。上記のパラメータに加えて、Coreコレクションを渡し、コレクション権限またはデリゲートとして署名する必要があります:

  • Coreコレクション: coreCollectionパラメータに渡されるMPL-CoreコレクションNFTのミントアドレス。
  • コレクション権限: 指定されたコレクションNFTを管理できる権限。これはコレクションNFTの更新権限または委任されたコレクション権限のいずれかになります。この権限は、Bubblegumツリーが公開されているかどうかに関係なく、トランザクションに署名する必要があります。

メタデータパラメータにはコレクションの公開鍵を含める必要があります。

コレクションに圧縮NFTをミント

import { some } from '@metaplex-foundation/umi';
import { mintV2 } from '@metaplex-foundation/mpl-bubblegum';
await mintV2(umi, {
collectionAuthority: umi.identity,
leafOwner: umi.identity.publicKey,
merkleTree: merkleTree.publicKey,
coreCollection: collectionSigner.publicKey,
metadata: {
name: 'My NFT',
uri: 'https://example.com/my-nft.json',
sellerFeeBasisPoints: 550, // 5.5%
collection: some(collectionSigner.publicKey),
creators: [],
},
}).sendAndConfirm(umi);

ミントトランザクションからアセットIDとリーフスキーマを取得する

parseLeafFromMintV2Transactionヘルパーを使用して、mintV2トランザクションからリーフを取得し、アセットIDを特定できます。この関数はトランザクションを解析するため、parseLeafFromMintV2Transactionを呼び出す前にトランザクションが完了していることを確認してください。

トランザクションの完了

parseLeafFromMintV2Transactionを呼び出す前に、トランザクションが完了していることを確認してください。

ミントトランザクションからリーフスキーマを取得する

import {
mintV2,
parseLeafFromMintV2Transaction,
} from '@metaplex-foundation/mpl-bubblegum';
const { signature } = await mintV2(umi, {
// ... 上記の詳細を参照
}).sendAndConfirm(umi);
const leaf = await parseLeafFromMintV2Transaction(umi, signature);
const assetId = leaf.id;

Notes

  • The Bubblegum Tree must be created before minting. See Creating Trees.
  • For collection mints, the MPL-Core collection must have the BubblegumV2 plugin enabled.
  • The collection authority must sign the transaction when minting to a collection, regardless of whether the tree is public or private.
  • Use parseLeafFromMintV2Transaction only after the transaction is finalized, not just confirmed.

FAQ

コレクションに圧縮NFTをミントするにはどうすればよいですか?

MPL-Coreコレクションアドレスに設定されたcoreCollectionパラメータを使用してmintV2命令を使用します。コレクションにはBubblegumV2プラグインが有効になっている必要があります。

ミント後にアセットIDを取得するにはどうすればよいですか?

トランザクションが完了した後、parseLeafFromMintV2Transactionヘルパーを使用します。アセットIDを含むリーフスキーマを返します。

誰でも私のツリーからミントできますか?

ツリーが公開に設定されている場合のみです。プライベートツリーの場合、ツリー作成者またはツリーデリゲートのみがミントできます。

ミントに必要なメタデータフィールドは何ですか?

MetadataArgsV2には、name、uri、sellerFeeBasisPoints、collection(またはnone)、およびcreatorsの配列が必要です。

Glossary

TermDefinition
mintV2The Bubblegum V2 instruction for minting compressed NFTs, replacing the V1 mint instructions
MetadataArgsV2The metadata structure passed to mintV2, containing name, URI, royalties, collection, and creators
Collection AuthorityThe signer authorized to manage the MPL-Core collection — required when minting to a collection
BubblegumV2 PluginAn MPL-Core collection plugin that enables Bubblegum V2 features (freeze, soulbound, royalties)
Asset IDA PDA derived from the merkle tree address and leaf index, uniquely identifying a compressed NFT
Leaf SchemaThe data structure stored as a leaf in the merkle tree, containing the cNFT's hashed metadata and ownership info