BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

What kind of tool is WebAssembly that Polkadot mainly supports?

Polkadot生态研究院
特邀专栏作者
2022-02-16 03:59
This article is about 1684 words, reading the full article takes about 3 minutes
WebAssembly not only provides developers with convenience and more possibilities, it will also be the future of smart contracts.
AI Summary
Expand
WebAssembly not only provides developers with convenience and more possibilities, it will also be the future of smart contracts.

"Polkadot Knowledge Graph" is our entry-level article on Polkadot from zero to one. We try to start from the most basic part of Polkadot and provide you with a comprehensive understanding of Polkadot. Of course, this is a huge project. Engineering is also full of challenges. However, we hope that through such efforts, everyone can correctly understand Polkadot, and people who do not know Polkadot can easily and quickly grasp Polkadot-related knowledge. Today is the 30th issue of this column. Learn about Polkadot A convenient and secure developer toolWebAssembly(Wasm)

Previously, the topic of using Wasm for blockchain development has aroused extensive discussions.

EVM is a virtual machine commonly used in blockchain, and it is also the smart contract operating environment of Ethereum. Although the emergence of EVM can make it easier for developers to deploy smart contracts, it also has many limitations.

secondary title

What is WebAssembly?

WebAssembly, or Wasm for short. The official definition is: a new format that is portable, small in size, fast in loading and compatible with the Web.

To be precise, Wasm is a binary instruction format designed for stack-based virtual machines. Wasm is designed to target platforms in high-level languages ​​like C/C++/Rust, enabling client and server applications to be deployed on the web.

secondary title

What are the characteristics of WebAssembly?

As a compilation target, WebAssembly can compile C, C++, Java and other programming languages ​​into machine codes instead of a few lines of handwritten codes, and the converter is omitted in this process. Therefore, Wasm has the characteristics of fast, efficient, memory safety, etc., and is very open and has been loved by many developers.

Efficiency: Wasm has a complete set of semantics. Its binary format loads quickly and can greatly reduce the size of the code package. Ultimately, it relies on hardware capabilities to achieve native execution efficiency.

Security: Wasm runs in a sandboxed execution environment, and can even share an environment with the current Java virtual machine. Security in the web environment is achieved by strictly adhering to the permission policies of the host browser and maintaining backward compatibility.

secondary title

Why use WebAssembly?

WebAssembly is a platform-independent binary format, meaning that it will run the same instructions on any machine it operates on. Blockchains require determinism so that there are reliable state transition updates across all nodes in a peer-to-peer network without forcing each node to run the exact same hardware.

Wasm is well suited for reliability across a wide variety of machines. Wasm is efficient and fast. This efficiency means that it can be uploaded to the chain as a block of code without too much state bloat, while maintaining its ability to execute at near-native speed.

Second, hard forks, the standard method of upgrading blockchains, are slow, inefficient, and error-prone due to the level of offline coordination required, and thus tend to bundle many upgrades into one massive event.

postscript

postscript

As a widely supported high-performance standard, WebAssembly has also been affirmed by Polkadot founder Gavin Wood. Gavin believes that "WebAssembly is the future of smart contracts."

This format is still in the process of rapid development and will be the basis for distributed system development in the future. Many public chains are also gradually using Wasm technology. For developers, Polkadot smart contracts can be developed in any language compiled into Wasm, and smart contract development will become easier.

Welcome everyone to visit the Mirror address of Polkadot Ecological Research Institute: https://mirror.xyz/0x9A259b3a2316281Cc948cE2Cf1Ac610a79844f05

Welcome everyone to join our Telegram of Polkadot Ecological Research Institute: https://t.me/polkadot_eri

Welcome everyone to visit the Mirror address of Polkadot Ecological Research Institute: https://mirror.xyz/0x9A259b3a2316281Cc948cE2Cf1Ac610a79844f05

Polkadot
Welcome to Join Odaily Official Community