Become an NFT Developer with Best Practice Way: Part 3: Smart Contract with Solidity

Feri Lukmansyah
Remote Worker Indonesia
3 min readNov 11, 2021
image from Unsplash

in this part, I will discuss how to create a smart contract using solidity, so in this chapter, I will create a smart contract using solidity by case study, here table of content

  • The Fundamental
  • Create Smart contract

The Fundamental

According to its documentation, “Solidity is a curly-bracket language. It is influenced by C++, Python, and JavaScript, and is designed to target the Ethereum Virtual Machine (EVM).”

Environment Setup

let’s set up the environment for blockchain development using solidity, first install nodejs, and check the version

nodejs --version

after success, install node install the solidity compiler using npm

npm -g install solc

Create Contract

Solidity’s code is encapsulated in contracts. A contract is the fundamental building block of Ethereum applications — all variables and functions belong to a contract, and this will be the starting point of all your projects.

Solidity Keyword

the solidity keyword is available on docs, or you can see it here

solidity keyword

Importing a file in Solidity is similar to JavaScript, to import a file you can simply write

All global symbols from the “file” are imported into the current global scope by the above statement. But if you want to create a new global symbol someName with all the global symbols from “file” as members, you can write

Just like other programming languages, Solidity support both single-line and multi-line comments.

  • Start the line with // to include a single-line comment.
  • Start with /* and end with */ to include a multi-line comment.

Variable in Solidity

In solidity, the variable is divided into 2 parts

  • Local variable: variables with values that will persist till the function is completed
  • State variable: permanent variable that has been defined in the contract
state variable
local variable

Solidity Operator

solidity support the following type operator

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment operators
  • Conditional Operators
arithmetic operator
relational operator
logical operator

Conclusion

the fundamental of solidity is the most important step if you need for mastering blockchain.

--

--