Neo N3 NFT Creation
A developers guide to creating Neo N3 NFTs compatible with GhostMarket
Introduction
This page provides step-by-step instructions for deploying GhostMarket compatible NFTs on the Neo N3 blockchain. The Neo 2 legacy blockchain is not supported.
The NFT creation process requires interaction with the blockchain. For retrieving existing NFT metadata, see Accessing NFT data, which uses the GhostMarket APIs.
The snippets used in this guide are javascript.
The code snippets also assume a node.js environment.
See our Metadata Reference for full details and requirements of GhostMarket NFT metadata.
NFT Creation
The NFT creation process on all blockchains broadly consists of the following steps.
Prepare Off-Chain Metadata and persist it.
Assemble On-Chain Metadata and build a transaction.
Sign the transaction.
Broadcast to the blockchain.
1. Prepare Off-Chain Metadata
The preferred decentralised platform for persisting image/media data for your NFT is IPFS.
This guide will use Piñata to upload and pin your images to IPFS.
Set up a Piñata account and get started here.
You can either manually upload you metadata, noting the IPFS hash, or dive into the Pinata js-sdk to interact with Piñata programatically.
Take note of the IPFS hash of the uploaded metadata, you will need it in the following step.
2. Assemble On-Chain Metadata
GhostMarket Neo N3 NFT contract stores all metadata on-chain as a JSON string.
We will use the neon-js npm module to work with the Neo N3 blockchain. The full neon-js docs can be found here
Install the needed modules
Import the library
Assemble the Minting Parameter JS Object
GhostMarket Neo N3 NFT contract allows you to serialize the NFT's metadata object to JSON and store On-Chain. Let's create the Metadata.
In this example, for clarity, we will create the attribute and properties objects separately:
Royalties and locked contend do not form part of the MetaData, they are specified later in the contract parameters.
Example using On-Chain Metadata
Build the transaction script
Define account and RPC Network objects needed later
Define the royalties that the creator wishes to receive from each sale of the NFT.
3. Construct & Sign the transaction
4. Finally, broadcast to the network
Congratulations, you have successfully deployed a GhostMarket compatible NFT to GhostMarket contract on Neo N3 blockchain.
For clarity, all of the above snippets exclude error and promise handling for clarity. Production code should include thorough exception management and handle promises appropriately.
Last updated