Advertisement

Solidity From Beginner to Give Up (1) - Variable Types

Because I registered for the PrivacyIN Privacy Institution course offered by LL Boss. The prerequisite for the course is familiarity with basic cryptography protocols or proficiency in programming languages such as Rust, Golang, Solidity, etc. So, I plan to learn some basic cryptography protocols and Solidity to be able to participate in the course. Although I feel my IQ isn't as good as it was when I was younger, I should still be able to rely on my limited programming foundation to get a certificate of attendance~

Today, I will first share the variable types in Solidity.

Solidity is an object-oriented high-level programming language mainly used for implementing Ethereum smart contracts. Contracts are like classes that allow contract inheritance to share a common interface, send signals to other contracts, and make your contract implement a set of specific functions, such as ERC20 tokens or ERC721 tokens (NFTs). Solidity is influenced by C++, Python, and JavaScript and is designed specifically for the Ethereum Virtual Machine (Ethereum Virtual Machine, EVM).

Solidity is a statically typed language, meaning each variable must be defined (or at least known) at compile time. Variable types include:

  • Value types

    • Boolean (bool)

    • Integer (int)

    • Address (address) 20-byte Ethereum address

    • Enumeration (enum)

    • Function (function)

    • Fixed-length byte array (bytes)


  • Reference type

    • Struct (struct)

    • Array (array)

    • String (string)

    • Mapping (mapping)

    • Variable-length byte array (bytes)


Writing Solidity does not require a server-side component; a browser-based IDE is sufficient.


In the next sharing session, we will manually issue an ERC721 smart contract to create an NFT.