🛠️ We're partnering with Alchemy to bring you a free Ethereum Developer Bootcamp! Get started here 🛠️
You've just created an NFT and you want to sell it to your fellow NFT enthusiasts. To do this, we have to put a price on the NFT, and there are two primary ways to attach a price:
NOTE: The following section is not a turnkey solution. In Step 10 of the NFT Creation Tutorial, we would need to alter the Solidity to accept payments for minting which means that any frontendweb3 / ethers.jslogic dictating minting would need to include themsg.valueparameter to allow for the transfer of ETH.
This fee pattern is completely decentralized since it takes place in-contract and bakes the fee mechanism into the minting process itself. To implement a price on minting, you need to alter your smart contract to include this behavior. As a high-level summary, a NFT minting price can be enacted by making the mint function payable and requiring the user to pay a particular amount of ETH before triggering the transfer of the NFT to the buyer.
Here's a sample piece of code for this type of minting process:
function mintToken(address to, uint256 tokenId, string uri) public virtual payable
require(msg.value >= 10, "Not enough ETH sent; check price!");
There are many different variants for implementing fees into minting contracts. The one listed above is one of the most simple but many protocols also use fee patterns that are significantly more complex.
A non-coding alternative would be to simply list your newly minted NFT on OpenSea or another NFT auction website which would allow you to place a price on it. OpenSea's UI layer running on top of the NFT allows you to place prices, accept bids, or have other more complex auction methods and handles all the logic for you.
For Ethereum mainnet, use: https://opensea.io/
For a testnet, use: https://testnets.opensea.io/
NOTE: NFT auction platforms typically charge for listing and handling the auction process. Keep to date with different platforms to find competitive rates and maximize your NFT sales. Zora and SuperRare are two alternative platforms that also offer similar services to OpenSea.