I’ve been reading and writing about WebAssembly for a few months now and I have to say it got me very much intrigued. With several posts already published, it’s been quite a ride. Above all, one question remains open – what is the future of WebAssembly? or better yet – is WebAssembly the future?
In this post I’ll try to recap key points I’ve learned with my own thoughts and prophecies: from the future of web development to cloud computing and even blockchain.
WebAssembly & JavaScript
As far as the browser goes, JavaScript has been around for about 20 years. It’s the dominant language for frontend development and it will probably remain so in the near future. The reasons for which I think that JavaScript would remain dominant are:
- It has been heavily optimized
- JS has been used in the wild for two decades
- Numerous amount of amazing frameworks (Angular, React, Vue etc.) developed around it
- A huge number of communities worldwide
But most importantly, at the end of the day, JavaScript gets the job done.
That being said, a change is inevitable.
For some use cases JavaScript just doesn’t cut it. JavaScript was originally (20 years ago, remember?) made for light and simple scripting, but today we want it to do more. But when it comes to heavy duty tasks such as video streaming, compression, gaming – JavaScript isn’t good enough.
As Andreas Rossberg said:
The original elevator pitch was to bring near-native machine performance to the Web and liberate it from the stranglehold that JavaScript has over the Web.
https://medium.com/dfinity/why-webassembly-f21967076e4
Moreover, WebAssembly allows you to use the same language you code your server side with for you client side. For me, as a full stack developer, that’s awesome. For a lot of developers, working with JavaScript was something they couldn’t avoid, and now they can (partially at least).
I think it’s safe to say that JavaScript won’t vanish overnight. For the meanwhile, WebAssembly and JavaScript will work hand in hand but WebAssembly is clearly the next stage in web development evolution.
Taking The “Web” Out Of WebAssembly
We wanted to create a technology that is useful beyond “only” the Web. Despite its name (which is really a misnomer), WebAssembly is in fact carefully designed to be completely agnostic to the Web; at its core, it simply is a cross-platform low-level virtual machine that can equally be “embedded” into any other environment.
https://medium.com/dfinity/why-webassembly-f21967076e4
One of the common misconceptions regarding WebAssembly is that it is intended to be working solely on the web – as it’s name suggests. As I’ve said previously, WebAssembly was originally intended for the web, but not only.
Let’s see where and how it has already been adopted.
To The Cloud
Major cloud providers saw the benefit of using WebAssembly out of the browser, and have already started incorporating Wasm in a various range of products:
- Fastly were one of the first companies to see WebAssembly’s potential on the server-side. They’ve since developed that into a serverless compute environment with startup times 100x faster than other alternatives, called Compute@Edge.
- Cloudflare is also one of the first companies to invest in WebAssembly. Their workers technology was supported only in JavaScript. With the addition of WebAssembly, users can now use a wide range of languages and do more, faster.
- Shopify turned to WebAssembly to use advanced customization tools pluggable by third parties. WebAssembly is used to make these customizations synchronous, secure and lightning fast.
- Solo.io in my opinion is another fascinating company. They are trying to use the OCI model as a base class for WebAssembly. Although they are focusing on ways to extend service mesh functionality, portable Wasm bundles could be a major step forward in ease of development. Just imagine a “Docker hub” for Wasm files – or as they call it – WebAssembly Hub, isn’t that cool?!
Some more cloud related projects
- Enarx is a Trusted Execution Environment. It keeps your data completely confidential, even from the hardware it’s running on.
- Krustlet is a tool to run WebAssembly workloads natively on Kubernetes.
- WaSCC implements an actor framework for connecting to cloud-native services, such as message brokers and databases.
And these are just a few use cases I saw fit to mention. This space keeps expanding as more and more vendors see the possibilities that WebAssembly brings to the table.
And I couldn’t possibly finish this section without mentioning the famous quote by Docker’s founder, Solomon Hykes from 2019:
If WASM+WASI existed in 2008, we wouldn’t have needed to created Docker. That’s how important it is. WebAssembly on the server is the future of computing. A standardized system interface was the missing link. Let’s hope WASI is up to the task!
https://twitter.com/solomonstre/status/1111004913222324225
And to conclude, as solo.io put’s it: WebAssembly is the future of cloud-native infrastructure extensibility.
WebAssembly On The Blockchain
When writing this section, I came to a conclusion that this section would require a separate post to cover the history and basic terms since it is less common than other sections. Stay tuned for the dedicated Wasm & blockchain post coming soon!
That being said, let’s start with a quick intro and see why is WebAssembly on the blockchain actually needed.
A quick introduction
When Bitcoin was first created it defined the blockchain and also a scripting language for it’s blockchain called Script. Script is a very basic and Turing incomplete scripting language which is used for processing transactions within the Bitcoin network.
Bitcoin and Script laid out the foundations for smart contracts adoption, let’s see how.
Smart contracts and dApps
Ethereum, similarly to Bitcoin, is a decentralized open source blockchain but with significantly enhanced way to enable developers to compose complex smart contracts. This also led to the creation of decentralized applications (dApps).
Solidity and the EVM
The Ethereum smart contracts are written in Solidity, an object oriented language that was designed specifically for contract authoring, and are executed by the Ethereum Virtual Machine (EVM) that runs on the nodes within the network.
WebAssembly to the rescue!
Ethereum is facing a great deal of technical difficulties preventing it from growing and scaling as demand grows. One of the main issues with the current EVM is that it processes transactions sequentially.
eWASM
The new EVM called eWASM stands for Ethereum WebAssembly. [..] This new architecture for the EVM will allow for much better performance and will make it possible to support smart contracts, accounts, states and much more on the new blockchain.
https://medium.com/swlh/a-comprehensive-view-of-ethereum-2-0-serenity-5865ad8b7c62
WebAssembly has emerged as a strong candidate replacement for the current EVM. Its host independence, security sandbox and overall simplicity make it an ideal runtime for smart contracts. Furthermore, it also allows the development of contracts in a wide range of modern programming languages (Rust, C++, Go…).
Not Only Ethereum!
While Ethereum has an EVM, other infrastructure projects have a virtual machine too and are looking into WebAssembly: Polkadot, EOS, Parity, Tron, U°OS and many others. It appears that WebAssembly have become the de-facto standard for building a new blockchain.
WebAssembly is the future!
It seems that WebAssembly has a bright and interesting future coming. From the web to the cloud and on to cutting edge blockchain technologies – it seems like everyone is putting their faith into it.
WebAssembly would change the web as we know it in the near future.
That’s all for now. Feel free to follow me on twitter for regular updates and as usual like and comment at will. See you on the next one!