• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

yusefnapora/minty: a minimal NFT minting platform using IPFS

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

yusefnapora/minty

开源软件地址:

https://github.com/yusefnapora/minty

开源编程语言:

JavaScript 96.5%

开源软件介绍:

minty

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.

Usage

Run minty help to see full usage instructions or minty help <command> for help on a specific command:

minty help mint

> create a new NFT from an image file
> 
> Options:
>   -n, --name <name>         The name of the NFT
>   -d, --description <desc>  A description of the NFT
>   -o, --owner <address>     The ethereum address that should own the NFT.If not provided,
>                             defaults to the first signing address.
>   -h, --help                display help for command

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/yusefnapora/minty
    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. 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:

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:


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap