Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Solidity Programming Essentials

You're reading from   Solidity Programming Essentials A guide to building smart contracts and tokens using the widely used Solidity language

Arrow left icon
Product type Paperback
Published in Jun 2022
Publisher Packt
ISBN-13 9781803231181
Length 412 pages
Edition 2nd Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Ritesh Modi Ritesh Modi
Author Profile Icon Ritesh Modi
Ritesh Modi
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: The Fundamentals of Solidity and Ethereum
2. Chapter 1: An Introduction to Blockchain, Ethereum, and Smart Contracts FREE CHAPTER 3. Chapter 2: Installing Ethereum and Solidity 4. Chapter 3: Introducing Solidity 5. Chapter 4: Global Variables and Functions 6. Chapter 5: Expressions and Control Structures 7. Part 2: Writing Robust Smart Contracts
8. Chapter 6: Writing Smart Contracts 9. Chapter 7: Solidity Functions, Modifiers, and Fallbacks 10. Chapter 8: Exceptions, Events, and Logging 11. Chapter 9: Basics of Truffle and Unit Testing 12. Chapter 10: Debugging Contracts 13. Part 3: Advanced Smart Contracts
14. Chapter 11: Assembly Programming 15. Chapter 12: Upgradable Smart Contracts 16. Chapter 13: Writing Secure Contracts 17. Chapter 14: Writing Token Contracts 18. Chapter 15: Solidity Design Patterns 19. Assessments 20. Other Books You May Enjoy

What is a blockchain?

A blockchain is essentially a decentralized, distributed database or ledger, as follows:

  • Decentralization: In simple terms, this means that the application or service continues to be available and usable even if a server or a group of servers on a network crashes or is not available. The service or application is deployed on a network in a way that no server has absolute control over data and execution; rather, each server has a current copy of data and execution logic.
  • Distributed: This means that any server or node on a network is connected to every other node on the network. Rather than having one-to-one or one-to-many connectivity between servers, servers have many-to-many connections with other servers.
  • Database: This refers to the location for storing durable data that can be accessed at any point in time. A database allows the storage and retrieval of data as functionality and also provides management functionalities to manage data efficiently, such as exporting, importing, backup, and restoration.
  • Ledger: This is an accounting term. Think of it as specialized storage and retrieval of data. Think of ledgers that are available to banks – for example, when a transaction is executed with a bank. Let's say that Tom deposits USD 100 in his account; the bank enters this information in a ledger as credit. At some point in the future, Tom withdraws USD 25. The bank does not modify the existing entry and stored data from 100 to 75. Instead, it adds another entry in the same ledger as a debit of USD 25. This is because a ledger is a specialized database that does not allow modification of existing data. It allows you to create and append a new transaction to modify the current balance in the ledger. The blockchain is a database that has the same characteristics as a ledger. It allows newer transactions to be stored in an append-only pattern without any scope to modify past transactions. It is important here to understand that existing data can be modified by using a new transaction, but past transactions cannot be modified. A balance of USD 100 can be modified at any time by executing a new debit or credit transaction, but previous transactions cannot be modified. Take a look at the following diagram for a better understanding:
Figure 1.1 – A blockchain is essentially a chain of blocks

Figure 1.1 – A blockchain is essentially a chain of blocks

Blockchain means a chain of blocks – that is, having multiple blocks chained together, with each block storing transactions in such a way that it is not possible to change these transactions. We will discuss this in later sections when we talk about the storage of transactions and how immutability is achieved in a blockchain.

Because they are decentralized and distributed, blockchain solutions are stable, robust, durable, and highly available. There is no single point of failure. No single node or server is the owner of the data and solution, and everyone participates as a stakeholder.

Not being able to change and modify past transactions makes blockchain solutions highly trustworthy, transparent, and incorruptible.

You have been reading a chapter from
Solidity Programming Essentials - Second Edition
Published in: Jun 2022
Publisher: Packt
ISBN-13: 9781803231181
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image