Skip to main content

How to create an NFT smart contract in 5 minutes

Let's go through a simple example and create a workflow to sell digital content aka NFT's. Heres the full walkthrough:

Prerequisites

Before we start it is required acquire the neccessary access.

Create account in Toolblox

In order to create and deploy smart contracts you need to create an account and log-into Toolblox.

Install Metamask

To deploy a new smart contract for everyone to use and to use it, you need a wallet. In Tooblox you have 2 options:

For our test case, please install the Metamask add-on.

Get some Polygon test-coins

In order to deploy and use smart contracts you need to pay for 'gas' - these are the rules of blockchain. For testing purpose each blockchain has a test version called testnet - it looks and behaves like the real one, except the currency which moves on it is fake test money.

In order to test our smart contract you would need to use a faucet to get a little bit of the fake test money. It is basically a free service which just sends fake test money to an account you desire.

For our test case, please use the Polygon's faucet which can be found here: https://faucet.polygon.technology/.

Step 1. Create a smart contract with AI

Use Toolblox plugin in ChatGPT plugin marketplace or integrated AI generation to create a smart contract.

Option 1. Toolblox plugin for ChatGPT

Option2. Toolblox integrated AI helper

Step 2. Build and enhance with no-code

While AI generation is perfect to get up and going it is not perfect - its is up to the author to verify all states, transitions and properties are valid.

In this case the following updates where decided to be needed

  • Add Name and Description as parameters to the Publish transition
  • Set Symbol ("DIP") to the workflow - this is needed for NFTs.
  • Set owners to diploma states. Also required if the item is an NFT.
  • Set compatibility to ERC721 (NFT)

Step 3. Deploy to blockchain

Deployment is very straightforward. Just select your desired blockchain (in this case Polygon) and hit Deploy.

Troubleshooting

In case of issues review the workflow Spec (click 'View spec' in deploy step) and double check it looks like the following:

University diploma workflow 0cd25dbb : Diploma : DIP : ERC721;

Id : integer(),
Status : integer(),
Name : string(),
Image : image(),
Student : address(),
University : address(),
Description : string(),;

0:Published:University,
1:Transferred:Student;

'' => 'Published' : Publish (Image,Name,Description) + ASSERT_ACCESS(restricted=University);
'Published' => 'Transferred' : Transfer (Student) + ASSERT_ACCESS(restricted=University);

Especially review the following:

  • 'Owner' attributes have 'User' type
  • Access restrictions have 'University' as rights
  • Users are of type address()

In case of unresolved issue please contact support, we are more than happy to help!

Congratulations!

Thats it, your first smart contract is now running on blockchain. To test it our Toolblox generates a simple user interface. Click Run to give it a test run.

Since the contract was made ERC721 (NFT) compatible the diplomas can be verified in popular NFT marketplaces such as OpenSea (testnet). Here is the diploma from the demo.