Git Product home page Git Product logo

crud-indexing-nft-spec's Introduction

sRFC 19 - Forkable NFT Programs

Requires sRFC 16 - Generalized Asset Indexing.

Motivation

We want NFT programs that allow communities to have complete control over their implementation while retaining their integration with dApps and wallets.

Problem

Recent decisions by Metaplex governance has shown that Solana NFTs can have their assets and implementation changed overnight, with no recourse available.

Solution

We propose a standard protocol for programs to be indexed as NFTs, interpreted as common metadata, and interacted with via on-chain and off-chain clients using standard instructions.

Specification

Instructions

We aim to combine the best features of ERC 721 with the best features of SPL Token.

Mint

TODO

Transfer

TODO

Delegate

TODO

Burn

TODO

Grouping

When a program issues an NFT, it has a specific ordering of accounts that must be followed.

The first pubkey must either be a pubkey that specifies a collection or a program id. The second pubkey must be either the current delegate or the current owner of the NFT.

When the NFT is delegated, the NFT must update the 2nd pubkey in the list of pubkeys to be the new delegate.

Each AssetGroup emitted for an NFT in CudCreate or CudUpdate must have the following schema:

AssetGroup {
    asset_id: Pubkey,
    authority: Pubkey,
    pubkeys: [
        # collection | program id,
        # delegate | owner,
        # etc,
    ],
    data: Vec<u8>
}

Other pubkeys may be present in the AssetGroup, but are not required for the NFT to be considered valid.

Rendering Metadata

In accordance with sRFC 16, when each NFT is emitted as an AssetGroup, it is rendered by simulating a view function called getAssetData that takes the AssetGroup as accounts and input data.

The rendered JSON MUST have the following fields:

{
    "name": "string",
    "symbol": "string",
    "uri": "string",
    "delegate": "string",
    "owner": "string",
}

Other fields may be present, but these are required for the NFT to be considered valid.

We note that it's a mess to use JSON on-chain, since it consume CUs aggresively. We recommend further research with using TLV<string, string> maps.

Implementation

The following programs are implemented using this standard:

  1. crud-indexing (todo: rename to nft-style-1)
  2. nft-style-two

We also have implemented a marketplace contract for these programs:

nft-marketplace which implements a swap between assets of two different such programs, and both list and buy instructions for assets of a single program.

We provide a reference implementation of a General Asset Indexer (sRFC #16) that works with any program, and then an additional NFT RPC TS client that uses the indexer to provide useful retrieval methods for NFTs.

Running tests

Running the tests requires coral-xyz/anchor to be >=0.28.0. Docker is also required.

  1. Install TS dependencies: yarn install
  2. Setup docker environment using Postgres with docker run --name postgres -e POSTGRES_PASSWORD=mysecretpassword -d -v ~/PATH-TO-LOCAL-PG-DB:/var/lib/postgresql/data postgres
  3. Run tests: anchor test

Checklist

  • AAR for nft style one
  • AAR for nft style two
  • Local Marketplace
  • 10k pfp
  • 10k pfp marketplace

crud-indexing-nft-spec's People

Contributors

buffalojoec avatar ngundotra avatar

Watchers

 avatar  avatar

crud-indexing-nft-spec's Issues

Allow for implementation-specific indexing for NFT standards (and more)

When a program implements one or more interfaces to create an NFT standard, a developer should be able to write code that can extract only their NFTs (specifically their implementation) and no one else's.

With this implementation of CUD indexing - which is generic over asset composition - can we allow for indexing of specific interface implementations? Rather than just all of them

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.