Create a standard NFT smart contract and sell it on OpenSea
The ERC-721 standard for non-fungible tokens was proposed in 2018 to prove on-chain digital ownership of individual entities. Since then, the NFT markets have grown in popularity exponentially.
At the time of this writing, the most expensive NFT sold so far is CryptoPunk # 9998 [click to go to OpenSea] sold for $ 530 million (124,457 Ethers).
Some interesting facts about NFT are:
- There are $10-$20 million worth of NFT sold in the blockchain every week.
- Complete value of NFT sales in 2020 was $250 million.
- Nonfungible.com surpassed a value of $2 billion in 2021
- The collectibles market is the fastest growing.
NFT Ocean
OpenSea is the largest NFT market in the world. More than 200 thousand users moved more than $ 2 billion (420,000 Ethers) in the last month alone.
There’s no question that OpenSea is by far one of the biggest players in the NFT business today.
So, the purpose of this tutorial is to teach you the basics to create your own NFT Smart Contract in the easiest way possible and sell your collection on the biggest exiting NFT market.
Smart Contracts in WordPress
In this tutorial, we will show you how to create a standard ERC-721 smart contract using WordPress, without the need for coding or advanced Blockchain knowledge.
For this you will need:
- A metamask account (metamask.io)
- Get some coins in Ether or any other coin in side-chains
- A WordPress site
- Install the WPSmartContracts plugin
Mochi Smart Contract
Mochi is the Smart Contract flavor for NFT Standard Tokens in WPSmartContracts.
The Mochi Smart Contract has all the features of the ERC-721 specification, like:
- Ownership
- Transfer
- Approval
- Mint
- Burn
The WPSmartContracts plugin allows you to define, implement and interact with the smart contract, but also store the images or media and NFT item data like attributes, category, name, etc.
Media Formats
NFT Items can represent any desired media, like:
- Image: an image is a unique file like a piece of art, a picture, profile, etc. Formats are .png, .jpg or .gif
- Video: a recording, animation, short movie, etc. For videos you can choose multiple files, but all files should correspond to same asset with different format, i.e. .mp4 and .ogv. This is because some video formats are more suitable than others on different devices.
- Audio: a song, podcast, effects, etc. You can choose multiple files, but all files should correspond to same asset, i.e. .mp3 and .ogg.
- Documents: this is a unique file that correspond to a property, license, loan, debt or any other document you need.
Deploy the Mochi Smart Contract
In order to create (and sell) your NFT, you must first create an NFT Collection, this is a Container Smart Contract that will maintain, manage and allow you and your customer to interact with your NFT items on the blockchain.
- Ethereum: the giant of Smart Contracts, but unfortunately now gas fees in Ethereum are simple prohibitive. But fear not, there are other solutions, like
- Polygon network (Matic): Polygon is a layer two scaling solution for building Ethereum-compatible blockchains, which means you can have the advantages of Ethereum without absurd high gas fees.
- Binance Smart Chain (BSC): this is a side-blockchain built by the Binance Chain community and unlike Binance Chain, BSC is compatible with the Ethereum Virtual Machine (EVM).
- xDai chain: is an Ethereum-based sidechain that uses a Proof-of-Stake mechanism and their native coin is pegged to the dollar. Making transactions cost less volatile.
At the moment of writing OpenSea only supports Ethereum and Polygon
Once you have the network of your choice, you can go to your WordPress site and follow this steps to deploy your Smart Contract.
- Login into your WordPress install
- Login into Metamask in your desired Ethereum network
- Click “NFT Collection” — “Add new”
- Choose the flavor: ”Mochi”
- Fill in the following fields: title, description, featured image
- Fill in the smart contract definition: symbol and name (this is the symbol and name representing you smart contract, the whole collection)
- “Who can mint?”: this defines who can create items on your smart contract, in this case you are the only creator, so choose “Only contract owner” can mint.
Fees
There are two fees when you are deploying:
- The WPSmartContrcats fee. Which you can check here: https://wpsmartcontracts.com/pricing/
- The gas fee. Except for the Ethereum network, gas fees tend to be very low.
Please note that if you are using Metamask to calculate gas rates and you do not have sufficient funds in your account, the rates may be over-calculated. Make sure you have sufficient funds to get an accurate gas fee estimation.
Always test first
A piece of advise: first implement your smart contracts to test networks, this is totally free and you can get the full experience of interacting and managing your NFT smart contract. If you are satisfied with the results, and only then, implement your smart contracts on the main network.
There are many testnets supported by the plugin:
- Rinkeby
- Ropsten
- Kovan
- Göerli
- BSC testnet
- Mumbai
- xDai testnet
More information on test networks:
More information on Deploying a Mochi Smart Contract:
Time for creation
Now that you have your Smart Contract ready and set up, it’s time to have fun.
Get started creating your first NFT item.
There are two ways to create your NFT elements: on the back-end (wp-admin) or on the front-end.
That generally means that if you are the sole artist or creator of your collection then you can mint all of your items on the back-end of your site, but if you are allowing other users / artists to create pieces in your collection then they will use the front-end of the site.
For more information on security and back-end settings read our article about the Matcha Smart Contract, Mochi and Matcha share the same back-end settings:
For the sake of simplicity, let’s assume on this article that you are the sole creator in your collection.
- Go to the wp-admin site
- Click on “NFT” — “Add New NFT”
- Fill all the data of the form, including categories, tags, description
- Load the media of the NFT, this is the piece of the NFT itself. Can be an image, document, audio or video in any standard media format
- Fill the address of the recipient of the new token (the owner address)
- Choose the collection
- Click on “Mint”
- Confirm the transaction in Metamask.
Time to sell
Now that you have all these beautiful images on your Smart Contract, its time to sell.
Unlike Matcha and Suika, Mochi’s smart contract does not have the logic to create a marketplace, but fear not, we are going to tap into the most powerful market in the world to sell your items.
The great advantage to use Mochi smart contract is that is fully compliant with the ERC-721 standard, meaning that you can sell your items on any store available.
Doing that on OpenSea is really easy.
Just go to your smart contract and get:
- The address of the Mochi smart contract
- The token ID of your item
For example:
With this information (smart contract address and token ID), you can follow these steps:
Validate the asset on OpenSea endpoint:
If you are using a test net:
https://testnets-api.opensea.io/api/v1/asset/<your contract address>/<your token id>/validate
If you are using a mainnet:
https://api.opensea.io/api/v1/asset/<your contract address>/<your token id>/validate
This is an example on the Rinkeby test network. To validate your items on testnet, go to:
https://testnets-api.opensea.io/api/v1/asset/0x41b3A3A955b2399b35d8f55053Ba7E50647612eE/1/validate
If your site is working OK, you should see something like this:
If you are seeing any errors on your validation, please go to this forum thread:
Once you check that your asset is valid, continue with the next step
Go to your item store
Now that your item is validated, you can view your item on the OpenSea store, for this just go to the following link:
If you are using a test net:
https://testnets.opensea.io/assets/<your contract address>/<your token id>/
If you are using a mainnet:
https://opensea.io/assets/<your contract address>/<your token id>/
For example:
https://testnets.opensea.io/assets/0x41b3A3A955b2399b35d8f55053Ba7E50647612eE/1
Then you will see your item on the store:
See you on the next article and goo luck!
More information about OpenSea