What is ink! and What’s New in Version 4.0?

Dustin Lee
Astar Network
Published in
5 min readMar 29, 2023

--

What are eDSLs?

First, let’s go over a bit of background: EDSLs are Embedded Domain-Specific Languages, which are small programming languages embedded within a host programming language. EDSLs are designed to be used for a specific domain or problem such as smart contract development, with syntax and semantics tailored for that domain, making it easier to read and express solutions in the form of code.

The use of eDSLs can lead to more concise and expressive code, as well as increased productivity and reduced errors. EDSLs can also provide a higher-level abstraction than the host language, which can make it easier to reason about and optimize code.

The State of Blockchain eDSLs

When we think of smart contracts, usually Solidity and the Ethereum Virtual Machine come to mind, which makes sense due to their large suite of tools, well established developer community, and proven history. In terms of adoption, Solidity’s popularity is ahead by a landslide in comparison to other eDSLs such as ink! but it’s important to understand the reasons why that is the case, and how building Wasm smart contracts using ink! can help developers scale past EVM, and drive more Web3 adoption.

As Solidity and the Ethereum Virtual Machine environment have matured and adoption has reached critical mass, users and developers have discovered several choking points which have transformed the theoretical possibility of scaling and UX issues into full-blown reality, and have since caused transient network congestion and unimaginable gas costs for use of EVM resources, which have stonewalled growth on the Ethereum blockchain, and EVMs in general.

WebAssembly and the Need For ink!

Fast forward years later, and we have ink! an eDSL developed by Parity, that allows developers to build smart contracts that compile to high-performance WebAssembly, and is designed to scale smart contracts past the limitations of the EVM.

WebAssembly (Wasm) is a low-level Virtual Machine designed to be fast, efficient, and secure. It provides a portable, cross-platform environment for executing code, and is supported by all major web browsers. Wasm provides a sandboxed execution environment, which helps to improve security by preventing smart contracts from accessing system resources that they should not be able to access.

Ink! is designed to take advantage of the benefits of WebAssembly by compiling smart contract code into Wasm bytecode, so smart contracts written in ink! can be executed quickly and efficiently in a secure environment.

Ink! Features

Ink! has a number of features that make it well-suited for smart contract development, such as strong type support, which helps reduce the risk of errors in smart contract code, and also:

  • idiomatic Rust code
  • Ink! Macros & Attributes — #[ink::contract]
  • Trait support
  • Upgradeable contracts — Delegate Call
  • Chain Extensions (interact with Substrate pallets inside a contract)
  • Off-chain Testing — #[ink(test)]

These features make ink! an attractive eDSL for smart contract developers from all platforms and backgrounds, even if they’re coming from the traditional Web2.0 space, making it the preferred choice for smart contracts of the future.

To learn more about ink! features and try some hands-on examples, check out our Wasm Smart Contract guide.

What’s New in ink! 4.0

Since the inception of Ink! There have been many changes and additions to the roadmap. Here are all the updates we can look forward to with this release.

List of New Features:

  • Most importantly, ink! 4.0 is Production-Ready, meaning that intensive auditing has been completed, and compilation checks are in place to ensure code integrity.
  • Implementing all remaining breaking changes from our endeavor of reducing contract sizes (how the storage API works).
  • Introduction of a new metadata format to account for some current shortcomings (e.g., a compilation environment).
  • Making ink! closer to the idiomatic way of Rust (by reverting transactions on err returns from constructors).
  • Creation of tooling for testing cross-contract calls and testing against a custom runtime.
  • Improve the developer experience by bundling all Ink! crates into one ink! entrance crate.
  • Allow different contracts to reference and use the same event types.

It’s taken some time to make ink! production ready, and with all the various revisions to the code and finally the auditing necessary for real-world adoption, ink! 4.0 will see more widespread popularity in the coming months and years as teams who have been on the sidelines will now be able to deploy production-ready Wasm smart contracts!

How Secure is ink!

SRLabs is a research organization focused on identifying and fixing security vulnerabilities in various software applications and systems. They have conducted extensive research in the field of blockchain technology.

Substrate is a blockchain development framework that allows developers to easily create their own blockchain applications, and was developed by Parity, the same company that developed the Parity Ethereum client, which SRLabs found a critical vulnerability in 2018.

Since then, SRLabs has continued to conduct research on security vulnerabilities affecting all Parity products, including the Parity Ethereum Client, Substrate, and ink!

With SRLabs conducting ink! auditing, developers can rest assured each major release will be production-ready.

What happens next, what can we expect?

It starts with Shiden and ends with Astar.

ink! will be deployed first on Shiden, as Astar’s canary chain, to get a feel for how Wasm smart contracts will behave on Substrate. Once battle-tested, deployment on Astar Network will follow.

With recent community proposals and bounties, we have seen some headway with Openzeppelin’s proposal on ink! Wasm smart contract auditing. (https://polkadot.polkassembly.io/post/1401#fd254236-d9f6-474b-8935-08738d41ca82)

Recently referenda 101 has passed pertaining to Bounty 19 with our coalition of teams from Web3 Foundation, BrushFam, Aleph Zero, Phala Network, and Parity. This bounty will encourage, promote, and help developers adopt WebAssembly smart contract development tools on Polkadot. (https://polkadot.polkassembly.io/referendum/101)

The $1.6M bounty will help shape and educate the future of ink! Time will tell with ink! 4.0 how things will end up, but we are very optimistic about the future of Wasm smart contract development on Polkadot!

About Astar Network

Astar Network is a Multichain smart contract platform and leading parachain on Polkadot that supports dual independent EVM and WebAssembly (Wasm) environments, and interoperability between them, as well, using a unique Cross-Virtual Machine (XVM). This technology allows developers to seamlessly blend together EVM and Wasm smart contract functionality, while also being friendly to non-blockchain developers, and the tools and languages they already know.

Astar’s innovative Build2Earn system is designed to secure the network, while simultaneously rewarding participants and builders, allowing developers to earn incentives for building and maintaining their dApps, and growing their communities.

Website | Twitter | Discord | Telegram | GitHub | Reddit

--

--

Dustin Lee
Astar Network

Web3 Native | Rapper | Serial Polkadot Ambassador |