Hands-On Smart Contract Development with Solidity and Ethereum From Fundamentals to Deployment By Kevin Solorio, Randall Kanna, and David H. Hoover

Nikolai Pokryshkin
Moderator
που συμμετέχουν: 2022-07-22 09:48:36
2024-04-16 01:07:56

Hands-On Smart Contract Development with Solidity and Ethereum From Fundamentals to Deployment By Kevin Solorio

Chapter 1. Blockchain Concepts
(illustration of blockchain data structure)
Fundamentally, a blockchain is a data structure. It is a list, or chain, of unique
“blocks”. Each block is itself a list of transactions. On top of this relatively simple
list-of-lists data structure is laid the key innovation that blockchains have given us: a
protocol for how blocks are added to the chain without any central authority. The
cryptocurrencies that have come along with blockchains are not the true innovation,
they are a means to an end, providing incentives for people to run software that
secures the network. For the first time in history, we have the ability to share digital
information without trusting any person, government, organization, or corporation to
facilitate the interaction. Ethereum provides a cryptographically secure platform for
storing, updating, and removing data from a blockchain using what is referred to as
“smart contracts”. We are still in the early days of learning how to use smart contracts
to improve things in the real-world, and it’s hard to predict how the technology will
be used in the future. Similar to the “World Wide Web” in the 1990’s, there has been a
global influx of inspiring and creative problem-solvers who are working every day to
deploy decentralized applications (DApps) that they hope will “make a dent in the
universe”.
We will be spending most of this book focused on the programming language Solidity
and smart contract development. Solidity is a popular programming language for
developing smart contracts, and was designed to run on the Ethereum Virtual
Machine (EVM). Solidity wasn’t the first programming language to run on the EVM,
and it certainly isn’t the last. Many other languages, such as Vyper, will be written to
run on the EVM, attempting to improve on Solidity’s design, or provide powerful
domain-specific languages. Before we dig into the revolutionary world of smart
contracts, we need to lay a conceptual foundation for you to build on. Due to the
historically unique nature of running code on a blockchain, it’s critical for developers
to have a sufficient understanding of how the pieces fit together underneath the
wonderful abstractions that Ethereum provides.
A Brief History
The concept of a “blockchain” was born out of the Bitcoin white paper, published in
2008 by the pseudonymous Satoshi Nakamoto. Although the term “blockchain”
doesn’t actually appear in the paper, the concept was concisely articulated.
Transactions of value exchange enter a peer-to-peer network, and are periodically
grouped into “blocks”, or lists. When a “block” of transactions is persisted, it is

“chained” to the previous block. This append-only data structure and the protocol that
constructs it create an immutable record of transactions.
Bitcoin’s launch in early 2009 marked the beginning of public blockchain networks.
Since then, countless cryptocurrencies have attempted to build on Bitcoin’s success as
a new form of currency. Many early adopters of Bitcoin realized that the properties of
a blockchain had applications beyond financial transactions. Communities spawned to
try to extend, fork, and build on top of Bitcoin in order to stretch it in directions that
were not previously conceived. Ultimately, though, the Bitcoin protocol is purposely
constrained and ill-fitted for extension. Blockchain prodigy Vitalik Buterin made the
ambitious decision to stop trying to extend Bitcoin and instead create a more generalpurpose

protocol from scratch. In 2013, Vitalik wrote the Ethereum white paper.
When Ethereum launched in 2015, it quickly became one of the most valuable
cryptocurrencies on the planet, second only to Bitcoin. The markets valued Ethereum
because it provided a platform for deploying and running smart contracts on a public
blockchain. The term “smart contract” was coined by Nick Szabo in 1994. The idea
then was that many legal contracts, notaries, and other analog agreements could be
enforced nearly automatically using digital protocols and cryptographic signatures.
Despite this historical context, the implementation of smart contracts on Ethereum
actually feels more like general-purpose programming than anything specific to legal
contracts. The virtual machine as defined by the Ethereum protocol is Turingcomplete.

This means that as long as you can fit your computations within the
limitations of a single block, smart contract developers have few other constraints to
contend with beyond their own imagination.
The Character of a Blockchain
Many software developers will have worked with a technology stack that includes: 1)
a native mobile user interface and/or web user interface, 2) with a server-side
programming language that ultimately interacts with 3) a database. In the most basic
versions of these systems, the interactions with the database are essentially
instantaneous and permanent.
Like a more typical database, blockchains can store arbitrary data, but they share few
other similarities. Becoming a competent smart contract developer means
understanding the character of a blockchain. One cannot simply treat Solidity like a
server-side programming language, you will quickly find yourself lost and frustrated.
Unlike typical databases, interactions with even the most basic smart contract systems
are not instantaneous and are not guaranteed to be permanent.
Unlike a typical database which is a single program running on one computer, a
blockchain is typically made up of many nodes in a world-wide network. When we

Hands-On Smart Contract Development with Solidity and Ethereum From Fundamentals to Deployment By Kevin Solorio, Randall Kanna, and David H.
Hoover

image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov