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

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.

Make Indonesia World #1 Remote Worker Provider

Recommended from Medium

means of setting this config.

Business flows and State Machines — Part II

An Introduction To Kubernetes

How to debug an Effectively Deterministic Time Travel Debugger? (Seriously.. how?!)

From biotech to tech?

Innovating in the Enterprise at the Speed of a Startup

Automation while PMP Exam preparation

IT-системы для подготовки к PMP-экзамену.

How to optimize your live stream timing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Feri Lukmansyah

Feri Lukmansyah

Interesting with Blockchain and Opensource Project my journal: https://www.perykun.xyz/

More from Medium

Develop NFT marketplace on Ethereum

Mint an NFT using Solidity

Become an NFT Developer with Best Practice Way Part 4: Generate NFT Image

Solidity For Developers: Writing A Smart Contract

Logo of The Ethereum Blockchain