Astar Network and WASM: The Future of Web3

The Ethereum Foundation broke new ground in building dApps with the introduction of EVM, the Ethereum virtual machine for executing/building smart contracts.

“EVM is a stack-based state machine that interprets the EVM opcode into computational instructions that can be executed on top of the blockchain. It was made by the founder of Polkadot, Dr. Gavin Wood. Developers can use the contract-oriented language, such as Solidity or Vyper to write applications that can compile down to the EVM bytecode. EVM has a depth of 1024 items, and each item is a 256-bit word.”Hoon Kim, Astar Network CTO.

EVM Problems

“You see, the problem with EVM is it’s a hugely opinionated design. It derives from an already very opinionated design, which is the Bitcoin script design,” Dr. Gavin Wood, founder of Polkadot/Kusama and Co-founder of Ethereum.

However, there are serious problems with this approach:

  • Smart contract performance is limited on EVMs — 256-bit computation on 64/62-bit architecture, contract size limit on 24Kb (EIP-170).
  • Solidity tooling is very primitive and still new compared to NPM or Cargo.
  • Complex logic cannot be implemented on EVM.
  • eWASM has a lot of overhead (IEE).
  • Solidity and Vyper is a very unorthodox language to learn.
  • EVM dApps are stagnating due lack of innovation.

The Future: WASM

“It’s foolish to just throw those (EVM, today’s standard virtual machine) away. But it’s not foolish to start thinking about where the next thing is, and that for me is using WebAssembly as smart contracts Dr. Gavin Wood, founder of Polkadot/Kusama and Co-founder of Ethereum.

“WASM itself is a common standard for executing native-level operations from a browser environment. The development is led by industry leaders like Google, Microsoft, Mozilla, Apple, and more. With the power of WASM, you can run any hardware-intensive work such as games from the browser with near native-level performance.”Hoon Kim, Astar Network CTO.

With more advanced use cases, smart contracts demand more complexity, and EVM has been showing its limitations. That is where the WASM-based smart contract comes in.

To make Web3 a reality, blockchain mass adoption is necessary, and this is the Astar Network’s commitment to unrestrictedly supporting WASM development. Astar believes that WASM will be the future, but we are aware that EVM is needed NOW. The transition between EVM and WebAssembly will not happen quickly and could take a few years which is why Astar Network supports both virtual machines at the same time and allows them to be interoperable.

WASM Advantages

WebAssembly and multiple languages that compile WASM are an ideal alternative to EVM. WASM is a standard for web browsers developed by the W3C working group that includes Google, Mozilla, and others.

  • It has high performance as it facilitates sending small binaries over the Internet to devices with a potentially slow Internet connection.
  • WASM expands the languages available to smart contract developers to include Rust, C/C++, C#, Typescript, Haxe, and Kotlin. That is, developers can code smart contracts in any language they are familiar with.
  • It has memory security, a Sandbox environment and an independent platform.
  • 64 and 32-bit integer operation support that maps one-to-one with CPU instructions.
  • Easily made deterministic by removing floating point operations, which is necessary for consensus algorithms.
  • Supported by the LLVM compiler infrastructure project, meaning that WASM benefits from over a decade of LLVM’s compiler optimization.
  • Continually developed by giant tech companies like Apple, Microsoft and Facebook.

So we know that WASM-based smart contracts are technically superior to EVM, but why are so many networks still using EVM? This is due to its developer ecosystem. Solidity is the gateway language for many new dApp developers, with so many tools, examples, resources, and communities behind it and because most blockchains with large liquidity support EVM. So that’s the reason why it’s impossible for new projects to ignore it.

WebAssembly 2022 Perspective

Recent research carried out by The State of WebAssembly 2022 revealed some interesting data related to WASM and its languages.

  • Rust usage and desirability has continued to climb.
  • Python has seen a big climb in usage.
  • JavaScript has become a viable WebAssembly language.
  • Wasmtime is the most widely used runtime.
  • Users are using WebAssembly much more frequently.
  • Non-browser APIs are what WebAssembly needs the most.

In addition, one of the important data points reported by the survey is the growing use of WebAssembly among developers and the incredible potential for growth in usage in the crypto ecosystem. This is one of the pillars of Astar Network in building a multi-chain smart contract hub compatible with EVM and with WebAssembly as the default core.

Another factor that reinforces the need to unlock Web3 for Web2 developers, furthermore to the amount of Web2 developers available in relation to Web3 developers, is the amount of experience that WebAssembly developers have with the tools. It’s extremely complex to learn new programming languages when you’ve been used to writing code in a certain format for years. Web2 developers’ skills are directly associated with innovation and user focus, unlike Web3’s blockchain developers, and it is precisely this revolution that the crypto ecosystem needs and that Astar Network seeks to lead.

The WASM Challenges

While WASM itself benefits from extensive support and integration, unlike EVM, it is not built for the purpose of interacting with the blockchain.

  • Smart contracts are too large to launch and run on commercial parachains today.
  • Low adherence by Web3 developers, since EVM is the most used virtual machine and lacks tools.

The Substrate space and the Astar Network architecture

Several languages can be used on Substrate. ink! is the main language for the WebAssembly environment in the Substrate space.

Astar Network is built on Substrate and has two virtual machines (EVM and WASM). Contracts in Solidity can be launched in EVM, just as contracts in Solidity can be launched in WebAssembly through Solang, contracts in ink! can be launched in WebAssembly and WebAssemblyScript can be launched in WebAssembly as well.

The concept of XVM (Cross-Virtual Machine)

Despite being a complex concept, it is something very important for Astar Network, which aims to create a cross-virtual machine environment to make possible the interaction between the EVM and WASM environment on Astar Network.

  • DeFi use cases in WebAssembly may interact with DeFi uses in EVM, or
  • Use cases of NFT in EVM will be able to interact with uses of NFT in WebAssembly.

Where is Astar Network when it comes to WASM?

According to the article “Why we believe in WASM as the base layer of decentralized application development, published by Parity Technology, there is a consensus that WASM is the foundation of decentralized system development, and that is why Polkadot is built with WASM as the default language from the start.

In this way, the main goal of Astar Network is to allow the present, mostly in EVM, to be compatible and interoperable within the Polkadot ecosystem while the future in WASM is paved and built.

“WebAssembly is Polkadot’s native virtual machine and we are going to support smart contracts in WebAssembly. We are already supporting smart contracts in WebAssembly on our testnet (Shibuya). And our parachain, in Kusama, Shiden will support WebAssembly in a few weeks. We are working together with Parity Technology and Supercolony to progress with WASM on Web3 and thus consolidate Astar as a smart contract hub in WASM in 2023 or 2022. — Sota Watanabe, Astar Network Founder and CEO.

The Astar Network milestones are focused on WASM throughout Q3 and Q4 to enable innovative dApps to be deployed in the ecosystem. Although at an early stage of development projects in the main product categories are being developed with WASM such as NFT marketplace (Kodadot), lending platforms (2 Stealth Builders and MantraDAO) derivative trading platform (Radon Finance), game (Open Emoji Battler) and DEXs (One Stealth Builder) will be deployed on Astar and Shiden.

Milestones

  • Milestone 1: Test WASM smart contracts on Shibuya (currently tested and benchmarked).
  • Milestone 2: Support contract pallet on Shiden Network and deploy the first WASM products.
  • Milestone 3: Introduce WASM smart contracts on Astar Network.
  • Milestone 4: Astar will be known as the Polkadot native WASM smart contract hub (later this year).

WASM Partners

  • DIA — Oracle services
  • SubsSquid — WASM index for DeFi and NFT project
  • Subscan — WASM smart contract verification by user
  • Supercolony — Smart contract standards
  • Statemint — Bringing assets to Astar
  • Swanky — “all-in-one” tool for WASM smart contract developers within the Polkadot / Kusama ecosystem.

Making WASM Swanky Again 😎

The progress for the Substrate ecosystem still seems lagging and disorganized even though the underlying technology is on par if not better. Astar Network aims to push the Substrate WASM ecosystem for all future dApps who wish to leverage the interoperability of Astar Network.

Astar Network will focus on unifying the developer documentation who starts their developer journey from Astar Network, increase developer education, incubate and provide grants for new and innovative WASM dApps, and most importantly, create the Swanky CLI.

Swanky CLI is an all-in-one CLI tool for Substrate WASM contract developers that our ecosystem needs the most.

This tool is still under heavy development, but Astar plan to support various features like:

  • Unit-testing
  • Contract interaction
  • Deploying
  • Account management
  • Developer node setup

Because the codebase is made with modularity in mind, Swanky will add support for multiple smart contract languages ​​as more projects join to expand the ecosystem.

WASM Events

  1. Write Deploy & Interact with ink! Smart-contracts” — Workshop hosted by Astar Network to explore how to write a WASM smart contract in ink!, deploy it on substrate-nodes and testnet (Shibuya), and interact with the smart contract–using Parity tools and Swanky CLI tool.

2. Asar Network was present in the WASM Conference 2022 hosted by Supercolony with the presence of several icons of the Polkadot and Kusama ecosystem. At this event Sota Watanabe was invited to perform on the main stage discussing the topic “Why WebAssembly Matters in Polkadot. Why has Astar decided to use it?”, and on the technology stage, Hoon Kim, Astar Network CTO, gave his presentation on “ Will WASM be able to substitute EVM?” topic.

An aWASoMe list

All things related to WASM contract development in the Dotsama community .

Contracts Languages

Smart Contract Compilers

  • Charge — ink! compiler, use Rustc compiler
  • Solang — compiles Solidity smart contracts to WASM

Contract Development

  • Swanky — Swanky nmp repository (Github and docs will be published after Beta release)
  • Openbrush — OpenBrush is a library of ink! contracts, like OpenZeppelin
  • PSP — Polkadot Standards Proposals for ink! contracts by W3F

Contract Interaction

  • polkadot{.js} — an App to interact with Substrate node and pallet-contracts
  • ContractsUI — simple interaction with Substrate contracts
  • @polkadot/api-contract — thin layer on-top of the available API transactions to manage Substrate contracts
  • Redspot — A Truffle-like toolkit for Substrate node and pallet-contracts
  • Sidecar — REST service that runs alongside Substrate nodes

Wallets

  • polkadot{.js} — a browser extension
  • Talisman — a browser extension

Support

  • Substrate StackExchange — ask any smart-contract related question (use tags: ink, contract, smart-contract)
  • Astar Discord — connect with Astar WASM team (Use Developer Support channel)
  • Openbrush Element — Matrix/Element room, support for developing in ink! and OpenBrush
  • Astar WASM Docs — WASM dev related Docs by Astar

Learning

  • Substrate ink! Tutorial — Guided Tutorial for Beginners
  • Introduction to ink! — ink! workshop by Hernando (Parity)
  • OpenBrush: a library to build ink! smart contracts — Substrate Seminar
  • Building DEX Smart Contract in ink! — Simple DEX implementation in ink by Pierre Ossun
  • Build an AMM on Polkadot using Ink! — Figment tutorial
  • A BTC price bot with Phala’s ink! — A Substrate seminar on Phala’s Fat (PhaT) Contract Youtube
  • Sub0 Developer Conference — Semiannual, online and in-person for all things Substrate.

dApp development

  • Subscan — Multi-network explorer for Substrate-based chains.
  • Subsquid — An indexing framework (SDK + infrastructure) for WASM
  • DAY Oracle — Oracle for WASM contracts on Astar Network

Templates

  • Substrate-Front-End — Polkadot-JS API and React app to build front-ends for Substrate-based chains.

References

--

--

--

@AstarNetwork ambassador. Web 3.0 entusiasta

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Axie Infinity Clone Script is a ready-to-use website script of a blockchain-based NFT game — Axie…

Anndy Lian: Linfinity will be the backbone of reshaping supply chain ecology Linfinity (2018–07–13…

EmiSwap Compensates Your Gas Expenses

AthleteX launching on SX Network!

ANYPAD x AVALANCHE INTEGRATION LAUNCHED

Is The Smart Contract A Good Judge?

FuturProof — Blockchain Vocabulary

MASQ Network is integrating Polygon

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pitcoin

Pitcoin

@AstarNetwork ambassador. Web 3.0 entusiasta

More from Medium

Polkadot — a dive into the architecture of Dot-Sama.

A Game Changer; ownership, interoperability and collaboration

Connext Bridge Is Introducing Better Value Transfer

New Partnership Announcement: PortalVerse Network and Octopus Network