Hello all, The chapter notes deals with all the below mentioned sub topics that helps in getting a great foundation of the Blockchain Technology known as “Ethereum”. If you find this article too long, trust me the chapter in the book is twice the size. Still, let me try to help you.
Just read the topics 1,5,6,7,8 and 9 and you will be ready for the next chapter which is “Ethereum Basics”.
Topics covered in this chapter :
- Components of Blockchain
- The Birth of Ethereum
- Ethereum’s Four Stages of Development
- Ethereum : A General Purpose Blockchain
- Ethereum’s Components
- Ethereum and Turing Completeness
- From General Purpose Blockchains to Decentralized Applications (DApps)
- The Third Age of the Internet
- Ethereum’s Development Culture
- Why Learn Ethereum?
- What This Book Will Teach You
Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart contracts. It uses a blockchain to synchronize and store the system’s state changes, along with a cryptocurrency called ether to meter and constrain execution resource costs.
The Ethereum platform enables developers to build powerful decentralized applications with built-in economic functions. While providing high availability, auditability, transparency, and neutrality, it also reduces or eliminates censorship and reduces certain counterparty risks.
Compared to Bitcoin : Ethereum’s purpose is not primarily to be a digital currency payment network.Unlike Bitcoin, which has a very limited scripting language, Ethereum is designed to be a general-purpose programmable blockchain that runs a virtual machine capable of executing code of arbitrary and unbounded complexity. Where Bitcoin’s Script language is, intentionally, constrained to simple true/false evaluation of spending conditions, Ethereum’s language is Turing complete, meaning that Ethereum can straightforwardly function as a general-purpose computer.
Ethereum is often described as “the world computer.”
Interesting thing to note here is the cryptocurrency used in ethereum is called ether or eth for short *not ethereum *(ethereum is the whole blockchain network).
Components of Blockchain
The components of an open, public blockchain are :
- A peer-to-peer (P2P) Network.
- A set of consensus rules.
- A state machine that processes transactions according to the consensus rules.
- A chain of cryptographically secured blocks that acts as a journal (ledger as to say).
- A consensus algorithm that decentralizes control over the blockchain.
- A Game — Some kind of incentive program like giving some eth to economically secure the state machine in an open environment. This is what essentially is called mining(e.g., proof-of-work costs plus block rewards).
- One or more open source software implementations of the above (“clients”).
Today, however, there are a huge variety of blockchains with different properties. We need qualifiers to help us understand the characteristics of the blockchain in question, such as open, public, global, decentralized, neutral, and censorship-resistant, to identify the important emergent characteristics of a “blockchain” system that these components allow.
When someone tells you that something is a blockchain, you have not received an answer; rather, you need to start asking a lot of questions to clarify what they mean when they use the word “blockchain.”
The Birth of Ethereum
All great innovations solve real problems, and Ethereum is no exception which was creating anything on the blockchain meant either building on top of Bitcoin or start a new blockchain. Building upon Bitcoin meant living within the intentional constraints of the network and trying to find workarounds that immediately negated many of the advantages of using a public blockchain.
Toward the end of 2013, Vitalik Buterin, a young programmer and Bitcoin enthusiast, started thinking about further extending the capabilities of Bitcoin and Mastercoin (an overlay protocol that extended Bitcoin to offer rudimentary smart contracts).
In December 2013, Vitalik started sharing a whitepaper that outlined the idea behind Ethereum: a Turing-complete, general-purpose blockchain. Both of the authors of this book received an early draft of the whitepaper and com‐ mented on it.
Andreas continued to follow Ethereum’s progress with great interest but was in the early stages of writing his book Mastering Bitcoin, and did not participate directly in Ethereum until much later. Dr. Gavin Wood, however, was one of the first people to reach out to Vitalik and offer to help with his C++ programming skills.
Starting in December 2013, Vitalik and Gavin refined and evolved the idea, together building the protocol layer that became Ethereum. The founders worked for years, building and refining the vision. And on July 30, 2015, the first Ethereum block was mined. The world’s computer started serving the world.
Ethereum’s Four Stages of Development
Ethereum’s development was planned over four distinct stages, with major changes occurring at each stage. A stage may include subreleases, known as “hard forks,” that change functionality in a way that is not backward compatible.
The four main development stages are codenamed Frontier, Homestead, Metropolis, and Serenity. The intermediate hard forks that have occurred (or are planned) to date are codenamed Ice Age, DAO, Tangerine Whistle, Spurious Dragon, Byzantium, and Constantinople.
Ethereum : A General Purpose Blockchain
The original blockchain, namely Bitcoin’s blockchain, tracks the state of units of bit‐ coin and their ownership. You can think of Bitcoin as a distributed consensus state machine, where transactions cause a global state transition, altering the ownership of coins.
Ethereum is also a distributed state machine. But instead of tracking only the state of currency ownership, Ethereum tracks the state transitions of a general-purpose data store, i.e., a store that can hold any data expressible as a key–value tuple for example, the value “Mastering Ethereum” referenced by the key “Book Title”. In some ways, this serves the same purpose as the data storage model of Random Access Memory (RAM) used by most general-purpose computers. Ethereum has memory that stores both code and data, and it uses the Ethereum blockchain to track how this memory changes over time.
Like a general purpose computer, ethereum can load code into its state machine and run that code, storing the resulting state changes in its blockchain.
Two of the critical differences from most general-purpose computers are that Ethereum state changes are governed by the rules of consensus and the state is distributed globally. Ethereum answers the question: “What if we could track any arbitrary state and program the state machine to create a world-wide computer operating under consensus?”
There are some similar components as we discussed in the above topic Blockchain’s component.
- P2P Network : This network is addressable on TCP Port 30303 and runs a protocol called ÐΞVp2p.
- Consensus Rules : Ethereum’s consensus rules are defined in the reference specification, the Yellow Paper.
- Transactions : Ethereum transactions are network messages that include (among other things) a sender, recipient, value, and data payload.
- State Machine : Ethereum state transitions are processed by the Ethereum Virtual Machine (EVM), a stack-based virtual machine that executes bytecode (machine-language instructions). EVM programs, called “smart contracts,” are written in high-level languages (e.g., Solidity) and compiled to bytecode for execution on the EVM.
- Data Structures : Ethereum’s state is stored locally on each node as a database (usually Google’s LevelDB), which contains the transactions and system state in a serialized hashed data structure called a Merkle Patricia Tree.
- Consensus Algorithm : Ethereum uses Bitcoin’s consensus model, Nakamoto Consensus, which uses sequential single-signature blocks, weighted in importance by PoW (Proof of Work) to determine the longest chain.
- Economic Security : Ethereum currently uses a PoW (Proof of Work) algorithm called Ethash, but this will eventually be dropped with the move to PoS (Proof of Stake) at some point in the future.
- Clients : Ethereum has several interoperable implementations of the client software, the most prominent of which are Go-Ethereum (Geth) and Parity.
Ethereum and Turing Completeness
Turing Complete : It is a mathematical model of a computer consisting of a state machine that manipulates symbols by reading and writing them on sequential memory. This was meant to answer questions about universal computability, meaning whether all problems are solvable.He proved that there are classes of problems that are uncomputable. Specifically, he proved that the halting problem (whether it is possible, given an arbitrary program and its input, to determine whether the program will eventually stop running) is not solvable.
Alan Turing further defined a system to be Turing complete if it can be used to simulate any Turing machine. Such a system is called a Universal Turing machine (UTM).
Ethereum’s ability to execute a stored program, in a state machine called the Ethereum Virtual Machine, while reading and writing data to memory makes it a Turing-complete system and therefore a UTM.
Turing Completeness as a “Feature”
However, Turing completeness is very dangerous, particularly in open access systems like public blockchains, because of the halting problem.The fact that Ethereum is Turing complete means that any program of any complexity can be computed by Ethereum. But that flexibility brings some thorny security and resource management problems.
Implications of Turing Completeness
In simple terms, we cannot predict the path of a program without running it. Turing-complete systems can run in “infinite loops,” a term used (in oversimplification) to describe a program that does not terminate.
Ethereum can’t predict if a smart contract will terminate, or how long it will run, without actually running it (possibly running forever). Whether by accident or on purpose, a smart contract can be created such that it runs forever when a node attempts to validate it. This is effectively a DoS attack.And of course, between a program that takes a millisecond to validate and one that runs forever are an infinite range of nasty, resource-hogging, memory-bloating, CPU-overheating programs that simply waste resources.
To answer this challenge, Ethereum introduces a metering mechanism called gas. As the EVM executes a smart contract, it carefully accounts for every instruction (computation, data access, etc.). Each instruction has a predetermined cost in units of gas.
When a transaction triggers the execution of a smart contract, it must include an amount of gas that sets the upper limit of what can be consumed running the smart contract. The EVM will terminate execution if the amount of gas consumed by com‐ putation exceeds the gas available in the transaction.
You won’t find gas on any exchanges. It can only be purchased as part of a transaction, and can only be bought with ether.
From General Purpose Blockchains to Decentralized Applications (DApps)
Ethereum’s vision expanded to become a platform for programming DApps. DApps represent a broader perspective than smart contracts. A DApp is, at the very least,
a smart contract and a web user interface.
In addition, many DApps include other decentralized components, such as:
- A decentralized (P2P) storage protocol and platform
- A decentralized (P2P) messaging protocol and platform
The Third Age of the Internet
In 2004 the term “Web 2.0” came to prominence, describing an evolution of the web toward user-generated content, responsive interfaces, and interactivity.
The concept of DApps is meant to take the World Wide Web to its next natural evolutionary stage, introducing decentralization with peer-to-peer protocols into every aspect of a web application. The term used to describe this evolution is web3, meaning the third “version” of the web.
Ethereum’s Development Culture
In Ethereum, by comparison, the community’s development culture is focused on the future rather than the past. The (not entirely serious) mantra is “move fast and break things.” If a change is needed, it is implemented, even if that means invalidating prior assumptions, breaking compatibility, or forcing clients to update. Ethereum’s develop‐ ment culture is characterized by rapid innovation, rapid evolution, and a willingness to deploy forward-looking improvements, even if this is at the expense of some backward compatibility
One of the big challenges facing developers in Ethereum is the inherent contradiction between deploying code to an immutable system and a development platform that is still evolving. You can’t simply “upgrade” your smart contracts. You must be prepared to deploy new ones, migrate users, apps, and funds, and start over.
But, on the positive side, Ethereum is moving forward very fast. There’s little opportunity for “bike-shedding,” an expression that means holding up development by arguing over minor details such as how to build the bicycle shed at the back of a nuclear power station. If you start bike-shedding, you might suddenly discover that while you were distracted the rest of the development team changed the plan and ditched bicycles in favor of autonomous hovercraft.
Why Learn Ethereum?
Blockchains have a very steep learning curve, as they combine multiple disciplines into one domain: programming, information security, cryptography, economics, dis‐ tributed systems, peer-to-peer networks, etc. Ethereum makes this learning curve a lot less steep, so you can get started quickly.
Ethereum is a developer’s blockchain, built by developers for developers.It’s easy to write code, but it’s very hard to write good and secure code.
What This Book Will Teach You
This book dives into Ethereum and examines every component. You will start with a simple transaction, dissect how it works, build a simple contract, make it better, and follow its journey through the Ethereum system.a You will learn not only how to use Ethereum — how it works — but also why it is designed the way it is. You will be able to understand how each of the pieces works, and how they fit together and why.
Further Reading links from the chapter:
- Vitalik Buterin’s article “A Prehistory of Ethereum” was published in September 2017 and provides a fascinating first-person view of Ethereum’s earliest moments. You can read it at https://vitalik.ca/general/2017/09/14/prehistory.html
- The Ethereum Yellow Paper: https://ethereum.github.io/yellowpaper/paper.pdf
- The Beige Paper, a rewrite of the Yellow Paper for a broader audience in less formal language: https://github.com/chronaeon/beigepaper
- ÐΞVp2p network protocol: http://bit.ly/2quAlTE
- Ethereum Virtual Machine list of resources: http://bit.ly/2PmtjiS
- LevelDB database (used most often to store the local copy of the blockchain): http://leveldb.org
- Merkle Patricia trees: https://github.com/ethereum/wiki/wiki/Patricia-Tree
- Ethash PoW algorithm: https://github.com/ethereum/wiki/wiki/Ethash
- Casper PoS v1 Implementation Guide: http://bit.ly/2DyPr3l
- Go-Ethereum (Geth) client: https://geth.ethereum.org/
- Parity Ethereum client: https://parity.io/