GithubHelp home page GithubHelp logo

bedlam520 / thirdweb-bundlr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetr1x/thirdweb-bundlr

0.0 0.0 0.0 49 KB

Decentralized NFT metadata storage using Bundlr

Shell 0.56% TypeScript 99.44%

thirdweb-bundlr's Introduction

Solana NFT drop bundlr

This project demonstrates how you can create and deploy your own NFT drop on the Solana blockchain using thirdweb's Solana SDK and use Bundlr to store your images of the NFTs permanently and in a decentralised way.

Tools:

  • Solana SDK: To deploy the token with metadata.
  • Bundlr: To store the images of the NFTs permanently.

Using This Template

Create a project using this example:

npx thirdweb create --template thirdweb-bundlr

Install dependencies:

npm install # npm

yarn # yarn
  • Export your wallet private key from phantom wallet and add it to the .env file.
PRIVATE_KEY=your_private_key
  • Run the project:
npx ts-node mint.ts

How It Works

Using the thirdweb SDK, you can create and deploy your own nft drop on the Solana blockchain. We use the .fromPrivateKey function to connect to the wallet using the private key and then use the .deployer.createNftDrop function from the sdk initialized to deploy the program.

const sdk = ThirdwebSDK.fromPrivateKey("devnet", walletPrivateKey!);

  // Metadata for the program
  const programMetadata = {
    name: "My NFT Drop",
    symbol: "MND",
    description: "This is my NFT Drop",
    totalSupply: 3,
  };

  // Deploying the program
  const address = await sdk.deployer.createNftDrop(programMetadata);
  console.log("Program Address: ", address);

Next, we use bundlr to upload the images folder:

// Initializing the bundlr client
const bundlr = new Bundlr(
  "https://node2.bundlr.network",
  "solana",
  walletPrivateKey
);

// Uploading the folder
const uploadedFolder = await bundlr.uploadFolder("./images");
console.log("Uploaded folder: ", uploadedFolder?.id);

Now, we use this to create metadata for our NFTs:

const metadata = [
  {
    name: "NFT #1",
    description: "My first NFT!",
    image: `https://arweave.net/${uploadedFolder?.id}/0.jpg`,
    properties: [
      {
        name: "kitten",
        value: "very cute!",
      },
    ],
  },
  {
    name: "NFT #2",
    description: "My second NFT!",
    image: `https://arweave.net/${uploadedFolder?.id}/1.jpg`,
    properties: [
      {
        name: "grumpy cat",
        value: "grumpy!",
      },
    ],
  },
  {
    name: "NFT #2",
    description: "My third NFT!",
    image: `https://arweave.net/${uploadedFolder?.id}/2.jpg`,
    properties: [
      {
        name: "Ninja Cat",
        value: "warrior!",
      },
    ],
  },
];

Finally, we get the drop we just deployed and lazyMint the NFTs using the metadata:

// Getting the program
const program = await sdk.getNFTDrop(address);
// Minting the NFTs
const tx = await program.lazyMint(metadata);
console.log("signature: ", tx[0].signature);

Join our Discord!

For any questions or suggestions, join our discord at https://discord.gg/thirdweb.

thirdweb-bundlr's People

Contributors

avneesh0612 avatar ciaranightingale avatar

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.