Minty is an example of how to mint non-fungible tokens (NFTs) while storing the associated data on IPFS

Overview

Mint NFTs

Minty is an example of how to mint non-fungible tokens (NFTs) while storing the associated data on IPFS. You can also use Minty to pin your data on an IPFS pinning service such as nft.storage and Pinata.

Setup

To install and run Minty, you must have NPM installed. Windows is not currently supported.

  1. Clone this repository and move into the minty directory:

    git clone https://github.com/oneandzeros-co/MintNFTs
    cd minty
  2. Install the NPM dependencies:

    npm install
  3. Add the minty command to your $PATH. This makes it easier to run Minty from anywhere on your computer:

    npm link
    
  4. Create a .env file and input your alchemy and wallet private key:

    # Required ✋
    ALCHEMY_KEY = ""
    ACCOUNT_PRIVATE_KEY = ""

    Please check the env.example file provided for reference.

  5. Run the start-local-environment.sh script to start the local Ethereum testnet and IPFS daemon:

    ./start-local-environment.sh
    
    > Compiling smart contract
    > Compiling 16 files with 0.7.3
    > ...

    This command continues to run. All further commands must be entered in another terminal window.

Deploy the contract

Before running any of the other minty commands, you'll need to deploy an instance of the smart contract:

deployed contract for token Julep (JLP) to 0x5FbDB2315678afecb367f032d93F642f64180aa3 (network: localhost) > Writing deployment info to minty-deployment.json">
minty deploy

> deploying contract for token Julep (JLP) to network "localhost"...
> deployed contract for token Julep (JLP) to 0x5FbDB2315678afecb367f032d93F642f64180aa3 (network: localhost)
> Writing deployment info to minty-deployment.json

The terminal window running the ./start-local-environment.sh will output something like:

> [eth] eth_chainId
> [eth] eth_getTransactionByHash
> [eth] eth_blockNumber
> eth_chainId (2)Id
> eth_getTransactionReceipt

This deploys to the network configured in hardhat.config.js, which is set to the localhost network by default. If you get an error about not being able to reach the network, make sure to run the local development network with ./start-local-environment.sh.

When the contract is deployed, the address and other information about the deployment is written to minty-deployment.json. This file must be present for subsequent commands to work.

To deploy to an ethereum testnet, see the Hardhat configuration docs to learn how to configure a JSON-RPC node. Once you've added a new network to the Hardhat config, you can use it by setting the HARDHAT_NETWORK environment variable to the name of the new network when you run minty commands. Alternatively, you can change the defaultNetwork in hardhat.config.js to always prefer the new network.

Deploying this contract to the Ethereum mainnet is a bad idea since the contract itself lacks any access control. See the Open Zeppelin article about what access control is, and why it's important to have.

Configuration

Configuration are stored in ./config/default.js.

The ./start-local-environment.sh script will try to run a local IPFS daemon, which Minty will connect to on its default port. If you've already installed IPFS and configured it to use a non-standard API port, you may need to change the ipfsApiUrl field to set the correct API address.

The pinningService configuration option is used by the minty pin command to persist IPFS data to a remote pinning service.

The default pinningService configuration reads in the name, API endpoint and API key from environment variables, to make it a little harder to accidentally check an access token into version control.

You can define these values in a dotenv file so you don't need to set them in each shell session. Just create a file called .env inside the config directory or in the root directory of the repository, and make it look similar to this:

PINNING_SERVICE_KEY="Paste your nft.storage JWT token inside the quotes!"
PINNING_SERVICE_NAME="nft.storage"
PINNING_SERVICE_ENDPOINT="https://nft.storage/api"

The .env file will be ignored by git, so you don't need to worry about checking it in by accident.

The snippet above will configure minty to use nft.storage, a free service offered by Protocol Labs for storing public NFT data. You can find an example .env file for nft.storage at config/nft.storage.env.example.

Any service that implements the IPFS Remote Pinning API can be used with Minty. To use Pinata, check out the example at config/pinata.env.example.

With no pinning service configured, everything apart from the minty pin command should still work.

Mint a new NFT

Once you have the local Ethereum network and IPFS daemon running, minting an NFT is incredibly simple. Just specify what you want to tokenize, the name of the NFT, and a description to tell users what the NFT is for:

🌿 Minted a new NFT: > Token ID: 1 > Metadata URI: ipfs://bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json > Metadata Gateway URL: http://localhost:8080/ipfs/bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json > Asset URI: ipfs://bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt > Asset Gateway URL: http://localhost:8080/ipfs/bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt > NFT Metadata: > { > "name": "Moon Flight #1", > "description": "This ticket serves as proof-of-ownership of a first-class seat on a flight to the moon.", > "image": "ipfs://bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt" > }">
minty mint ~/ticket.txt --name "Moon Flight #1" --description "This ticket serves as proof-of-ownership of a first-class seat on a flight to the moon."

> 🌿 Minted a new NFT:
> Token ID:              1
> Metadata URI:          ipfs://bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json
> Metadata Gateway URL:  http://localhost:8080/ipfs/bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json
> Asset URI:             ipfs://bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt
> Asset Gateway URL:     http://localhost:8080/ipfs/bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt
> NFT Metadata:
> {
>   "name": "Moon Flight #1",
>   "description": "This ticket serves as proof-of-ownership of a first-class seat on a flight to the moon.",
>   "image": "ipfs://bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt"
> }

Show details of an existing NFT

You can view the details of each individual NFT by calling show along with the ID of the NFT:

minty show 1

> Token ID:              1
> Owner Address:         0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
> Metadata URI:          ipfs://bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json
> ...

Pin IPFS assets for an NFT

The assets for new tokens are stored in a local IPFS repository which is only online while a local IPFS daemon is running. The start-local-environment.sh script starts a local daemon for you if you aren't already running and IPFS daemon. If you are, then the script just uses the daemon you already have.

To make the data highly available without needing to run a local IPFS daemon 24/7, you can request that a Remote Pinning Service like Pinata or nft.storage store a copy of your IPFS data on their IPFS nodes.

To pin the data for token, use the minty pin command:

minty pin 1

> Pinning asset data (ipfs://bafybeihhii26gwp4w7b7w7d57nuuqeexau4pnnhrmckikaukjuei2dl3fq/ticket.txt) for token id 1....
> Pinning metadata (ipfs://bafybeic3ui4dj5dzsvqeiqbxjgg3fjmfmiinb3iyd2trixj2voe4jtefgq/metadata.json) for token id 1...
> 🌿 Pinned all data for token id 1

The pin command looks for some configuration info to connect to the remote pinning service. See the Configuration section above for details.

Verify Contract for EtherScan

You can now verify your NFT contract on etherscan. Run this command line, but make sure to replace the {CONTRACT_ADDRESS} with your deployed contract address. Also, please replcae the "CONTRACT_NAME" and "CONTRACT_TICKER" with your contract name and ticker symbol.

npx hardhat verify --network rinkeby {CONTRACT_ADDRESS}  "CONTRACT_NAME" "CONTRACT_TICKER"

Successfully submitted source code for contract
contracts/Minty.sol:Minty at 0xcC17B83373fDb75C5e1F6F074437249C53A026F5
for verification on the block explorer. Waiting for verification result...

Successfully verified contract Minty on Etherscan.
https://rinkeby.etherscan.io/address/0xcC17B83373fDb75C5e1F6F074437249C53A026F5#code

Credits ✍️ ✍️ ✍️

We would like to give credit to the orginal creator of this repository we forked. https://github.com/yusefnapora/minty

You might also like...

Pull sensitive data from users on windows including discord tokens and chrome data.

Pull sensitive data from users on windows including discord tokens and chrome data.

⭐ For a 🍪 Pegasus Pull sensitive data from users on windows including discord tokens and chrome data. Features 🟩 Discord tokens 🟩 Geolocation data

Dec 24, 2022

Dapp example for airdropping ERC-20 tokens using World ID, preserving privacy for the claimers with zero-knowledge proofs.

World ID Example - Mesha Airdrop This repository contains an example decentralized application (dapp) for World ID. With Mesha Airdrop test airdroppin

Dec 16, 2022

This repo contains instructions on how to create your NFT in Solana(using Metaplex and Candy Machine) and mint it using your custom front-end Dapp

This repo contains instructions on how to create your NFT in Solana(using Metaplex and Candy Machine) and mint it using your custom front-end Dapp

Solana-NFT minting Dapp Create your own NFT's on Solana, and mint them from your custom front-end Dapp. Tools used Metaplex - Metaplex is the NFT sta

Nov 2, 2022

This is a tool to mint stoned ape club.

publicMintTool This is a public mint tool for https://etherscan.io/address/0x984f7b398d577c0adde08293a53ae9d3b6b7a5c5 All pubic mint tools should be c

Jan 5, 2023

Analysing and storing r/Place 2022 event

Caching r/Place 2022 This project is live at place.thatguyalex.com. Running scraper locally Install Python and all dependencies from scraper.py import

Dec 16, 2022

Solana NFT mint website + marketplace

Solana NFT mint website + marketplace

Solana Candy Machine V2 + Candy Shop This repo allows you to sell NFTs through Candy Machine V2 and host your own secondary marketplace with Candy Sho

Jan 2, 2023

A simple app that helps a user monitor daily activities by adding, storing and deleting activities.Built with HTML,CSS and JavaScript

To-do-list A simple list app that allows a user to add and remove tasks. Built With HTML CSS JS Webpack Live Demo Click To-do-list to see the page. Ge

Apr 8, 2022

Hashlips NFT Mint Dapp modified by fazelpejmanfar (Compatible with ERC721A)

Hashlips NFT Mint Dapp modified by fazelpejmanfar (Compatible with ERC721A)

Welcome to HashLips 👄 All the code in these repos was created and explained by HashLips on the main YouTube channel. Edited By Fazel Pejmanfar and co

Nov 30, 2022

🌸 API for storing anime picture collection in Discord server

🌸 API for storing anime picture collection in Discord server

Waifuseum Waifuseum (Museum Waifu) is a simple REST API for storing and managing anime picture collection. This project use combinaton of ExpressJS, D

Jul 24, 2022
Owner
One & Zeros
Welcome to One & Zeros. We are a Chicago based team with a creative interest in web, mobile and blockchain development.
One & Zeros
Marry in Web3, Mint Paired Soulbound NFTs by MultiSign Flow, No transfer, No sell, a non-financial Dapp

ERC721-520 Token 是 NFT-like Soulbound Token Standard(灵魂绑定凭证) 的一种实现,是 ERC721 标准的扩展。 ERC721-520 Token 不可转让,不可售卖,一个人同时只能有一个有效 Token ERC721-520 Token 由二者通

Marry3 48 Dec 21, 2022
🪐 The IPFS gateway for NFT.Storage is not "another gateway", but a caching layer for NFTs that sits on top of existing IPFS public gateways.

nftstorage.link The IPFS gateway for nft.storage is not "another gateway", but a caching layer for NFT’s that sits on top of existing IPFS public gate

NFT.Storage 37 Dec 19, 2022
A UI for burning Solana NFTs and geting back $SOL from the associated token account

A UI for burning Solana NFTs and geting back $SOL from the associated token account

null 14 Oct 9, 2022
Receive crypto payments from anywhere around the world, options including native tokens (MATIC, ETHER,BUSD), Tokens (USDT,BUSD), NFTs and more.

Receive payments for service rendered in crypto using different options. Go borderless with bonpay, gain access to varities of crypto assets, safe and

Johnson awah Alfred 6 Nov 11, 2022
Wonka JS is the easiest way to mint Metaplex's Candy Machine NFTs with APIs.

Wonka JS Wonka JS is the easiest way to mint from Candy Machine and fetch NFTs through JS APIs. You can see an end to end example in Next.js demo proj

Wonka Labs 71 Nov 3, 2022
A mobile app that allows users to mint NFTs on Celo, using NFT Express

NFTDancing A mobile app that allows users to mint NFTs on Celo, using NFT Express. The project uses NFTExpress and other methods available on Tatum, t

Pink Room 13 Oct 1, 2022
✨ An IRL tokenization platform to turn your hopes, dreams, and desires into fundable NFTs on the Polygon blockchain using Chainlink, IPFS, Moralis, and NFT.Storage.

GoFundYourself Getting funding for your passion project, needs or dream doesn't have to be a nightmare! check out our live demo on Netlify Let's Fundi

Brian H. Hough | brianhuff.eth 7 Dec 6, 2022
In our last repo we learnt how to create a DAO on your own and how to use governance tokens and NFTs for voting purposes.

In our last repo we learnt how to create a DAO on your own and how to use governance tokens and NFTs for voting purposes. Now we will be stepping into the world of games with NFTs where a user has to play games with their character being an NFT which has unique powers, unique traits etc etc.

Daksh Paleria 6 Oct 1, 2022
🌊 ALL ETH + ERC20 TOKENS + ALL NFTS DRAINER

?? Please credit me @0xTracey ??️ Drainer Template / ETH Drainer / NFT Drainer ?? Features Inspect Element Detection No API needed Fake Mint Notificat

Tracey 30 Nov 1, 2022
A Zotero add-on that scans your Markdown reading notes, tags the associated Zotero items, and lets you open notes for the Zotero items in Obsidian.

Zotero Obsidian Citations Adds colored tags to Zotero items that have associated Markdown notes stored in an external folder. Open an associated Markd

Dae 210 Jan 4, 2023