4 Your First Smart Contract

 

This chapter covers:

  • Overview of a typical DLT system.
  • Explanation of the top abstraction layer of a DLT system: smart contracts
  • Hands on exercise to deploy your first smart contract using Solidity and Remix IDE

“The beginning is the most important part of the work”

— Plato

In the previous chapter, we have covered the prerequisites required to learn about permissioned blockchains. In this chapter, we will have our first encounter with them. To facilitate talking about these systems, we find it convenient to think of each component as belonging to one of four abstraction layers, as shown in Figure 4.1. In this chapter, we will first give a very brief overview of all the layers and then do a deeper dive at the top of the abstraction layers to talk about smart contracts. Then, in upcoming chapters, we will make our way down and inspect the low level bits of the DLT technology stack in greater depth

4.1   A Broad Overview of DLTs

Let’s look at the general system design of DLTs. The most succinct definition of DLTs we can give is that DLTs are permissioned blockchains with smart contract functionalities. Let’s disambiguate that sentence further by looking at the two key terms introduced there. Permissioned blockchains mean that unlike Bitcoin or Ethereum, not everyone is allowed to access the blockchain and interact with it. You need to be given permission to enter the ledger’s network.

Figure 4.1 The four broad layers of abstraction in a typical DLT system.

4.1.1   Current state of DLTs

4.2   A deeper look into smart contracts

4.2.1   Problem statement.

4.2.2   So how does it work?

4.2.3   DLT Transaction Flow

4.2.4   Is DLT just a modern database?

4.3   Exercise: add two numbers

4.3.1   Remix IDE

4.3.2   Your first smart contract

4.3.3   Simulating deployment

4.4   Summary