機能

Bubblegumツリーの作成

Last updated February 24, 2026

Summary

Creating a Bubblegum Tree is the first step before minting compressed NFTs. This page covers how to create and fetch the two required on-chain accounts: the Merkle Tree account and the TreeConfigV2 PDA.

  • Create a Bubblegum Tree with configurable max depth, max buffer size, and canopy depth
  • Choose tree parameters based on your project's cNFT capacity needs (16K to 1B+ cNFTs)
  • Fetch merkle tree and tree config account data after creation
  • Understand the cost tradeoffs for different tree configurations

はじめに

圧縮NFTのデータはトランザクション内に保存され、オンチェーンアカウントには保存されませんが、マークルツリーとその設定を追跡するためのオンチェーンアカウントが必要です。そのため、圧縮NFTのミントを開始する前に、2つのアカウントを作成する必要があります:

  • マークルツリーアカウント。このアカウントは、あらゆる種類のデータの真正性を検証するために使用できる一般的なマークルツリーを保持します。これはSPLアカウント圧縮プログラムからフォークされたMPLアカウント圧縮プログラムによって所有されています。私たちの場合、これを使用して圧縮NFTの真正性を検証します。
  • TreeConfigV2アカウント。この2番目のアカウントは、マークルツリーアカウントのアドレスから派生したPDAです。これにより、圧縮NFTに特有のマークルツリーの追加設定(例:ツリー作成者、ミント済みcNFTの数など)を保存できます。

これらの2つのアカウントがあれば、圧縮NFTのミントを開始するために必要なすべてが揃います。関連するツリー設定アカウントを持つマークルツリーアカウントをBubblegumツリーと呼びます。

Bubblegumツリーの作成

これらのアカウントの両方を作成してBubblegumツリーを作成する方法を見てみましょう。幸いなことに、私たちのライブラリはすべてを処理するツリー作成操作を提供することで、このプロセスを簡単にしています。この操作は、さまざまなパラメータ(そのほとんどがオプション)を受け入れ、Bubblegumツリーを私たちのニーズに合わせてカスタマイズできます。最も重要なものは次のとおりです:

  • マークルツリー: マークルツリーアカウントの作成に使用される新しく生成された署名者。マークルツリーアカウントは、このアドレスでアクセス可能になります。
  • ツリー作成者: Bubblegumツリーを管理し、圧縮NFTをミントできるアカウントのアドレス。
  • 最大深度最大バッファサイズ: 最大深度パラメータは、マークルツリーが保持できるリーフの最大数、つまり圧縮NFTを計算するために使用されます。この最大値は2^maxDepthで計算されます。最大バッファサイズパラメータは、マークルツリーの最小同時実行制限を示します。言い換えると、ツリーで並行して発生できる変更の数を定義します。これらの2つのパラメータは任意に選択することはできず、以下の表に表示されている事前定義された値のセットから選択する必要があります。

以下は、Solanaエコシステム内での互換性のための推奨ツリー設定です。

cNFTの数ツリーの深度キャノピーの深度同時実行バッファツリーのコストcNFTあたりのコスト
16,384148640.33580.00002550
65,5361610640.70690.00001579
262,1441812642.10420.00001303
1,048,576201310248.50120.00001311

Notes

  • Tree parameters (max depth, max buffer size, canopy depth) are immutable after creation. Choose carefully based on your project's needs.
  • Larger trees cost more in rent but have a lower per-cNFT cost. See the recommended settings table above for cost estimates.
  • The Tree Creator is stored in the TreeConfigV2 account and can delegate minting authority to another account (see Delegating Trees).
  • Public trees allow anyone to mint. Private trees restrict minting to the Tree Creator or Tree Delegate.

FAQ

Glossary

TermDefinition
Bubblegum TreeThe combination of a Merkle Tree account and its associated TreeConfigV2 PDA
Merkle Tree AccountThe on-chain account holding the merkle tree data, owned by the MPL Account Compression Program
TreeConfigV2A PDA derived from the Merkle Tree address, storing Bubblegum-specific config (creator, delegate, capacity, mint count, public flag)
Max DepthThe maximum depth of the merkle tree, determining capacity as 2^maxDepth
Max Buffer SizeThe number of change log entries stored, determining how many concurrent modifications the tree supports per block
Canopy DepthThe number of upper tree levels cached on-chain, reducing proof sizes in transactions
Tree CreatorThe account that created the tree and has authority to manage it and mint cNFTs
Tree DelegateAn account authorized by the Tree Creator to mint cNFTs on their behalf
Previous
Rust