Bubblegum

NFTs that scale to new orders of magnitude.

Introduction

Overview

Bubblegum is the Metaplex Protocol program for creating and interacting with compressed NFTs (cNFTs) on Solana. Compressed NFTs make it possible to scale the creation of NFTs to new orders of magnitude by rethinking the way we store data on-chain.

Getting Started

Find the language or library of your choice and get started with compressed NFTs.

API reference

Looking for something specific? Have a peak at our API References and find your answer.

Introduction

As NFTs have flourished on the Solana blockchain, there’s been an increasing need for NFTs to be as ubiquitous as any digital asset on the Internet: every single item in your game’s inventory, proof-of-engagement in your favourite consumer app, or even a profile for every human on the planet.

So far, though, these types of products have been held back by the cost of rent for NFTs on Solana, which is relatively cheap (0.012 SOL) but scales linearly; a billion NFTs would cost 12,000,000 SOL! From 10,000 NFTs at 3.5 SOL (34x), 1 million NFTs at 5 SOL (2,400x), and 1 billion NFTs at 500 SOL (24,000x), compression for NFTs drastically reduces the cost of on-chain storage of NFTs to enable creators to be as expressive with the technology as they wish.

Number of cNFTsStorage CostTransaction CostTotal CostCost per cNFT
10,0003.480.0053.4850.0003485
100,0004.170.054.220.0000422
1,000,0004.850.55.350.0000053
100,000,0006.455056.450.0000006
1,000,000,0007.13500507.130.0000005

These compressed NFTs can be transferred, delegated, and even decompressed into regular NFTs for interoperability with existing smart contracts.

Merkle Trees, leaves and proofs

Compressed NFTs only exist in the context of a Merkle Tree. We explain in a dedicated advanced guide what Merkle Trees are but, for the sake of this overview, you can think of a Merkle Tree as a collection of hashes that we call Leaves. Each Leaf is obtained by hashing the data of the compressed NFT.

For each Leaf in the Merkle Tree, one can provide a list of hashes — called a Proof — that enables anyone to verify that the given Leaf is part of that tree. Whenever a compressed NFT is updated or transferred, its associated Leaf will change and so will its Proof.

As such, Merkle Trees act as an on-chain structure that allows anyone to verify a given compressed NFT exist. They do this without storing any NFT data which makes them so scalable.

Which brings us to an important question: where is the NFT data stored?

Metaplex DAS API

When we mint a new compressed NFT, its data is hashed and added as a new Leaf in a Merkle Tree. But there’s more. Additionally, the entire NFT data is stored in the transaction that created the compressed NFT. Similarly, when a compressed NFT is updated, its updated data is, once again, saved on the transaction as a changelog. So, whilst there aren’t any accounts keeping track of that data, one can look at all previous transactions in the ledger and find that information.

Crawling through millions of transactions every time just to fetch the data of one NFT is admittedly not the best user experience. Therefore, compressed NFTs rely on some RPCs to index that information in real time to abstract this away from the end-user. We call the resulting RPC API, which enables fetching compressed NFTs, the Metaplex DAS API.

Note that not all RPCs support the DAS API. As such, you may be interested in the “Metaplex DAS API RPCs” page to select an appropriate RPC when using compressed NFTs in your application.

We talk about this in more detail in our advanced “Storing and indexing NFT data” guide.

Features

Even though NFT data does not live inside accounts, it is still possible to execute a variety of operations on compressed NFTs. This is possible by requesting the current NFT data and ensuring its hashed Leaf is valid on the Merkle Tree. As such, the following operations can be performed on compressed NFTs:

Next steps

Now that we know how compressed NFTs work at a high level, we recommend checking out our Getting Started page which enumerates the various languages/frameworks that one can use to interact with compressed NFTs. Afterwards, the various feature pages can be used to learn more about the specific operations that can be performed on cNFTs. Finally, advanced guides are also available to deepen your knowledge of cNFTs and Merkle Trees.