Ethereum was the second biggest cryptocurrency behind bitcoin that lets us do incredible.
The advantage of using Ethereum in the decentralized blockchain is that its offering cheaper transactions. For example: you don’t have to worry about a third party taking a fee, so it’s cheaper for both parties.
But the point is to talk about Ethereum and learn how contracts and the model-view-controller architecture of web apps all play together. So first of all what is Ethereum?
Ethereum is a platform to build decentralized applications using blockchain technology.
We know that bitcoin was the first blockchain application and Ethereum does to applications what bitcoin did for money.
In essence, it removes the need for a trusted third-party. For the bitcoin blockchain we had blocks and this blocks are just objects that store data. The blockchain is basically a glorified linked list that’s stored on everybody’s computer.
Ethereum blockchain is very similar but different because what’s stored in those blocks are not just transactions. You can also sort code snippets in those blocks (smart contracts).
Ethereum is a programmable blockchain while Bitcoin isn’t. Well Bitcoin have its own scripting language but it’s not as awesome or complete or capable as Ethereum. You can build decentralized applications and you might be asking. A decentralized What? Decentralized application looks like a different stack entirely. To put this in to perspective let’s start imagining our Ethereum application in layers.
The First Layer is the blockchain in 2.0 means the Ethereum blockchain
First layer we have a blockchain that allows for this decentralized consensus over application level constructs. There so many things in an app where different party need to agree upon. Is this a valid username, identity, address, reputation score, etc.? You need consensus. If we had a server there’s no need for consensus, there is no democracy its a dictatorship. Where the server controls everything but in a decentralized application we need consensus. The blockchain was really the missing ingredient to reach consensus in a distributed decentralized way.
The Second Layer is the Storage & Content Delivery
Normally we use Google cloud there are a bunch of service providers for storing your data in the cloud controlled by one entity. In Ethereum case we want a decentralized version of storage, peer to peer own by no entities.
The Third Layer is the Smart Contract
Smart contracts are code snippets that live in the blockchain. They are decentralized computation. While storage and content delivery is decentralized by IPFs, computation is decentralized by Ethereum blockchain smart contracts. On top of all that we can start adding application level constructs. Like identity reputation, attention, AIs where using all of this we can create a Dapp.
The Dapp, doesn’t depend on any specific party existing and it’s not about one party selling it services. It’s more about a network, a community of people who all share in ownership of some piece of software. And to everybody profits in everybody contribute in some way. Ethereum is a more communal and progressive way of building software that is already mainstream.
WeiFund and Augur the living working examples of Dapp
WeiFund is a decentralized kickstarter we all know by now how kickstarter works. Its all about crowdfunding. WeiFund is a smart contract technology that let people crowdfund certain applications or projects on Ethereum blockchain.
Augur is pretty interesting because it’s all about forecasting and getting rewarded for your predictions. Its control by no party, publicly verifiable where all the bets and amount of funds are transparent.
The Architecture of Ethereum
Ethereum provides the consensus layer, economic layer and the blockchain services layers. Where the bottom three layers, Ethereum solves for the consensus where we need some way to agree upon all of this application level constructs. On top of the consensus mechanisms we need some kind of economic token to incentivizes all these nodes. The nodes jobs are to do the computation, storage or whatever is necessary, so that’s how crypto tokens coming to play.
On top of that we can start offering services, the code snippets actually do things: name registry, smart contracts, messaging or distributed hash table for storing data.
What we have now is Interoperability
In this Ethereum decentralized world, where we are just imagining all those Dapps where they all have their own tokens. How are you supposed to exchange value between all of these tokens?
Well the answer is to have a universal wrapper around all cryptocurrencies where is only one cryptocurrency to deal with. Under the hood this exchange protocol would transfer value or transmitted value between all of these different tokens as you use different services.
Think of it like a stack of decentralized APIs that use their own token. You pay the top API with whatever token and that pays all the other APIs in tokens that they require. Using this kind of decentralized exchange protocol in Ethereum blockchain is done with this Dapps.
Accessing the Ethereum decentralized applications done with browsers
Ideally the mainstream browsers that we know and love, Chrome, Firefox and Opera they would accept these decentralized protocols natively. So we wouldn’t have to create another browser hopefully, they will very soon. But in the meantime we have browsers that are made for decentralized applications like Mist and Maelstrom and all the others. Once we have all that it comes down to build Dapps using all this technology.
Store the data in IPFs you don’t want to store data directly in the blockchain because it’s too big. Every minor has to download a copy of this Ethereum blockchain and all the transactions. Including code and whatever else is in the transaction. But if you’re storing movies or really big files in the Ethereum blockchain that will be way to big. No one’s going to be able to download all of it.
The right way to fix storage problem in Ethereum blockchain
The fix is to store data in distributed hash table like IPFs, then IPFs gives back a hash (content address) and only that is store on Ethereum blockchain. In terms of architecture the Ethereum’s white paper is quite extensive and there’s a lot happening. Ethereum blockchain have blocks linked together. Inside each block is a list of transactions. All those transactions contain state and other programmable parameters. Ethereum blockchain stored on every miner computer uses proof of work algorithm to verify the entire network. Inside, each of these blocks run the computation like smart contract contained in each block. Once that computation is successfully done on each miner computer, the whole network will do the same thing. However, the majority of the network must agree on the computation of the code snippet. That will be added to the Block and as an immutable construct.
The Merkle Tree data structure
Inside of each block there is a Merkle tree, on bitcoin blockchain this glorified singly linked list. With pointer to the previous hash of the previous block with a nonce to insure a novelty, a timestamp and Merkle root.
You might be thinking why can a block store transaction as a list into one block header? The answer is: if stored as one big list that would cause huge scalability issues. To get around this the Merkle tree data structure is used. Which is a way to hash large numbers of data relying on splitting the chunks into buckets. Each bucket only contains a few chunks, hashing all the way down the chain.
Think of it like a file directory with the root directory your child directories and it just keeps going. The reason of using Merkel tree is because it allows Merkel proofs constructed from chunks.
Anyone reading that proof can verify that the hashing is consistent going all the way up to the tree.
Bitcoin blockchain uses a very simple Merkle tree whit parameters. But the limitation is that it can’t prove anything about the current state. Meaning who’s holding some digital assets, name registrations or the status of some financial contract.
Ethereum blockchain modifies that Merkle tree to store more than one with three kinds of objects. Transactions, receipts and state of the code, naming it the Patricia tree.
Ethereum virtual machine
Which calculates elements that run contract logic, encapsulated by the Ethereum client. Followed by swarm or the storage layer and then whisper to allow nodes message each other. To run Ethereum just download the client and then connect to the Ethereum network.
Unlocking the exploration of Ethereum blockchain, smart contracts, new blocks the actual real deal. Moreover the client is the gateway into Ethereum network whoever he is.
Ethereum decentralized applications
Imagine a controller that instead of speaking to a server it speaking to Ethereum blockchain and distributed hash tables. In terms of model that kind of stays very similar. But also having other type of models and that is the smart contract.
Hopefully my explanation gave you a better understanding on how Ethereum blockchain works.