Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Ethereum from the Ground Up – Blockchain and Mining

Welcome to our series Ethereum from the Ground Up.  Throughout the course of this series, our desire is to explore the underpinnings of the 2nd largest cryptocurrency on the market. 

Ethereum learned a few important lessons from Bitcoin and was the first revolutionary cryptocurrency to feature a Turing-complete Blockchain.  We’ll get into more of the application-level details in later weeks. But for now we first need to establish a solid foundation in the basic elements of Ethereum.  After discussing the atomic elements, we will be able to build our understanding and fully appreciate the system as a whole, including the facets Ethereum users encounter on a daily basis.

            Last week, we took the time to focus on two important facets dealing with how elements interact in Ethereum.  We began with state transition functions, which deal with how both world and account states change as a result of transactions taking place.  We also looked at code execution related to smart contracts.  This EVM code is similar in many ways to a standard machine language and allows extensible instructions to be written and executed on the blockchain.

Ethereum Core Elements

            To finish up with the core elements of Ethereum, it’s time to discuss the blockchain and how mining works.  Let’s start with the blockchain itself.  Note that Ethereum has been planning for a couple of years to release ETH 2.0. ETH 2.0 is the second generation of their blockchain which incorporates a proof-of-stake (PoS) algorithm instead of one related to proof-of-work (PoW).  The deadline has been pushed back but is planned for release in July 2020.  As of now, this doesn’t mean that ETH 1.x will be dead anytime soon – and who knows, there may be a fork and another Ethereum-based token will enter the network.  We’ll discuss ETH 2.0 closer to the end of this series, but for now just keep its eventual launch on your radar.

What is Blockchain

            Alright, back to the blockchain.  For those who may not be familiar with this concept, a blockchain is basically just what its name implies – a chain of blocks.  Generally speaking, a block is a collection of data that is chained together in some fashion to the block both before and after itself (usually through the use of cryptographic signatures).  This chaining is a critical part of ensuring the reliability of the blockchain – if a malicious actor could insert itself and modify a random block in the middle of a large chain, there would be no way to validate all data transfers that have occurred up to the present block.  These structures are rarely relied upon for data secrecy but are more often trusted for data authenticity and integrity.

            The Ethereum blockchain mimics that of Bitcoin in some regards but provides several key improvements that greatly enhance both ease of use and efficiency.  As a matter of fact, if Bitcoin were able to employ the methods that Ethereum uses, a node could realize between a 5x – 20x savings in storage space.  Why?  Ethereum doesn’t require a node to store the entire blockchain history.

            But how can you validate a transaction if you can’t validate that everything that preceded the transaction was correct?  Herein lies the genius of Ethereum:  the blockchain itself isn’t used exclusively as the means by which the correctness of previous transactions is proven.  Ethereum uses a separate structure (a modified Merkle Patricia tree) that maintains the world state at any point in Ethereum’s existence.  When Ethereum stores a block on the blockchain, more than just a list of transactions is stored within the block.  The block number, the difficulty, and the most recent state (from the aforementioned tree) are included within the block itself. 

Modified Merkle Patricia Tree

            It seems like this would be really inefficient…the entire state is stored in each block?  Here’s the beauty of the modified Merkle Patricia tree – only a very small part of the tree itself changes as a new block is added to the tree (for most blocks, there are occasional exceptions).  This means that only a very small fraction of data needs to be included in the block in order to capture a seemingly large amount of data. 

This is where the space savings of Ethereum’s blockchain vs. Bitcoin’s comes in – you don’t necessarily have to store the entire blockchain on a computer to validate future blocks.  Data is stored on the tree only once and can be referenced twice using hashes of the subtrees (children to the current position on the tree). 

            Before we get to mining, another perplexing matter arises with smart contracts – “where” exactly is this code executed?  Obviously, the contracts themselves live on the blockchain (and not on the Merkle Patricia tree), so it would make sense that they would have to execute on the blockchain – but how? 

Remember state transition functions from the last article in this series?  The actual execution of contract code is part of the state transition function (which itself is a part of the algorithm used to validate blocks).  This means that if a transaction is placed into a given a block, any node that downloads and validate the block will execute the code.  And it’s not just a one-time thing – the same code can be redownloaded and revalidated at any point, allowing for the execution of contract code in the future.  Pretty cool!

Ethereum Mining Difficulty

Alright, on to everyone’s favorite topic – mining.  How does mining actually work in Ethereum?  Let’s start with mining as a basic, generic concept first.  For a node to “mine” a cryptocurrency, the node basically needs to form a block of transactions, validate them, and add them to the blockchain.  It might sound pretty simple, but there’s quite a bit going on here.  Anyone can join in the action and mine Ethereum, but to actually profit from the work (i.e., the amount of Ether you own is more than the amount of energy you consume to solve the PoW problem) requires very calculated steps.

Just like Bitcoin, the difficulty in solving for the next block on the blockchain is related to how much total computational power (or the total hashrate) is currently on the network.  This means that as more and more nodes enter the network and increase the total hashrate, the difficulty goes up to keep the output block rate at a near constant. (The Ethereum network puts out a new block every 12 seconds or so)

Miners have the option of choosing which transactions to put into the next block they are attempting to solve (which means that most miners will attempt to include transactions with the highest transaction fee).  Remember that the goal here is for miners to solve a very difficult problem (hence providing a proof of their work as the name implies) that is easy for others to validate afterwards to prove that the mining was indeed correct.

Ethash Algorithm

While Bitcoin uses the hashcash algorithm for miners to prove that they have provided a proper hash for a block, the Ethereum network instead opts for the ethash algorithm.  There’s a method to this madness – the Bitcoin is nearly dominated by miners with super powerful rigs and purpose-built computing platforms (which incorporate Application Specific Integrated Circuits or ASICs). 

This essentially breaks the entire “decentralized” paradigm by allowing a few large miners to take over almost all of the mining.  They have the most power available with purpose-built hardware (i.e., ASICs) not easily available to “normal” users of the network.  For this reason, ethash uses an algorithm that makes it nearly impossible for dedicated ASICs to mine new blocks.  And, as we mentioned at the top of this article, companies have little incentive to begin designing Ethereum-specific mining hardware since Ethereum 2.0 plans to move the entire mining process from a PoW to a PoS paradigm. 

POS Paradigm

It may some time before the new PoS paradigm comes about in full force, but let’s take a brief glance into the future to see how this would work and how it compares to Ethereum’s current mining architecture.  Currently, anyone in the network can deploy hefty mining hardware and proceed to validate more blocks due to the shear heft of their hash rate. 

The energy consumption in this setup increases quite drastically as more and more CPUs and GPUs are utilized to mine blocks.  In a PoS system, your effective “hash rate” comes from the amount of stake you have in the network (in other words, how much Ether you own).  Different block validators take turns on voting which blocks belong on the blockchain; validators with more Ether get more of a say as to which blocks are added. In addition to significantly reducing the amount of power needed in the network overall, there will be fewer concerns for centralization and an increase in security. 

Learn More On Eth Blockchain

Curious to learn more about the topics we’ve discussed above?  Take a look at a few of these articles for more information:

  • It’s in the name:  What is the Size of [the] Ethereum Blockchain?
  • Here’s some great information about mining Ethereum.
  • A few more mining nuggets can be found here.

Well, that’s all folks!  Thanks again for taking the time to learn more about Ethereum; we’ll see you in the next article!

The post Ethereum from the Ground Up – Blockchain and Mining appeared first on San Francisco Tribe.



This post first appeared on Blockchain, please read the originial post: here

Share the post

Ethereum from the Ground Up – Blockchain and Mining

×

Subscribe to Blockchain

Get updates delivered right to your inbox!

Thank you for your subscription

×