Giter Site home page Giter Site logo

nftoken's Introduction

NFToken

NFToken is a simple, cheap standard for Solana.

Docs: nftoken.so

nftoken's People

Contributors

benborgers avatar renovate[bot] avatar vovacodes avatar vpontis 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

Watchers

 avatar  avatar  avatar  avatar

nftoken's Issues

Support faster mintlist creation

There can be multiple writes to an account in the same block, so we can support much faster mintlist creation by allowing the add_mint_infos instruction to specify the following info:

  • start_idx
  • mint_infos_to_add

Then the program needs to be a bit smarter about figuring out the number of NFTs that have been configured since it's possible that we are overwriting a mint info that has already been configured.

Editions / Usages

I think we will do this as a PDA off of a given NFT. So the NFT will be the master edition and it could have many different editions. Each edition could be marked with a number of usages u32.

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency @glow-app/glow-react to v0.6.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

cargo
programs/nftoken/Cargo.toml
  • anchor-lang 0.24.2
  • anchor-spl 0.24.2
  • arrayref 0.3.6
  • borsh 0.9
github-actions
.github/workflows/docs-tests.yml
  • actions/checkout v3
.github/workflows/program-test.yml
  • actions/checkout v3
npm
docs/package.json
  • @glow-app/glow-client 0.3.0
  • @glow-app/glow-react 0.1.1
  • @glow-app/solana-client 0.5.0
  • @heroicons/react 1.0.6
  • @lux-org/sass 0.46.0
  • @markdoc/markdoc 0.1.2
  • @markdoc/next.js 0.1.4-1
  • @metaplex-foundation/beet 0.2.0
  • @svgr/webpack 6.2.1
  • @types/luxon 2.3.2
  • @types/react-dom 18.0.5
  • axios 0.27.2
  • canvas-confetti 1.5.1
  • classnames 2.3.1
  • copy-to-clipboard 3.3.1
  • formik 2.2.9
  • luxon 2.4.0
  • motion 10.10.0
  • next 12.1.6
  • prism-themes 1.9.0
  • prismjs 1.28.0
  • react 18.1.0
  • react-dom 18.1.0
  • react-dropzone 14.2.1
  • sass 1.52.3
  • typescript 4.7.3
  • zod 3.17.3
  • @types/canvas-confetti 1.4.2
  • @types/node 17.0.41
  • @types/prismjs 1.26.0
  • @types/react 18.0.12
  • @typescript-eslint/parser 5.27.1
  • eslint 8.17.0
  • eslint-plugin-lodash 7.4.0
package.json
  • prettier 2.6.2
  • typescript 4.7.3
program-tests/package.json
  • @project-serum/anchor 0.24.2
  • @project-serum/borsh 0.2.5
  • @project-serum/serum 0.13.65
  • @solana/web3.js 1.43.6
  • @types/jest 28.1.1
  • @types/lodash 4.14.182
  • @typescript-eslint/eslint-plugin 5.27.1
  • @typescript-eslint/parser 5.27.1
  • assert 2.0.0
  • axios 0.27.2
  • bignumber.js 9.0.2
  • buffer 6.0.3
  • buffer-layout 1.2.2
  • camelcase 6.3.0
  • eslint 8.17.0
  • eslint-config-prettier 8.5.0
  • jest 28.1.1
  • lodash 4.17.21
  • luxon 2.4.0
  • p-limit 4.0.0
  • prettier 2.6.2
  • ts-jest 28.0.4
  • typescript 4.7.3
  • zod 3.17.3
  • node >=11
nvm
.nvmrc
  • node 16.15.1

  • Check this box to trigger a request for Renovate to run again on this repository

Allow Closing NFTs / Collections

Who can close an NFT? Holder + Creator? Just holder?

Who can close a collection? What happens to the NFTs that point to that collection?

Security

  • Document Potential Vulnerabilities
  • Use checked math everywhere
    • Is there a mode we can turn on which makes sure we are using checked math?
  • https://github.com/0xsanny/solsec
  • Ensure the system program doesn't get special permissions

Figure out how account versioning works

Let's say we add Hierarchical Collections #65 in the second version of the CollectionAccount. How do we let Anchor / Rust serialize one account or the other? Will we have to move serialization code from the Anchor macro to inside the instruction?

Multiple creators

We want a way of storing multiple creators on an NFT.

This is useful for:

  • showing that multiple people were involved with the NFT (can add them as signers)
  • paying out royalties
  • giving more than one person auth for modifying the NFT

Questions

  1. should creators be on the collection or NFT level? or both?
  2. should creators and royalties be combined into one PDA or should royalties be in a separate PDA?
  3. should we indicate on the NFT that the NFT has royalties? it could be an extra flag
  4. what should the unit of royalty be?
    • basis points — 1 / 100th of 1% so 10,000 basis points which requires u16 rather than u8

Spec

ix_nft_setup_creators

  • check all the royalties add up
  • store if there are / are not royalties
  • store the overall royalty amount that the NFT should have
  • verified creators should be signed
  • update the NFT to store royalties_enabled

ix_nft_update_creators

  • reset creators to new value

is_nft_add_creator

  • should be signed with the new, verified creator

Future

  • add this to Mintlist
  • allow setting creators on the collection level rather than NFT level

Misc

Related to #11

Store image and metadata on chain

Inspired by discussion in #17

Some users may want to have more info on chain.

  • Chain Runners is an NFT project where the art is on chain
  • Some NFT people have talked about doing metadata storage on chain. That would enable things like placing a bid on a group of traits.

To do this, we could hack the image_url / metadata_url fields to support addresses by saying they are an onchain address if they start with s:.

Collection wide royalties

Please consider the addition of collection wide royalties that can be optionally be overriden by specific NFT royalty accounts.

This would be huge.

Decide on PDA vs Keypair for `NftAccount`

Keypair

  • allows one random address (the public / private keypair)
  • cannot run invoke_signed
  • costs 5k lamports more

PDA

  • how do you pick the seed? now you have a random seed + a random address — two random IDs which is kinda weird
  • can run invoke_signed
  • saves 5k lamports for each NFT creation

Questions

  1. What is invoke_signed used for today?

Consider dynamic account sizes

https://twitter.com/jacobvcreech/status/1529133246658842624

Realloc lets us increase / decrease the size of Program Owned Accounts up to 10k.

This means we could make metadata_url a String which is variable length.

I still think it's nicer to keep delegate as a Pubkey rather than a Option<Pubkey> since you will always need to allocate space for the full Pubkey.

Question — how can we init an NFT account to a dynamic value when creating it?

Royalties

We will want to send royalties to multiple accounts but we don't want to store all of them on the NFT (since that will make creating the NFT more expensive for everyone)

Instead we could set up:

RoyaltyConfigAccount

  • royalty_percent
  • creators - CreatorRoyalty[]
    • type CreatorRoyalty = { creator: Address; shares: u64 }
    • The amount each creator gets is the

dispense_royalties Instruction

  • call with
    • total_fee
    • nft_account
    • royalty_config
  • it will then call invoke_signed to pay out the different accounts based on shares / royalty_percent

Questions

  1. Should this be a collection or nft level primitive?

Hierarchical Collections

With a hierarchical collection, you will have collection.collection which stores the parent collection.

Decide on `Nft` and `Collection` sizes

Goal: it's > 2x cheaper to use this program than SPL Token + Metaplex

SPL + Metaplex Costs

Account Size Cost
Mint 82 $0.15
Token 165 $0.20
Metadata 679 $0.56
Edition / Standard 40 $0.12
Total ~ 980 ~ $1.02

Nftoken

500 bytes → ~ $0.44

  • holder - 32
  • creator - 32
  • creator_can_update - 1
  • name - 32
  • image_url - 128
  • metadata_url - 128
  • collection - 32
  • delegate - 32
  • created_at - 8

How to cut? — URLs are by far the most expensive part. How short can we make them while still being compatible with IPFS / Arweave?

And how do we give ourselves flexibility to add more things later on? Or do we just do that by versioning and allow upgrading the version number?

That's another big question:

  • how do we migrate an account to a new version?
  • will Solana allow resizing an account in the future?
  • does this impact our use of PDAs vs Keypairs?

Marketplace Program

Questions

  1. Should this use the existing Nftoken program or use a new program?
    • An existing program would be easier for new people to get started with and mirrors what Metaplex is trying to do with haus
    • A new program would be easier to evolve over time and it would be easier for other people to fork (more composable)
  2. What are the different types of sales we want to support on day 1? Options:
    • Auction with end date — highest bidder
    • Vickeroy auction
    • Buy now
    • Auction with reserve price

Create Foundation to Manage Nftoken Program

I don't want Glow to be the only organization with control over the Nftoken program and standard. I think it's a problem that Metaplex is a private company that has raised VC money and it has total power over the current NFT standard.

On Solana, you get a ton of power from owning a program since you can upgrade the program and change all the accounts that the program owns. If Metaplex wanted to, they could remove all of your NFTs from the blockchain.

I'd like to work with existing players in the ecosystem and include room for other parties:

  • Magic Eden
  • OpenSea
  • Formfunction
  • Solana Foundation

I see this working in a similar way to W3C and to how DNS is run.

Decide on how we handle fee payer / first account

I think that the feePayer has to have #[account(mut)] in Anchor since it has to have less lamports in order to pay for the tx. But there are several tx where the fee payer isn't clear — like if you are setting an NFT collection, should this be the collection signer or NFT signer?

Can we make Anchor flexible enough so that the caller can decide on the fee payer?

Set / unset collection on NFT

Is it better to have one ix or two ix types for this? Two ix types might be easier to parse and then we can do more auth checking using Anchor macros.

Auth Required

Set Collection

  • creator and creator_can_update on NFT
  • creator and creator_can_update on collection

Python support

Any plans to add a small SDK for python to interact with the program in the roadmap?

Or better details on how to build transactions would love to integrate this token into my current flow of issuing tokens at purchase.

Add better support for freeze authority - Escrowless Problems

The root of this issue is that a delegate can not freeze the token. Only update authority can. This means you can't do something like cardinal-staking, or escrowless marketplace listings. These kinds of dapps are popular because holder-verification continues to work, and the token shows in their wallet.

Currently, without freeze authority being delegatable, a dapp given delegate authority may break or have stale data if the user removes the delegate authority without interacting with said dapp - or transfers the token.


If we remove is_frozen from nft_update, and add new instructions to manage this property, we can solve this problem.

Delegate moving forward will act as transfer and freeze authority.

When frozen, the token can not be acted upon. Any action except for metadata update should error. nft_burn needs to be patched. (#196 )

These changes can be made with backwards compatibility with v1.

The new instructions could be:

nft_freeze and nft_thaw. Each would check if the delegate is the signer of the ix, and if so, update is_frozen


We can scan mainnet for any current calls to nft_update and see if anyone is using args.is_frozen before making a decision but I think shooting for retro-active ^1.0.1 support here would be a massive win.

JS Client

This client should make it very easy to:

  • create NFTs / collections
  • make queries
    • get all NFTs by creator / wallet / delegate
    • get all NFTs by collection
  • send / delegate NFTs

We should be able to run this in the browser or the server. If we run it in the browser, it'll be a nice way to create an open source version of https://glow.app/nftoken

For the first version, this client can rely on @project-serum/anchor and @solana/web3.js but in the future, I would like to replace those packages with something simpler.

Mint List

The nft_create instruction creates an NFT with the provided information and it sets the creator to the wallet that created the NFT. This is useful if you are creating NFTs into your wallet first and then sending them to people.

NFT projects often want to let other people mint (create) the NFTs of the project. That means the NFT account isn't stored until someone mints it. For that, we will need to store the mint information on chain but not in the actual NFT accounts.

New Instructions

  • mintlist_create Create MintListAccount which will have the following fields:
    • Collection (optional, will require signer)
    • Creator (will be set as the creator on the NFT)
    • Mint Infos
      • Minted
      • Name
      • Image
      • Metadata
    • Price
    • Num Mints (inferred from Mint Infos)
    • Num NFTs Remaining
    • Go Live Date
    • Randomness Mode — Should it be sequential / random / something else?
  • mintlist_mint_nft which will give you an NFT will be called with
    • mintlist

Questions

  1. Can one account be written to multiple times in a block in different transactions?
  2. Should we prevent minting multiple NFTs into one wallet?
  3. Should we prevent minting multiple NFTs in one transaction (via multiple mint IXs)?
  4. How do we properly do randomness? Should we do what Candy Machine v2 does?

Thoughts for the Future

  • Support paying with SPL Token / Whitelist Token
  • Support whitelisting addresses

Security

  • Penalize bots who call this program
  • Ensure that you can't call other instructions while doing a mint

Cannot SignIn using Glow Wallet when deployed to own server

Hi, I am a developer but not very familiar with the Node ecosystem.

My current goal is to find a replacement for Metaplex and I want to permit minting multiple NFT (part of the same collection) at once. I played with the NFToken (the one deployed at nftoken.so) and managed to SignIn with Glow, create NFTs, Mintlists and mint one by one.

I wanted to change the code so I can mint more at once so I have forked the project and ran npm run start from docs folder. Pressing SignIn redirects to https://glow.app/download, but I cannot successfully sign in with my Glow wallet.
When I ran it with npm run dev I saw this error:

Unhandled Runtime Error
Error: Not loaded.

Call Stack
GlowClient.eval
../node_modules/.pnpm/@[email protected]/node_modules/@glow-xyz/glow-client/dist/glow-client.js (103:0)
Generator.next
<anonymous>
eval
../node_modules/.pnpm/@[email protected]/node_modules/@glow-xyz/glow-client/dist/glow-client.js (8:0)
new Promise
<anonymous>
__awaiter
../node_modules/.pnpm/@[email protected]/node_modules/@glow-xyz/glow-client/dist/glow-client.js (4:0)
GlowClient.signIn
../node_modules/.pnpm/@[email protected]/node_modules/@glow-xyz/glow-client/dist/glow-client.js (101:0)
eval
../node_modules/.pnpm/@[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/@glow-xyz/glow-react/dist/GlowContext.js (56:50)
HTMLUnknownElement.callCallback
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (4164:0)
Object.invokeGuardedCallbackDev
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (4213:0)
invokeGuardedCallback
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (4277:0)
invokeGuardedCallbackAndCatchFirstError
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (4291:0)
executeDispatch
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9041:0)
processDispatchQueueItemsInOrder
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9073:0)
processDispatchQueue
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9086:0)
dispatchEventsForPlugins
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9097:0)
eval
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9288:0)
batchedUpdates$1
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (26140:0)
batchedUpdates
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (3991:0)
dispatchEventForPluginEventSystem
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (9287:0)
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (6465:0)
dispatchEvent
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (6457:0)
dispatchDiscreteEvent
../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js (6430:0)

I am probably doing something wrong, how can I get some help?

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.