Remix IDE: Creating Interactive NFTs with IPFS and Remix IDE

Learn how to create an interactive NFT with IPFS and Remix IDE.

What is Remix IDE?

Remix Online IDE is a web browser-based Ethereum smart contract development and deployment tool.

Read below to learn how to create an interactive NFT with IPFS and Remix IDE.

Prerequisites:

1. Start by navigating to the Remix Online IDE.

Next to ‘Workspaces’, select the plus sign.

2. Choose the ‘Blank’ template, then give your workspace a name.

3. Then select ‘New File’ to create a new smart contract in your workspace.

4. Name the new file contract.sol and insert the following content:

5. Then, on your local computer create a new file called flip.js with the following content:

7. Select an IPFS bucket.

Select ‘Upload’, then select your flip.js file and an image file you’d like to use for your NFT.

8. Take note of the IPFS CID for each of these files.

9. On your local computer, create a new file called metadata.json.

In this file, insert the following content:

Replace the following values:

  • IMAGE_IPFS_CID: The IPFS CID for your NFT’s image.

  • JS_IPFS_CID: The IPFS CID for your flip.js file.

10. Then, upload this metadata.json file to your Filebase bucket.

Take note of the IPFS CID that is returned.

11. Back in the Remix Online IDE, select ‘Compile’ to compile the smart contract code.

This will create a variety of files in the workspace’s file explorer.

12. Then, select ‘Deploy and Run Transactions’ from the left sidebar menu.

13. Confirm that the following settings are correct, then select ‘Deploy’.

14. The contract’s address will then be listed under ‘Deployed Contracts’.

15. Expand the contract’s information.

Expand the ‘approve’ tab, then insert your cryptowallet address in the ‘to’ field and insert the IPFS CID of your metadata.json file in the ‘tokenId’ field. Then select ‘transact’.

16. Use the ‘Copy’ icon to copy the contract’s address. Save this value to be used later.

17. Next, on your local machine in the directory that contains your flip.jsand metadata.json files, create a new file called index.html. Insert the following content into this file:

Replace the CONTRACT_ADDRESS value with your smart contract’s address you copied previously.

18. In your local directory, run the following command to launch your interactive NFT:

python3 -m http.server

19. Then, navigate to https://localhost:8000 and your interactive NFT should look like this:

Last updated

Was this helpful?