This example will include the process of creating a simple NFT demo on Harmony Testnet, using NFT.Storage to store off-chain NFT data on IPFS and Filecoin to achieve the total decentralization of your NFT.
- HRC721/NFT smart contract
- Connecting to Harmony blockchain via MetaMask
- Uploading NFT assets via NFT.Storage
- Invoking NFT smart contract to mint NFT via MetaMask
This example requires basic knowledge about harmony blockchain, HRC721/ERC721, Truffle and MetaMask. Before you start this tutorial, make sure you have installed the necessary tools.
- Node.js
- Truffle
- Metamask browser extension fill with Harmony TestNet Token (ONE)
- NFT.Storage Account for API key
-
Clone Project
git clone https://github.com/longfeiWan9/harmony-nft-demo.git cd harmony-nft-demo
-
Modify the smart contract
contracts\HarmonyNFT.sol
according to your preference.//Deply EPC721 with name and description specified. constructor() ERC721 ("ETH on Harmony using NFT.Storage", "HNFT-L") {}
-
Export you Harmony wallet private key and add it into
truffle-config.js
for smart contract deploymentconst privateKeyTest = '<HARMONY-WALLET-PRIVATE-KEY>';
-
Install the dependencies.
npm install
-
Compile and deploy your smart contract
truffle deploy --network harmonyTestnet
copy the deployed smart contract address to
src\components\MintNFT.js
const nftContractAddress = '<YOUR-NFT-SMART-CONTRACT-ADDRESS>';
-
Get an NFT.Storage API key from NFT.Storage and add it in
src\components\MintNFT.js
const APIKEY = '<YOUR-NFTSTORAGE-API-KEY>';
-
Start the front end and try it out
npm start