Now that we’ve covered what ethereum is, let’s dig into how the platform under the hood works.
Think the online notebook application described in “What is Ethereum?”
Using ethereum, the application does not require an entity to store and control your data. To achieve this, ethereum borrows heavily from the bitcoin protocol and its blockchain design, but adjusts it to support applications beyond money.
However, Ethereum aims to abstract the design of bitcoin so that developers can create applications or agreements that have additional steps, new ownership rules, alternative transaction formats or different ways of transferring the state.
The purpose of ethereum’s “Turing-complete” programming language is to allow developers to write more programs in which blockchain transactions can govern and automate specific results.
This flexibility is perhaps the main innovation of ethereum, as explained in the guide “How Ethereum smart contracts work“.
The ethereum blockchain
The structure of the ethereum blockchain is very similar to that of bitcoin, since it is a shared record of all transaction history. Each node in the network stores a copy of this history.
The big difference with ethereum is that its nodes store the most recent status of each smart contract, in addition to all ether transactions. (This is a lot more complicated than described, but the text below will help you get your feet wet.)
For each ethereum application, the network needs to track the “status” or current information of all these applications, including the balance of each user, all the smart contract code and where it is stored.
Bitcoin uses exits from unspent transactions to track who has how much bitcoin.
While it sounds more complex, the idea is quite simple. Each time a bitcoin transaction is made, the network “divides” the total amount as if it were paper money, issuing bitcoins in a way that causes the data to behave similarly to physical currencies or exchange.
To make future transactions, the bitcoin network must add up all its changes, which are classified as “spent” or “not spent.”
Ethereum, on the other hand, uses accounts.
Like bank account funds, ether tokens appear in a wallet and can be transferred (so to speak) to another account. The funds are always somewhere, but they don’t have what we could call a continuous relationship.
What is the ethereum virtual machine?
With ethereum, each time a program is used, a network of several thousand computers processes it.
Contracts written in programming languages specific to smart contracts are compiled into “bytecode”, which a function called “ethereum virtual machine” (EVM) can read and execute.
All nodes execute this contract using their EVM.
Remember that all nodes in the network contain a copy of the transaction history and smart contracts of the network, in addition to tracking the current “status”. Each time a user performs some action, all nodes in the network must reach an agreement that this change occurred.
The objective here is that the network of miners and nodes assume the responsibility of transferring the change from state to state, instead of some authority such as PayPal or a bank. Bitcoin miners validate the change of ownership of bitcoins from one person to another. The EVM executes a contract with the rules that the developer initially programmed.
The actual calculation in the EVM is achieved through a stack-based byte code language (ones and zeros that a machine can read), but developers can write smart contracts in high-level languages such as Solidity and Serpent that They are easier for humans to read. to write.
As explained in our guide “How Ethereum Mining works“, miners are the ones who avoid bad behavior, such as making sure that nobody spends their money more than once and rejecting smart contracts that have not been paid.
There are a few thousand ethereum nodes out there, and each node is compiling and executing the same code.
But, you might be thinking, isn’t it much more expensive than a normal calculation? Yes it is. That is why the network can only be used for particular use cases.
The official ethereum development tutorial recognizes this inefficiency, indicating:
“Approximately, a good heuristic to use is that you will not be able to do anything in the EVM that you cannot do on a smartphone since 1999.”
Article Source: http://www.coindesk.com