Ethereum virtual machine ELI5 + Improvement Roadmap
I came across a great explanation on the Ethereum Virtual Machine (EWASM) and the coming features like Parallel Processing Transactions, Payment Channel Networks, Sharding, and Truebit. See below:
[EWASM]
• The Ethereum virtual machine is currently an slow stack based interpreter. If you look at the python code you see that it is basically a stack plus a big nested if / case statement.
• So you know how browsers run javascript. In future they will run web assembly and javascript or any other language like C++ will be compiled to web assembly and will execute at near native speed which is designed to take advantage of native hardware features (possibly multiple cores I don't know).
• EWASM will port the EVM to WebAssembly but also add key features required by the EVM namely:
- Restrictions on allowed operations. In particular all operations will be deterministic so that miners and validators running the same code will always get the same results and thus consensus can be achieved.
- There will be an interface to let WASM programs do Ethereum specific things like get the block number.
- Metering so that gas costs of executed operations can be calculated and thus DoS attacks prevented
This matters because:
• It will be much faster.
• You will be able to write ethereum programs in almost any language because there will be cross compilers from most languages to WASM so you could run C++, Rust, Javascript, Whatever programs on the EVM.
• The likes of Apple, Google, Microsoft are supporting WASM so:
- It will be included in most browsers so conceivably you could have light Ethereum JS node running in the browser or nodejs.
- there will be lots of tooling and collaborative effort to leverage
Truebit
• So lets start with piper's computation market the basic idea is The Computation Marketplace allows for someone to pay someone to execute an algorithm outside of the network and report the result back to them. Each algorithm will have an on-chain implementation which can be used to verify whether the submitted result is correct. In the event of a dispute over what the correct result is, the on chain version of the computation is executed to determine the correct answer. Truebit takes this a step further and uses some clever Merkle tree maths to convert this into a binary search process ensure that only a few steps need to be tested on chain to prove cheating. The upshot of this is you can run really complex programs in offchain languages like C++ and verify the results on chain without requiring impossible amounts of gas.
Parallel Process Transactions
• Transactions say "I will touch these accounts/contracts and no others. Miners can execute transactions in parallel as long as they don't modify the same accounts/contracts.
Payment Channel Networks
• Instead of sending Eth directly you send IOUs offchain. The IOUs are netted out and turned into onchain transactions when the channel closes. This blog post A Lightning Network in Two Pages of Solidity explains the basic idea but there are loads of edge cases and scalability issues that Raiden or any real implementation also handle.
Sharding
• Different chains which are effectively separate but firstly each chain has the same security as all and secondly they can call each other. (See here)
Source: https://np.reddit.com/r/ethtrader/comments/6kbca2/can_someone_eli5_what_swapping_the_evm_for_wasm/