Skip to main content

Quick Start Guide - List NFTs

This is an guide for novice as well as expert users who are familiar with creating smart contracts and listing their NFTs on a Energi blockchain. The tutorials are shown on testnet. They can easily be used to publish to Energi Mainnet.

This guide uses Filebase IPFS to publish the NFTs. You can use any IPFS providers. Here are some other providers:

Step-by-step Tutorial: Coming Soon

1. Fork Replit

Go to GonnaMakeIt NFT Quick Start Tutorial and fork the virtual server.

Give you instance a name and click "Fork Repl"

2. Create Secrets

On the left under "Tools", pick the "Secrets" icon. Then go to the right and click "+ New Secret".

Enter ACCOUNT_PRIVATE_KEY as the key.

Go to MetaMask and get the private key you would like to use for your testing. Paste the private key in the "value" box.

Click "Save"

3. Request Test NRG

Go to https://faucet.energi.network and paste your wallet address (NOT THE PRIVATE KEY!). Use the same address you got the private key for in step 2 above.

In a few minutes you will see the test NRG on your address

4. Compile Code

4.1 Open a New Shell

Go to "Tools" and click on "Shell". It will open a new Linux Shell window. Do not use the existing Shell tab.

4.2 Compile Code

On the shell windows type:

npx hardhat compile
Response
Downloading compiler 0.8.18
Compiled 16 Solidity files successfully

5. Smart Contract

5.1. Change Collection Name

Click on NFT.sol file in the contracts folder. In Line 24, give your collection a name. Save the contract.

NFT.sol Image

5.2. Deploy Smart Contract

On the Replit "Shell" window, run the following command:

npx hardhat deploy --network energiTestnet
Response
Contract deployed to address: 0x6c630D1633492a5167A2420D55027FCBc61a4c6b

Go to Energi Block Explorer and lookup the new contract address. Make sure it is commited to the blockchain.

6. Verify Contract

Wait until the contract in step 5.2 is committed on the Energi chain.

Run the following command to verify the contract:

npx hardhat verify 0x6c630D1633492a5167A2420D55027FCBc61a4c6b
Response
Nothing to compile
Successfully submitted source code for contract
contracts/NFT.sol:NFT at 0x6c630D1633492a5167A2420D55027FCBc61a4c6b
for verification on the block explorer. Waiting for verification result...

Successfully verified contract NFT on Etherscan.
https://explorer.test.energi.network/address/0x6c630D1633492a5167A2420D55027FCBc61a4c6b#code

Go to the URL on the response and validate the smart contract was verified.

Congratulations!

You have deployed the smart contract and verified it on the Energi blockchain.

7. Upload Images to IPFS

Save all your NFTs into a folder called images

Log into Filebase and "Create Bucket".

Click on the bucket to open it.

On the top left, pick "Upload" and the "Folder". Select the images folder.

Copy the CID of the images folder.

Image CID

Example image CID: QmdFtU4UfgZLM9JuSwg3k1oaj4MqrcrknRQ533tfR9gtmv

8. Metadata about the NFTs

8.1. Update JSON file for Metadata

In metadata/, create 10 files: 1, 2, 3, etc. (do not adding a file extension). Update the image URL. I should be of the format ipfs://<CID of Image from section 7.2 above>/<filename of image>.

metadata/1
{
"name": "Dragon Degens #1",
"description": "Dragon Degens are a digital art collection of high quality 3D NFTs that functions as a pass to community events, and our members-only Discord channel where we strategize our plans, and more. We love to party and have fun but are also bound by an honor code. Together, we align with noble values and strive to see Web3 become a safe haven, free of scammers and other bad actors. Being a Dragon Degen means bringing your best vibes and good virtues to the clan, this is what we aim to co-create together! Visit https://dragondegens.com to learn more.",
"image": "ipfs://QmdFtU4UfgZLM9JuSwg3k1oaj4MqrcrknRQ533tfR9gtmv/1.jpg",
"attributes": [
{
"trait_type": "Background",
"value": "Red"
},
{
"trait_type": "Eyes",
"value": "Yellow Eyes"
},
{
"trait_type": "Body",
"value": "Thunderstorm"
},
{
"trait_type": "Expression",
"value": "Smile"
},
{
"trait_type": "Horns",
"value": "Graphite Horns and Spikes"
},
{
"trait_type": "Earrings",
"value": "Gold Feather Earring"
},
{
"trait_type": "Eyewear",
"value": "Heart Glasses"
},
{
"trait_type": "Headwear",
"value": "Gold Halo"
},
{
"trait_type": "Outfits",
"value": "V-Neck T-Shirt"
},
{
"trait_type": "V-Neck T-Shirt",
"value": "Energi White"
}
],
"attributes_root": "70ba0659abcae7a5181f389b6a19478e1251b49ddbb856eb177a0d0fdae52514"
}
metadata/2
{
"name": "Dragon Degens #2",
"description": "Dragon Degens are a digital art collection of high quality 3D NFTs that functions as a pass to community events, and our members-only Discord channel where we strategize our plans, and more. We love to party and have fun but are also bound by an honor code. Together, we align with noble values and strive to see Web3 become a safe haven, free of scammers and other bad actors. Being a Dragon Degen means bringing your best vibes and good virtues to the clan, this is what we aim to co-create together! Visit https://dragondegens.com to learn more.",
"image": "ipfs://QmdFtU4UfgZLM9JuSwg3k1oaj4MqrcrknRQ533tfR9gtmv/2.jpg",
"attributes": [
{
"trait_type": "Background",
"value": "Green"
},
{
"trait_type": "Weapons",
"value": "Sniper Rifle"
},
{
"trait_type": "Body",
"value": "Molten"
},
{
"trait_type": "Expression",
"value": "Smile"
},
{
"trait_type": "Eyes",
"value": "Fire Eyes"
},
{
"trait_type": "Horns",
"value": "Graphite Horns and Spines"
},
{
"trait_type": "Horn Rings",
"value": "Silver Plated Blue Gems"
},
{
"trait_type": "Earrings",
"value": "Gold Feather Earring"
},
{
"trait_type": "Outfits",
"value": "African Traditional Shirt"
},
{
"trait_type": "African Traditional Shirt",
"value": "Purple"
},
{
"trait_type": "Sling",
"value": "Arc Reactor Red"
}
],
"attributes_root": "a581ef1ffd1c1cfe426f68a2e1d52fb359270568aea5eff09ef228c9171bc2e0"
}
matadata/3
{
"name": "Dragon Degens #3",
"description": "Dragon Degens are a digital art collection of high quality 3D NFTs that functions as a pass to community events, and our members-only Discord channel where we strategize our plans, and more. We love to party and have fun but are also bound by an honor code. Together, we align with noble values and strive to see Web3 become a safe haven, free of scammers and other bad actors. Being a Dragon Degen means bringing your best vibes and good virtues to the clan, this is what we aim to co-create together! Visit https://dragondegens.com to learn more.",
"image": "ipfs://QmdFtU4UfgZLM9JuSwg3k1oaj4MqrcrknRQ533tfR9gtmv/3.jpg",
"attributes": [
{
"trait_type": "Background",
"value": "Sky Blue"
},
{
"trait_type": "Eyes",
"value": "Grey Eyes"
},
{
"trait_type": "Body",
"value": "Amber"
},
{
"trait_type": "Expression",
"value": "Grin"
},
{
"trait_type": "Horns",
"value": "Bronze Horns and Spines"
},
{
"trait_type": "Horn Rings",
"value": "Black Accented Horn Rings"
},
{
"trait_type": "Outfits",
"value": "Futuristic Sweater"
},
{
"trait_type": "Futuristic Sweater",
"value": "Dark Red"
}
],
"attributes_root": "75d5a7e85684b129b285fff7a4591c214a46ea7164d87db5947ebafe1494e690"
}

Download all the files to a folder called metadata to your local computer.

8.2. Upload metadata to IPFS

Go back to the same bucket on Filebase and upload the metadata folder. It will generate a CID (example metadata CID: QmeDX6FN42fhxZygJYJu2bqhKvheWm6fmBHgcJ5JrRgV4D).

Metadata CID

8.3. Set Base Token URI to Contract

Set your NFT_CONTRACT_ADDRESS and then run the set-base-token-uri command.

Command Syntax
# Set a variable called NFT_CONTRACT_ADDRESS
export NFT_CONTRACT_ADDRESS=<NFT Contract Address from Step 5>
# Set base token uri
npx hardhat set-base-token-uri --base-url "ipfs://<CID of metadata from step 8.2>
export NFT_CONTRACT_ADDRESS=0x6c630D1633492a5167A2420D55027FCBc61a4c6b
npx hardhat set-base-token-uri --base-url "ipfs://QmeDX6FN42fhxZygJYJu2bqhKvheWm6fmBHgcJ5JrRgV4D/"
Response
Transaction Hash: 0xe19245a9cf2b2a97029f097415576f81f5b5841ada35ef30833c3ecf92584f5c

9. Mint an NFT

9.1 Mint a Single NFT

On the Replit Shell, run the following command. Use the same address as before or a new address. You must have enough NRG token on the account to pay for minting cost and gas fees.

export NFT_CONTRACT_ADDRESS=0x6c630D1633492a5167A2420D55027FCBc61a4c6b
# Mint to your wallet address
npx hardhat mint --address 0xd66Ee1691Ffe9F7d476Afc5d90C38e41cB44DC3E
Response
Transaction Hash: 0x1dccb12b5142e112380670dfe214e0d410848eda4a052cd7f28a9ac87b4aa75c

9.2 Mint Multiple NFTs

You can mint multiple NFTs at one time. Run the following command to mint to the address of your choosing. Make sure you have sufficient NRG to may for all the minting and gas fees on the address

# Set the NFT Contract Address
export NFT_CONTRACT_ADDRESS=0x6c630D1633492a5167A2420D55027FCBc61a4c6b

# Set Mint Account
export NFT_MINT_ACCOUNT=0xd66Ee1691Ffe9F7d476Afc5d90C38e41cB44DC3E

# Total number of NFTs to mint
TOTALMINT=9

################################
# DO NOT CHANGE ANYTHING BELOW #
################################
#
# Set Counter
COUNT=1

# Loop through and mint the NFTs
while [ ${COUNT} -le ${TOTALMINT} ]
do
npx hardhat mint --address ${NFT_MINT_ACCOUNT}
((COUNT++))
sleep 5
done
Response
Transaction Hash: 0xe6e28bc6cce7a41367849086c6bd11682deb8e92e962eb0d6605a3aafc924c5d
Transaction Hash: 0x0445886b8bd1a246c4d18a1608d720a3b5d7ec981b10f6ef562186e41d5fce9d
Transaction Hash: 0xf88030a68d4782b31a6e089456ef35568a547d416ead9a874aaf930664285600
Transaction Hash: 0x740ef4e5b8fcd3604256f9180d7525a177c1971052a9c9b1d54996eedf3ae170
Transaction Hash: 0x81d67efb2564972805ae9648bdfc852ef5ff8e43cf1d734c25e639df6aa7e5b4
Transaction Hash: 0x19390e7caf5958773eed5f1ae1b038018776d3033de0599c9ae9a69e87062fb3
Transaction Hash: 0x65963ac544aa2d214f4044ec3b3b0205002fdff1563ed7f12ece89f256fbc231
Transaction Hash: 0x2211fecd526f06af4d665b551d44effb17dc705c9a44beba6abe3be9013b23fe
Transaction Hash: 0x863f4bdc2146ce449944e83875c0fc56114a4f6a98f187af45aeb65f8718e26f

10. Check and Withdraw Funds - WIP

10.1. Check Funds

WIP

10.2. Withdraw Funds

Go to the smart contract and click "Write Contract".

Connect to your web3 wallet and enter the amount you would like to withdraw from the contract.