Reader small image

You're reading from  Mastering Blockchain.. - Third Edition

Product typeBook
Published inAug 2020
Reading LevelBeginner
PublisherPackt
ISBN-139781839213199
Edition3rd Edition
Languages
Right arrow
Author (1)
Imran Bashir
Imran Bashir
author image
Imran Bashir

Imran Bashir has an M.Sc. in Information Security from Royal Holloway, University of London, and has a background in software development, solution architecture, infrastructure management, and IT service management. He is also a member of the Institute of Electrical and Electronics Engineers (IEEE) and the British Computer Society (BCS). Imran has extensive experience in both the public and financial sectors, having worked on large-scale IT projects in the public sector before moving to the financial services industry. Since then, he has worked in various technical roles for different financial companies in Europe's financial capital, London.
Read more about Imran Bashir

Right arrow

Further Ethereum

This chapter is a continuation of the previous chapter, in which we will examine more Ethereum-based concepts in more detail.

We will cover both a practical and theoretical in-depth introduction to wallet software, mining, and setting up Ethereum nodes. Material relating to various challenges, such as security and scalability faced by Ethereum, will also be introduced. Moreover, prominent advanced supporting protocols, such as Swarm and Whisper, will also be introduced later in the chapter. Finally, Ethereum has several programming languages built in to support smart contract development. We will conclude with an overview of these programming languages.

This chapter continues the discussion of the Ethereum blockchain network elements that we started in the previous chapter, Chapter 11, Ethereum 101. These elements include:

  • Blocks and blockchain
  • Wallets and client software
  • Nodes and miners
  • APIs and tools
  • Supporting protocols...

Blocks and blockchain

Blocks are the main building structure of a blockchain. Ethereum blocks consist of various elements, which are described as follows:

  • The block header
  • The transactions list
  • The list of headers of ommers or uncles

An uncle block is a block that is the child of a parent but does not have any child block. Ommers or uncles are valid, but stale, blocks that are not part of the main chain but contribute to security of the chain. They also earn a reward for their participation but do not become part of the canonical truth.

The transaction list is simply a list of all transactions included in the block. Also, the list of headers of uncles is also included in the block.

Block header: Block headers are the most critical and detailed components of an Ethereum block. The header contains various elements, which are described in detail here:

  • Parent hash: This is the Keccak 256-bit hash of the parent (previous) block...

Wallets and client software

As Ethereum is under heavy development and evolution, there are many components, clients, and tools that have been developed and introduced over the last few years.

Wallets

A wallet is a generic program that can store private keys and, based on the addresses stored within it, it can compute the existing balance of ether associated with the addresses by querying the blockchain. It can also be used to deploy smart contracts. In this chapter, we will introduce the MetaMask wallet, which has become the tool of choice for developers.

Having discussed the role of wallets within Ethereum, let's now discuss a number of common clients. The following is a non-exhaustive list of the client software and wallets that are available with Ethereum.

Geth

This is the official Go implementation of the Ethereum client.

The latest version is available at the following link: https://geth.ethereum.org/downloads/.

Eth

This is the...

Nodes and miners

The Ethereum network contains different nodes. Some nodes act only as wallets, some are light clients, and a few are full clients running the full blockchain. One of the most important types of nodes are mining nodes. We will see what constitutes mining in this section.

Mining is the process by which new blocks are selected via a consensus mechanism and added to the blockchain.

As a result of the mining operation, currency (ether) is awarded to the nodes that perform mining operations. These mining nodes are known as miners. Miners are paid in ether as an incentive for them to validate and verify blocks made up of transactions. The mining process helps secure the network by verifying computations.

At a theoretical level, a miner node performs the following functions:

  • It listens for the transactions broadcasted on the Ethereum network and determines the transactions to be processed.
  • It determines stale ommer blocks and includes...

APIs, tools, and DApps

The Web3 JavaScript API provides an interface to the Ethereum blockchain via JavaScript. It provides an object called web3, which contains other objects that expose different methods to support interaction with the blockchain. This API covers methods related to administration of the blockchain, debugging, account-related operations, supporting protocol methods for Whisper, as well as storage and other network-related operations.

This API will be discussed in detail in the next chapter, Chapter 13, Ethereum Development Environment, where we will see how to interact with the Ethereum blockchain with it.

Applications (DApps and DAOs) developed on Ethereum

There are various implementations of DAOs and smart contracts in Ethereum, most notably, the DAO, which was recently misused due to a weakness in the code and required a hard fork for funds to be recovered that had been syphoned out by the attackers. The DAO was created to serve as a decentralized...

Supporting protocols

Various supporting protocols are available to assist the complete decentralized ecosystem. This includes the Whisper and Swarm protocols. In addition to the contracts layer, which is the core blockchain layer, there are additional layers that need to be decentralized in order to achieve a complete decentralized ecosystem. This includes decentralized storage and decentralized messaging.

Whisper, which is being developed for Ethereum, is a decentralized messaging protocol, whereas Swarm is a decentralized storage protocol. Both of these technologies provide the basis for a fully decentralized web, and are described in the following sections.

Whisper

Whisper provides decentralized peer-to-peer messaging capabilities to the Ethereum network. In essence, Whisper is a communication protocol that DApps use to communicate with each other. The data and routing of messages are encrypted within Whisper communications. Whisper makes use of the DEVp2p wire protocol...

Programming languages

Code for smart contracts in Ethereum is written in high-level languages such as Serpent, Low-level Lisp-like Language (LLL), Solidity, or Vyper, and is converted into the bytecode that the EVM understands for it to be executed.

Solidity is one of the high-level languages that has been developed for Ethereum. It uses JavaScript-like syntax to write code for smart contracts. Once the code is written, it is compiled into bytecode that's understandable by the EVM using the Solidity compiler called solc.

Official Solidity documentation is available at http://solidity.readthedocs.io/en/latest/.

LLL is another language that is used to write smart contract code.

Serpent is a Python-like, high-level language that can be used to write smart contracts for Ethereum.

Vyper is a newer language that has been developed from scratch to achieve a secure, simple, and auditable language.

More information regarding Vyper is available...

Summary

This chapter started with some general concepts, including blocks, block structure, gas, and messages, which were introduced and discussed in detail. The later sections of the chapter introduced the practical installation and management of Ethereum wallets and clients. The two most commonly-used clients, Geth and OpenEthereum, were discussed. We also explored an introduction of programming languages for programming smart contracts in Ethereum.

Supporting protocols and topics related to challenges faced by Ethereum were also presented. Ethereum is under continuous development, and new improvements are being made by a dedicated community of developers on a regular basis. Ethereum improvement proposals, available at https://github.com/ethereum/EIPs, are also an indication of the magnitude of research and the keen interest exhibited by the community in this technology.

In the next chapter, we will explore Ethereum smart contract development, along with the relevant tools...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Blockchain.. - Third Edition
Published in: Aug 2020Publisher: PacktISBN-13: 9781839213199
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.
undefined
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 $15.99/month. Cancel anytime

Author (1)

author image
Imran Bashir

Imran Bashir has an M.Sc. in Information Security from Royal Holloway, University of London, and has a background in software development, solution architecture, infrastructure management, and IT service management. He is also a member of the Institute of Electrical and Electronics Engineers (IEEE) and the British Computer Society (BCS). Imran has extensive experience in both the public and financial sectors, having worked on large-scale IT projects in the public sector before moving to the financial services industry. Since then, he has worked in various technical roles for different financial companies in Europe's financial capital, London.
Read more about Imran Bashir