Code Monkey home page Code Monkey logo

chia-nft-minting-tool's Introduction

ChiaNFT

Setup Instructions

  • Stop any running wallet/node instances: chia stop -d all

  • Clone this repo, create/activate a new virtual environment

git clone https://github.com/Chia-Network/chia-nft-minting-tool.git
  • Install chianft and the necessary chia-blockchain branch (make sure to include the '.' at the end):
pip install --extra-index https://pypi.chia.net/simple/ --editable .
  • Start testnet wallet and node: chia start wallet, and chia start node

  • Create a fresh wallet and fund it with 2 coins, small amounts like 0.001 xch are fine

  • Create a DID for the wallet: chia wallet did create. This creates an NFT wallet with the DID id

  • Create a regular NFT wallet (where our minted NFTs will be stored since we don't attach the DID during minting): chia wallet nft create

  • Make sure the wallet and node are fully synced

Usage Examples

Test 1 - Mint and air-drop to targets.

This test will create 100 NFTs and air-drop them to a target address

  1. Generate the factory data. The "t" flag indicates we should include a target address in the metadata csv and 1000 indicates the number of nfts to generate.
python factory_metadata.py t 1000
  1. Create the spend bundles. Here the -w is the wallet ID for the NFT wallet, -t True indicates we have targets in the metadata csv, -a and -r are the royalty address and percentage.
chianft create-mint-spend-bundles -w 3 -d True -a txch1q02aryjymlslllpauhu7rhk3802lk3e5peuce8gy947dnggpegysqegkzk -r 300 -t True metadata.csv output.pkl

Non-did version:

chianft create-mint-spend-bundles -w 3 -d False -a txch1q02aryjymlslllpauhu7rhk3802lk3e5peuce8gy947dnggpegysqegkzk -r 300 -t True metadata.csv output.pkl
  1. Submit the spend bundles created in output.pkl. The -m flag is for the flat fee used for each spend bundle of 25 NFTs
chianft submit-spend-bundles -m 1000 output.pkl

Test 2 - Mint and create offers for each NFT

This test will create 100 NFTs and air-drop them to a target address

  1. Generate the factory data. Don't use a "t" for target flag since we want to mint to our own wallet
python factory_metadata.py 1000
  1. Create the spend bundles. No -t flag here since we aren't transfering the NFTs out of our wallet.
chianft create-mint-spend-bundles -w 3 -d True -a txch1q02aryjymlslllpauhu7rhk3802lk3e5peuce8gy947dnggpegysqegkzk -r 300 metadata.csv output.pkl

Non-did version:

chianft create-mint-spend-bundles -w 3 -d False -a txch1q02aryjymlslllpauhu7rhk3802lk3e5peuce8gy947dnggpegysqegkzk -r 300 metadata.csv output.pkl
  1. Submit the spend bundles created in output.pkl. Here the -o flag indicates we want to create an offer file for each NFT with a trade price of 100 mojo
chianft submit-spend-bundles -m 1000000 -o 1000 output.pkl

Testing

Tests are located in the tests directory. To run them, make sure to install the tool with dev dependencies:

pip install --extra-index https://pypi.chia.net/simple/ --editable .[dev]

To run the tests use:

pytest tests/test_mint.py

Tool Specification

The mint tool will be a Command Line Interface (CLI) tool. It will have commands and options that can be specified by the user to control settings they wish to configure. The mint process will be split into two phases: offline spend bundle creation and online spend bundle submission.

The program itself will be called: chianft

Phase 1: Spend Bundle Creation

The program will have a create-mint-spend-bundles command This option will accept the following parameters

(Optional) -r –-royalty-amount <amount> This option specifies the percentage amount of a royalty that should be paid on transfer. Requires –enable-did

(Optional) -a –-royalty-address <address> This option specifies the address that royalty payments should be paid to on transfer. Requires –enable-did

(Optional) -t --has-targets <True/False> This option determines whether the spend bundles will include an extra spend to sent the created NFTs to a target address specified in the targets field of the input csv.

(Required) -w --wallet-id <int> The NFT wallet ID you want to use for minting. It is a requirement that this NFT have an associated DID.

(Required) –-input <filename> This option will provide the name of a CSV file containing the on-chain metadata for each NFT to be minted

Fields: data_url, dapfta_hash, metadata_url, metadata_hash, license_url, license_hash, edition_number, edition_count, target The target address is optional and is used when you want to air-drop NFTs once they've been minted.

(Required) –-output <filename> This option specifies the file that should be used to store the generated spend bundles.

Phase 2: Spend Bundle Submission

The program will have a submit-spend-bundles command This option will accept the following parameters:

(Required) <filename> This option will provide the name of the file outputted by the create-mint-spend-bundles command

(Optional) –fee <cost> This option will provide the number of mojos that should be paid for each spend bundle as a flat fee.

(Optional) -o –create-sell-offer <amount> This option will specify if an offer file should be created to sell each NFT. The offer files will be saved in an “offers” subdirectory. If the command stops before submitting all the spend bundles, it should be able to resume where it left off.

Process should be displayed as spend bundles are submitted to the mempool: Progress output: Queued: x Mempool: y Complete: z

chia-nft-minting-tool's People

Contributors

geoffwalmsley avatar wallentx avatar cameroncooper avatar jack60612 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.