11 releases

0.3.0 Jan 2, 2024
0.2.0 Jul 26, 2023
0.1.10 Apr 18, 2023
0.1.8 Jan 19, 2023
0.1.0 Sep 13, 2022

#900 in Magic Beans

Download history 418/week @ 2023-12-23 411/week @ 2023-12-30 790/week @ 2024-01-06 942/week @ 2024-01-13 1264/week @ 2024-01-20 1172/week @ 2024-01-27 1255/week @ 2024-02-03 1112/week @ 2024-02-10 1448/week @ 2024-02-17 1175/week @ 2024-02-24 1365/week @ 2024-03-02 1483/week @ 2024-03-09 1230/week @ 2024-03-16 1178/week @ 2024-03-23 1231/week @ 2024-03-30 998/week @ 2024-04-06

4,869 downloads per month
Used in 15 crates (11 directly)

Apache-2.0

84KB
1.5K SLoC

Solana

SPL Account Compression Rust SDK (Beta)

More information about account compression can be found in the solana-program-library repo.

The Solana Program Examples repo will eventually include examples of how to use this program.

spl-account-compression and this crate's implementation are targeted towards supporting Metaplex Compressed NFTs and may be subject to change.


lib.rs:

SPL Account Compression is an on-chain program that exposes an interface to manipulating SPL ConcurrentMerkleTrees

A buffer of proof-like changelogs is stored on-chain that allow multiple proof-based writes to succeed within the same slot. This is accomplished by fast-forwarding out-of-date (or possibly invalid) proofs based on information stored in the changelogs. See a copy of the whitepaper here

To circumvent proof size restrictions stemming from Solana transaction size restrictions, SPL Account Compression also provides the ability to cache the upper most leaves of the concurrent merkle tree. This is called the "canopy", and is stored at the end of the ConcurrentMerkleTreeAccount. More information can be found in the initialization instruction documentation.

While SPL ConcurrentMerkleTrees can generically store arbitrary information, one exemplified use-case is the Bubblegum contract, which uses SPL-Compression to store encoded information about NFTs. The use of SPL-Compression within Bubblegum allows for:

  • up to 1 billion NFTs to be stored in a single account on-chain (>10,000x decrease in on-chain cost)
  • up to 2048 concurrent updates per slot

Operationally, SPL ConcurrentMerkleTrees must be supplemented by off-chain indexers to cache information about leafs and to power an API that can supply up-to-date proofs to allow updates to the tree. All modifications to SPL ConcurrentMerkleTrees are settled on the Solana ledger via instructions against the SPL Compression contract. A production-ready indexer (Plerkle) can be found in the Metaplex program library

Dependencies

~17–27MB
~433K SLoC