Become an NFT Developer with Best Practice Way: Part 3: Smart Contract with Solidity
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
let’s set up the environment for blockchain development using solidity, first install nodejs, and check the version
after success, install node install the solidity compiler using npm
npm -g install solc
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.
the solidity keyword is available on docs, or you can see it here
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
solidity support the following type operator
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment operators
- Conditional Operators
the fundamental of solidity is the most important step if you need for mastering blockchain.