Giter VIP home page Giter VIP logo

candyland's Introduction

Note!

This repository will be archived! The following programs have new homes in different repositories:

  • gummyroll is now account-compression (owned and maintained by Solana Labs), and can be found in the solana-program-library
  • candy-wrapper is now spl-noop (owned and maintained by Solana Labs), and can be found in the solana-program-library
  • bubblegum (owned and maintained by the Metaplex Foundation) can be found in the metaplex-program-library
  • sugar-shack and gumball-machine are proof-of-concept programs that will eventually graduate to Metaplex ownership; in the meantime, they will remain archived here.

RPC-related infrastructure and anything related to indexing compressed NFTs can be found below:

🍬 Candyland 🍬

Smart contracts and indexing services necessary to migrate the Solana ecosystem to a 10,000x cheaper NFT standard.

graph TD;
    subgraph contracts
        gummyroll-->concurrent-merkle-tree;
        bubblegum-->gummyroll;
        gumball-machine-->bubblegum;
        gumdrop-->bubblegum;
    end
    subgraph indexer
        plerkle-->solana-geyser-plugin;
        nft-ingester-->|messenger|plerkle;
        nft-api-->nft-ingester;
    end

Smart Contracts

Package Description Docs Audit Program Id
gummyroll On-chain merkle tree that supports concurrent writes tbd tbd GRoLLzvxpxxu2PGNJMMeZPyMxjAUH9pKqxGXV9DGiceU
bubblegum Token transfer and metadata functionality built on top of gummyroll tbd tbd BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY
gumball-machine Candy machine built for bubblegum tbd tbd GBALLoMcmimUutWvtNdFFGH5oguS7ghUUV6toQPppuTW
sugar-shack Example Marketplace Implementation for Compressed NFTs tbd tbd 9T5Xv2cJRydUBqvdK7rLGuNGqhkA8sU8Yq1rGN7hExNK

Gummyroll - Merkle Tree

Merkle tree root stores information of its leaves. We store a buffer of proof-like changelogs 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 upon the information in the changelogs.

Information about max tree height, maximum transaction size, and other constraints can be found in tests/txLength.ts.

Note on hashing:

It's industry standard to lexicographically sort inner nodes when hashing up the tree. However gummyroll does not implement this. Since indices are needed to find the intersection for the changelog array, we implement hashing using an index to order the nodes.

Bubblegum - NFTs in Merkle Trees

Supports decompressing bubblegum NFTs into either Tokenkeg tokens or Token22 tokens. The benefit of decompressing a bubblegum NFT is that normal tokens can be moved into a custodial wallet and freely transferred without relying on RPC nodes to serve your NFT data from an off-chain database.

Gumball machine - Candy machine for NFT drops

For more information on candy machine: https://docs.metaplex.com/candy-machine-v2/introduction

Sugar Shack - Example Marketplace Implementation for Compressed NFTs

Sugar Shack is a mock implementation for how a Marketplace could faciliatate listings of compressed NFTs for purchase. Docs TBD.

Running Tests

cd contracts; anchor test will run tests.

If tests are failing by timing out, then this likely means that certain programs are not loaded in the local validator. This is remedied by adding the program & address to a [[test.genesis]] entry in Anchor.toml. You can tell if this is the issue by turning skipPreflight to false. Simulation error will show programId not found.

candyland's People

Contributors

austbot avatar danenbm avatar jarry-xiao avatar jnwng avatar ngundotra avatar samwise2 avatar steveluscher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

candyland's Issues

[Structure] Refactor repo

indexer/
  plerkle/
  docker/
  nft_api/
  nft_ingester/
  ...
programs/
  ...
  gummyroll/
    src/
      state/
        merkle_roll.rs, refactor this into separate rust package that can be published separately
concurrent_merkle_tree/
  -> this should be where merkle tree functions live, so easier to test & audit
.archive/
  -> make this a dotfile

Correct link to ‘candy wrapper’ program

- `candy-wrapper` is now `wrapper` (owned and maintained by Solana Labs), and can be found in the [solana-program-library](https://github.com/solana-labs/solana-program-library/tree/master/account-compression/programs/wrapper)

I don't know enough about candyland to know where that dead link is actually supposed to point.

[Docs] Indexer

The following things should be reorganized and documented (at min, rustdocs):

  • plerkle
  • plerkle_serialization
  • nft_api
  • nft_ingester

Probably best if @austbot and @danenbm have final say on this.

[Proposal] Separate out Ingester from API

nft_api/
.. main.rs (only serves REST requests by reading from postgres)
  should not have anything related to `program`
  should shape into an RPC call extension
nft_ingester/
.. main.rs (consumes from Redis Messenger, writes to postgres)
  has all `program` related parsing/knowledge

[Proposal] Flatbuffers for RPC response

Generate some boiler that makes it easier to share objects that are used to store data in postgres

struct SetNFTMetadata {
  payload: FlatBufferStruct
}
impl FlatBufferPostgres for SetNFTMetadata {
 // Create object from flatbuffer intermediary
 pub fn from(args: FlatBufferStruct) -> Self
 // writes to postgres (used to handle ingest)
 pub async fn to_database() -> Result<(), ()> 
 // sets payload from postgres (used to return RPC requests)
 pub async fn from_database() -> Self 
}

I think it would be

// ingester...
let metadata = SetNFTMetadata::from(args) 
metadata.to_database().await.unwrap();

// api...
let metadata = SetNFTMetadata::from_database().await.unwrap();
send_rpc_response(&metadata)

[Gummyroll] Transfer mint authority and add verify instruction

Add 2 instructions:

  • Transfer mint authority
    • Useful for transferring authority to gumballMachine / gumdropDistributor & back
    • Getting mint authority back allows remaining space in merkle tree to be utilized
  • Verify instruction
    • Allows other programs to verify ownership of compressed NFT
    • If proof is invalid, error is thrown

[Bubblegum] Anti-bot mechanics

Probably need a wallet per-tree that collects spam taxes from interacting with the tree. Not entirely sure yet, but worth considering.

[Docs] Smart contracts

rust docs for gumball_machine for NFT devs
rust docs for bubblegum for metaplex devs
rust docs for gummyroll for metaplex-level or higher devs
README.md for security model & attack vectors

i.e. attacking NFT in gummyroll by buying 2 NFTs (1 adjacent, 1 somewhere random) and then spamming TXs fast enough to fill changelog buffer --> why we think this is too hard to do & therefore acceptable. Also this requires having a fast indexer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.