Note: This blog post is meant for beginners. If you have experience with web3 and blockchain, you might not find this as useful, but I encourage you to maybe stick around anyway.
After completing blockchain basics, it’s now time to get started with Solidity. In this series of blog posts, I will discuss the basics of Solidity. I personally used a very nice resource called CryptoZombie when I was learning Solidity, but it’s been a long while, so I had to relearn it. If you follow along with these posts, you will learn the basics of Solidity
What is Solidity?
Solidity is a high-level programming language used for writing smart contracts on the Ethereum blockchain. Solidity files have a “.sol” extension.
For this Blogpost we are going to use a very well known Remix IDE. Its is a powerful tool for writing and testing smart contracts. It’s web-based, making it easy to start without any installation. It has a file explorer similar to Visual Studio, where we can manage our files.

When we first open Remix, On the left side, we will see the file explorer, similar to Visual Studio. We will see some sample files. We can delete all of them to have a clean workspace.
Click on the “file” icon to create a new file and name it FirstContract.sol.

Then we have a compiler option on the left sidebar. Solidity needs to be compiled to bytecode that can run on the Ethereum Virtual Machine (EVM). Different versions of the compiler may have different features or bug fixes. From the compiler drop down we can select the compiler version.

In this course, we’ll use the latest version, 0.8.26. On the right side we can start coding our first smart contract.
pragma solidity 0.8.26;
This line specifies the version of Solidity compiler to be used. Here are some other version pragmas we might encounter:
– Any version from 0.8.26 and above, but not 0.9.0.
pragma solidity ^0.8.26;
– Any version from 0.8.22 to before 0.8.26.
<code>pragma solidity >=0.8.22 <0.8.26;
Write the following code and compile it on Remix IDE:
pragma solidity 0.8.26;
contract FirstContract {}
Select the compiler version we want to use and click on “Compile FirstContract.sol”. We will see a green checkmark if the compilation is successful. In this case we will see 1 warning which is related to license identifier which we can ignore for now.

Data Types in Solidity
There are a lot of data types in Solidity. You can read about them in detail here.
Value Types
In Solidity, value types are basic data types like integers, booleans, and addresses. When we assign or pass them to a function, they are copied instead of referenced. This means that changes to the copy do not affect the original variable. Still not got it? Let’s use an example:
pragma solidity ^0.8.0;
contract ValueTypeExample {
function addOne(uint x) public pure returns (uint) {
x = x + 1;
return x;
}
}
In the above example, if we call <strong>addOne</strong> function with a value of 5, it returns 6, but the original value (5) remains unchanged outside the function.
Variables in Solidity
Variables in Solidity store data values. There are different types of variables that solidity supports like:
Booleans
<strong>bool</strong>: The possible values are <strong>true</strong> and <strong>false</strong>.
Operators:
!(logical negation)&&(logical conjunction, “and”)||(logical disjunction, “or”)==(equality)!=(inequality)
In this example, myBool is a boolean variable, and setBool sets its value.
pragma solidity 0.8.26;
contract BooleanExample {
bool public myBool;
function setBool(bool _bool) public {
myBool = _bool;
}
}
Integers
<strong>int</strong> / <strong>uint</strong>: Signed and unsigned integers of various sizes. Keywords <strong>uint8</strong> to <strong>uint256</strong> in steps of 8 (unsigned of 8 up to 256 bits) and <strong>int8</strong> to <strong>int256</strong>. <strong>uint</strong> and <strong>int</strong> are aliases for <strong>uint256</strong> and <strong>int256</strong>, respectively.
Operators:
- Comparisons:
<=,<,==,!=,>=,>(evaluate tobool) - Bit operators:
&,|,^(bitwise exclusive or),~(bitwise negation) - Shift operators:
<<(left shift),>>(right shift) - Arithmetic operators:
+,-, unary-(only for signed integers),*,/,%(modulo),**(exponentiation)
In this example, myInt is a signed integer and myUint is an unsigned integer. The setInt and setUint functions set their values.
pragma solidity 0.8.26;
contract IntegerExample {
int public myInt;
uint public myUint;
function setInt(int _int) public {
myInt = _int;
}
function setUint(uint _uint) public {
myUint = _uint;
}
}
Address
The address type comes in two flavors:
– address: Holds a 20-byte value (size of an Ethereum address).
– address payable: Same as <strong>address</strong>, but with additional members transfer and send.
In this example, <strong>myAddress</strong> is a standard address and <strong>myPayableAddress</strong> is a payable address, capable of sending and receiving Ether.
pragma solidity 0.8.26;
contract AddressExample {
address public myAddress;
address payable public myPayableAddress;
function setAddress(address _address) public {
myAddress = _address;
}
function setPayableAddress(address payable _payableAddress) public {
myPayableAddress = _payableAddress;
}
}
String and Bytes
Strings and bytes are used for textual data.
In this example, <strong>myString</strong> is a string variable, and <strong>setString</strong> sets its value.
pragma solidity 0.8.26;
contract StringExample {
string public myString;
function setString(string memory _string) public {
myString = _string;
}
}
We’ve covered the basics of Solidity, from setting up our workspace in Remix IDE to writing and compiling our first smart contract. Understanding the basic data types and how to use them is important before we move on to auditing smart contracts.In the next blog post, we will explore functions in Solidity. Until then, WAGMI!