Step 1: Get Started
In this first article in the series, we’ll start with the basics of what Solidity is, what smart contracts are, how they work, how they are implemented, and then dig right into some cool Solidity examples and details.
Of course, the first question poses itself: What is Solidity?
As you could have imagined, Solidity has something to do with smart contracts.
Solidity is the very programming language we’ll be using for implementing smart contracts!
How exciting, isn’t it?
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 2: Create Your Own Token
After diving into some of the basic elements of Solidity concerning smart contracts, we’ll be going even further with the examples and explanations, helping us understand why, when, and how are specific elements of Solidity used in a certain way.
In this example, we’ll take a look at a bit more complex example of a smart contract (see docs), which showcases a very basic form of cryptocurrency.
The contract provides its creator with the functionality of creating new crypto coins (some may call them “shitcoins” ;)).
This example of a smart contract is implemented in a way that enables any party to send coins (message sender) to any other party (message receiver) without being registered with a username and password. The only factor that identifies a user is an Ethereum keypair.
Let’s dive into the contract!
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 3: Blockchain Basics in Solidity
Blockchain technology enables us to write programs without having to think about the details of the underlying communication infrastructure.
One of the main roles of a blockchain is to preserve the data and make it temper-resistant. In that sense, we can easily consider a blockchain as a globally shared, transactional database.
- A blockchain network is globally shared because any party in the network can access and read its contents.
- It is transactional because any change to the blockchain has to be accepted by almost all, or at least the majority of other members, depending on the blockchain implementation.
This way, the blockchain behaves in a consistent, transactional manner and warrants that the transaction will be done entirely or not at all.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 4: Master the Ethereum Virtual Machine (EVM) for Solidity Smart Contracts
The Ethereum Virtual Machine, or as we will usually call it by its pet name, EVM, represents a runtime environment for Ethereum smart contracts.
For those of us who may be unfamiliar with the term, a runtime environment represents a computer infrastructure that enables a computer program execution. It usually consists of a software section (instruction set and software libraries) and a hardware section (working memory, storage, and a network).
An application runtime environment can have several flavors.
The most basic one is a bare-metal runtime environment, providing complete, unrestricted access to the underlying hardware and software resources of a physical host. This type of runtime environment is very rarely in use.
More complex and manageable runtime environments use an abstraction of physical host software and hardware resources and restrict an application from accessing the resources directly.
When physical host resources are managed and accessed in such a way, we consider them to be virtualized environments. From a resource accessibility, i.e. security perspective, virtualization can provide a sandboxed or isolated runtime environment. The difference lies in what an application can do when it runs.
A sandboxed application can access virtualized resources, such as network, filesystem, or other running applications’ processes. An isolated application is completely restricted from accessing anything other than its own process instance, and with possible exceptions, some other subset of running processes.
In that sense, an EVM runtime is an isolated one, enabling only limited access to other smart contracts.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 5: EVM Memory and Instruction Set
So far, we have been discussing the EVM from a higher point of view, focusing on general terms, and also touching on both Bitcoin and Ethereum working principles.
We will continue with EVM architecture specifics, starting with EVM’s three data areas:
- storage,
- memory, and
- the stack.
Of course, there will be much more talk about the memory and the instruction set in the future, but our current goal is to build ourselves an outline of the concept sprinkled with enough details to support our journey.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 6: EVM Message Calls
In this article, we’ll hold the depth from the last article regarding the Ethereum Virtual Machine through topics such as message calls and special variants of calls, logs, callcode
/delegatecall
, libraries, logs, special operations for smart contract code creation/removal, and finally, precompiled contracts.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 7: Install the Solidity Compiler
If you want to install the Solidity compiler with npm, check out this tutorial:
If you want to install the Solidity compiler with Docker on Ubuntu, check out this tutorial instead:
If you want to install the Solidity compiler from the source code, check out this tutorial instead:
Command line compilers are the best choice when we’re working on projects involving large contracts or when we need more compilation options besides those available in e.g. Remix.
In the following article, we have started a multi-article topic on using and installing the Solidity compiler. There are several approaches, of which we have investigated the one of installing the Solidity compiler via npm, a Node.js packet manager, solc-js
.
- First, we looked at what semantic versioning is, both from a general point of view and the point of view concerning Solidity. There is much more information on versioning available in other literature and online sources, but with our main topic in mind, there was no need to go any further at this point.
- Second, we shortly revisited the topic of Remix: what it is, how it is used, and in what forms it is available for use.
- Third, we dedicated a significant portion of our attention to the installation of Solidity compiler
solc-js
via npm, a Node.js packet manager. Besides the main thought, we’ve also examined a possible problem with inadequate i.e. old version of Node.js and made a series of steps to rectify the problem and bring our system to an up-to-date state.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 8: Understanding the Solidity Voting Smart Contract
With this article, we are starting a journey of going through smart contract examples in Solidity.
- We’ll first lay out the entire smart contract example without the comments for readability purposes.
- Then we’ll dissect it part by part, analyze it and explain it.
- Following this path, we’ll get a hands-on experience with smart contracts, as well as good practices in coding, understanding, and debugging smart contracts.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 9: Understanding the Solidity Simple Open Auction Smart Contract
This article continues on the series we started the last time: Solidity smart contract examples, which implement a simplified real-world process.
Here, we’re walking through an example of a simple open auction.
- We’ll first lay out the entire smart contract example without the comments for readability and development purposes.
- Then we’ll dissect it part by part, analyze it and explain it.
- Following this path, we’ll get a hands-on experience with smart contracts, as well as good practices in coding, understanding, and debugging smart contracts.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.
Step 10: Understanding the Solidity Blind Auction Smart Contract
This article continues on the Solidity Smart Contract Examples series, which implements a somewhat more complex process of a blind auction.
Here, we’re walking through an example of a blind auction (original source).
- We’ll first lay out the entire smart contract example without the comments for readability and development purposes.
- Then we’ll dissect it part by part, analyze it and explain it.
- Following this path, we’ll get a hands-on experience with smart contracts, as well as good practices in coding, understanding, and debugging smart contracts.
🌍 Learn More: Read the full tutorial on the Finxter blog before moving on.