Web Assembly: How Can It Improve Blockchain-Based Web Apps and DApps?
Mar 15, 2020, 3:47PMWeb Assembly offers developers a new way to publish their DApps. Will it revitalize blockchain app development?
Web Assembly (or WASM) is a standard that allows developers to compile programs written in various languages as cross-browser web applications. Since it began development in 2015, WASM has gained plenty of traction: it has earned support from four major browsers, and it has proven to be popular among developers as well.
Now, many blockchain projects are deciding to take advantage of WASM. That choice could bring countless improvements to blockchain-based DApps and smart contracts, which are currently facing challenges. Below, we'll take a look at which projects are adopting WASM, and how it might reshape blockchain app development.
Projects Using WASM
Ethereum's plans to integrate WASM are most notable. Right now, app developers can write smart contracts or programs in Ethereum's Solidity language, and that code will then be executed by the Ethereum Virtual Machine (EVM). However, this isn't always ideal: as Chainsafe explains, Solidity was designed for correctness over efficiency.
By the time it implements version 2.0, the Ethereum project will introduce Ethereum Web Assembly (Ewasm) for better standardization, greater portability, and, above all, faster performance. Ewasm will allow individual contracts to run faster. It will also improve overall efficiency, because faster execution will allow more data to be included in each Ethereum block.
Ethereum is not the only blockchain with plans for WASM. EOS, one of Ethereum's biggest competitors, already supports WASM via EOS-VM and claims that it provides a 12x performance boost. Other blockchains working with WASM include TRON, UOS, Perlin, NEAR Protocol, and Cosmos, and the benefits are similar on each platform.
Benefits of WASM
As noted, WASM's main advantage is speed. WASM is fast because it optimizes code written by developers without requiring developers to do that themselves. In Ethereum's case, WASM also removes the need for EVM code to be precompiled. In light of these facts, WASM should provide significant performance benefits.
WASM is also designed with security in mind. It is secure from a user's perspective because it runs in a sandboxed environment. This means that applications execute independently and are constrained by web browser security policies, limiting the possibility of malicious code. Semantic limitations also restrict dangerous code.
Cross-browser portability is another benefit. Microsoft Edge, Chrome, Firefox, and WebKit reached consensus on WASM and turned the feature on by default in 2017. In practice, Safari and Edge have little support for blockchain DApps in general, but consensus means that DApp developers can target those browsers in the future.
Finally, WASM may attract diverse developers because it can compile from multiple languages. WASM supports several languages including Rust and Haskell (used by Cardano), C++ (used by EOS), and Java and Python (used by NEO). That's just the beginning, as WASM supports over fifty programming languages in total.
Potential Issues
WASM faces criticism despite its potential. For one thing, WASM is not a total solution to blockchain scalability. It will not single-handedly solve activity surges and spam transactions, which must be handled in other ways. Ethereum 2.0, for example, will use sharding and Casper proof-of-stake as other performance improvements.
Security is also an issue. Blockchain-specific programming languages achieve security partly through limitations that allow for formal verification of code. In Ethereum's case, developers have suggested that Ewasm's limitations will prevent this issue, but third-party WASM VMs may not provide acceptable security.
Finally, WASM is a web standard, not a blockchain standard. Recent surveys show that Ethereum's Solidity language is overwhelmingly popular with developers despite a wide choice of alternatives. Some developers support Ethereum's existing standards and believe that further development there would be a better pursuit.
In Summary
Web Assembly is promising. It's a standard that is growing in popularity, and it represents an important opportunity that could attract developers to blockchain. DApp development is a niche area, and any improvements could be valuable―whether those improvements concern performance, security, or compatibility.
At the same time, WASM is a new tool. Though it is several years old and already in use, there is still plenty of debate around it. It is possible that its benefits are overstated, and the blockchain community could turn to different standards. Time will tell if WASM really is appealing to those who want to build on blockchain.
Disclaimer: information contained herein is provided without considering your personal circumstances, therefore should not be construed as financial advice, investment recommendation or an offer of, or solicitation for, any transactions in cryptocurrencies.