Notes on NFT-Development Internship Program

Nita Ratnawaty
7 min readJun 10, 2022

A virtual internship program offered by P2MS-ITB Teaching Factory Network (TFN); currently available in Bahasa Indonesia only.

Disclaimer: It’s my personal notes on the topic about NFT from P2MS-ITB TFN. To take this program, first, you have to complete Desain dan Analisis Sistem (DAS) course. Check my notes on the DAS course at the end of this story.

On-progress notes.

Last update: 21 June 2022.

Photo by Pawel Czerwinski on Unsplash

Program Magang: Pengembangan NFT is one of virtual internship programs offered by P2MS-ITB TFN. I took the class that started on June 08, 2022 and will end on July 31, 2022. From the course outline, the program will have more coding-related exercise (on Replit). I guess the theory will be given in class (live session) every Wednesday afternoon via Zoom or via class chatroom on Slack.

Learning goals:

  1. Able to write a smart contract using blockchain technology.
  2. Able to use Replit & Supabase to write the codes for generating the smart contract.

Theory

Week 1

As an introduction we were given two videos to watch from Economics Design before the first class.

The speaker in the video explained about the difference between Crypto Economics and Token Economics (also known as Tokenomics).

👉 Crypto economics focuses on messages that will be sent in the entire platform to be validate and to reach a consensus.

👉 Tokenomics focuses on the coordination between people in the system.

👉 There are 3 elements in designing digital economies with tokenomics in the primary market:

🏢 Market design: the design of where all interactions take place (users, tokens).

⚙️ Mechanism design: the design of the rules that can be put to achieve a specific goal.

💸 Token design: the design of rules in giving incentives when people interact with each other inside the system.

👉 Each of these elements has sub-variables to consider based on human-interaction and coding aspects.

Coding Practice

All coding practice are given as Teams projects in Replit; using ReactJS templates.

Session 1 — Writing Smart Contract

08–10 June 2022

This project was about generating a smart contract. After opening the repl, we needed to install and run Hardhat on the Shell window as initialization. Hardhat is used to compile, test, and compile the smart contract.

The first step was to create a smart contract. The smart contract was written on a file named WavePortal.sol inside the contract folder. In this condition, the smart contract will return a text “Yo yo, I am a contract and I am smart” every time a user runs the program (waving). Each waving will be written into the blockchain, which means we need to pay some transaction fees.

A new script file called run.js was created inside the script folder. This file was used to run the smart contract. To run the codes inside the run.js file, execute a command through the Hardhat on the Shell. It resulted in information about the Solidity compilation and where the contract was deployed to.

We can also save some data inside the contract by modifying the codes inside WavePortal.sol and run.js files. When we execute run.js via Shell window, we will see that we have other additional information: total waves and the user who waved.

After successfully generating the contract, local deployment of the contract was done by using task node in Hardhat. If we succeed executing the task, we will get a list of 20 private keys. After that, we created a new script file named deploy.js inside the scripts folder for deployment. Then run the script via Hardhat as well on the Shell.

Next step was setting up the wallet. Here, we use Metamask. Check their link for detail installation on your computer. Since it was just for exercise, we used blockchain network for testing. In this project, we chose Rinkeby Test Network. A platform layer was needed to setup an application. So, we used Alchemy as our platform layer.

Afterward, we requested some amount of Ether (ETH) from Rinkeby Faucet. That Ether could only be used in the testnet. To get ETH, we wrote down our wallet address in the box, hit the Send Me ETH button , and then waited until the ETH to be sent to your wallet. While waiting the ETH, we updated the codes inside hardhat.config.js file.

NOTES: When I accessed the Rinkeby Faucet web, there was a notification like in the picture below. However, up to the last update of this story, the testnet was still accessible. Any change in the future is possible. 😄

Notification that Rinkeby Testnet will no longer be used

Then we created two additional files: .secret and .alchemyid in the same path with hardhat.config.js file. The .secret file is used to save our Metamask private key, while the .alchemyid file is used to save our app API key on Alchemy. Later, these files were inputted into .gitignore file. After all of these steps, the smart contract was deployed via Hardhat on the Rinkeby (testnet) network. We could see on the Shell window the WavePortal address of our deployed-smart contract.

Lastly, the status of the smart contract could be checked through Rinkeby Etherscan.

Steps summary:

  1. Sign up/in Replit — make a repl using JavaScript template.
  2. Set up Ethereum environment — install & run Hardhat.
  3. Create a smart contract — WavePortal.sol.
  4. Deploy the smart contract in local blockchain.
  5. Setup wallet ~ Metamask — install, then create an account or sign in.
  6. Choose blockchain network — Rinkeby Test Network.
  7. Set up platform layer — create an app in Alchemy.
  8. Request ETH — Rinkeby Faucet.
  9. Update hardhat.config.js file.
  10. Create files .secret and .alchemyid; then put them inside .gitignore file.
  11. Deploy the smart contract in the Rinkeby Testnet network.
  12. Check the smart contract deployment status via Rinkeby Etherscan.

Session 2 — Making Fungible Token

15–21 June 2022

This session was given as a different project from the Session 1. Although in general, it was quite similar to the previous session. The difference was that, in this project session, we were going to create a fungible token.

As initialization, we set up the Ethereum environment by installing Hardhat.

Then, we generated a smart contract token, which would be a fungible token, by creating a new file called TFNtoken.sol inside contracts folder. The codes inside TFNtoken.sol file was a modified version of an ERC20 token template from OpenZeppelin. The template is a standard/basic smart contract template that widely used. To generate the template, we can use Contract Wizards from OpenZeppelin.

After that, we tested the token by creating a file named test.js. The codes inside this file were to generate a smart contract token called TFN Token with code TFT. Before the testing, OpenZeppelin was installed in the environment. The testing was done to check whether the Solidity file could be compiled smoothly. We could see the notification on the shell window.

Since there were no errors, the deployment would be executed on the testnet. A file named deploy.js was created inside the scripts folder. Then, we modified the hardhat.config.js file. Similar to previous project, our Metamask private key was saved to the .secret file and the API key of the application was pasted to the .alchemy file. Later, these two files were put into the .gitignore file.

Finally, the deployment of the smart contract token by executing a Hardhat command.

We could check whether the token was successfully deployed on the testnet via Rinkeby Etherscan by pasting the token address on Rinkeby Testnet Explorer field.

Steps summary:

  1. Set up Ethereum environment — install & run Hardhat.
  2. Create a smart contract token using ERC20 token template — TFNtoken.sol.
  3. Test the smart contract token — test.js; token name: TFN Token; token code: TFT.
  4. Create a file for the smart contract token deployment — deploy.js.
  5. Update hardhat.config.js file.
  6. Create files .secret and .alchemyid; then put them inside .gitignore file.
  7. Deploy the smart contract in the Rinkeby Testnet network.
  8. Check the smart contract deployment status via Rinkeby Etherscan.

Session 3 —Making Digital Passport

22–24 June 2022

The third session was similar to the first and the second sessions. So, I will begin by writing the steps summary then some notes about the differences to the previous sessions.

Steps summary:

  1. Set up Ethereum environment — install & run Hardhat.
  2. Create a smart contract for the digital passport using ER721 token template — DigitalPassport.sol inside the contract folder.
  3. Create a new folder named libraries and put a file called Base64.sol into it.
  4. Test the passport contract — test.js inside test folder.
  5. Check the output (passport - JSON form).
  6. Set up testnet & request faucet — Mumbai Testnet.
  7. Create a new app in Alchemy.
  8. Create files .secret (~Metamask private key) and .alchemyid (the app’s Alchemy API key).
  9. Update hardhat.config.js file.
  10. Deploy the smart contract in the Polygon Testnet network.
  11. Check the smart contract deployment status via Mumbai Polygon.

Differences:

📔 Smart contract template

There are three standard templates explained in this session.

  1. ERC20 (session #2) → fungible tokens → e.g. (digital) currency.
  2. ERC721 (this session, #3) → NFTs → each token is unique → e.g. ID Card of a person.
  3. ERC1155 → NFTs → one contract for a set of tokens; each token has an ID → e.g. a collection of (digital) cards of an action figure (each card has its own number).

📔 Testing network

In previous sessions, Rinkeby Testnet was used. In this session, Polygon Mumbas was used.

📔 .secret and .alchemyid were not written inside the .gitignore file.

Session 4— Multisignatures

29–30 Juni 2022

Final Assignment

(available soon)

--

--