IOTA Smart Contracts Beta Release
The Beta Release of Programmable Smart Contracts is Now Available on the IOTA 2.0 DevNet
IOTA enters Web3. With the beta release of IOTA Smart Contracts, IOTA offers programmable smart contracts on the IOTA 2.0 DevNet, including early support for the Ethereum Virtual Machine (EVM) and smart contracts written in Solidity, Go (TinyGo) and Rust. We are currently working on extended EVM support, further optimization and porting smart contracts to the IOTA mainnet. Together with the integration of the Tokenization framework, it will offer a powerful solution for seamless, trustless and feeless interoperability and composability between smart contracts on IOTA. Follow the instructions below and let’s BUIDL!
With the beta release of IOTA Smart Contracts, the IOTA Foundation takes a big leap forward towards adding a new layer of utility to IOTA, by offering limitless possibilities to build decentralized applications (dApps) and other Web3 innovations. Our objectives with IOTA Smart Contracts are to address some of the drawbacks of existing solutions (fees, scalability, interoperability, and limited composability) and to create an ecosystem of new opportunities for builders and early adopters to directly capitalize on the explosive growth of our industry as we go mainstream.
Striving for interoperability and ease of use, IOTA Smart Contracts now supports the Ethereum Virtual Machine (EVM) and any smart contract written in Solidity. While this is an early implementation, it already provides extensive compatibility, bridging the biggest smart contract ecosystem onto IOTA’s feeless base layer. This means that Solidity contracts can easily be ported to IOTA, reducing implementation time and benefitting from the vast ecosystem of Solidity tooling and products available on the market today. This already includes full access to the MetaMask wallet.
Smart contract chains can be deployed without asking for permission, without auctions and at no additional cost or friction. Fees for smart contract execution can be set by the chain owners, which we believe will lead to several chains competing for work against each other, which in turn will lead to the lowest fees possible to execute a smart contract across all available options in the crypto realm. In fact, smart contract chain developers have full flexibility to define their chain and tokenomics. In the future they could even set transaction fees to zero and instead reward validators with their native tokens, thus creating their own economies and massively reducing the entry barriers for their dApp.
Furthermore, work has started on offering full interoperability of tokenized assets on IOTA’s base layer that can be transferred and used in smart contract chains. This will offer the ability to transfer assets between different smart contract chains at no additional cost, completely trustless, and without incurring transaction fees, thanks to the feeless IOTA base layer acting as a trustless atomic bridge. We believe that this particular feature alone will create unprecedented utility for NFT marketplaces and developers in decentralized finance (DeFi) and decentralized exchanges (DEX).
What makes IOTA Smart Contracts so exciting?
IOTA Smart Contracts was built primarily to meet the ever-increasing demand of our industry to push forward with new innovations to lower entry barriers and create an environment to onboard billions of users into our networks. The technical architecture of sharded smart contract chains in combination with a feeless and highly scalable DAG ledger offers a compelling solution to meet market requirements and solve some of the issues facing today’s solutions.
With the IOTA base layer capable of handling well over 1000 transactions per second (TPS) today (and much more in the future), we believe it to be the perfect trust anchor and shared security layer for IOTA Smart Contracts. Thanks to the Tangle’s DAG architecture, we are able to execute smart contracts in parallel and scale horizontally: simply by adding more smart contract chains, more throughput is immediately unlocked. This scalability is enabled while retaining full composability and interoperability of all smart contracts, simply by leveraging IOTA as a trustless, feeless asset bridge.
The flexible development environment makes it possible for smart contract developers to define their own smart contract chains, use their preferred smart contract language and define the right incentives for users and validators alike. All of this is done to empower builders with the right ecosystem to scale to mainstream adoption and remove the major entry barriers we face today.
The highlights of IOTA Smart Contracts are:
- Native Assets (L1 Tokens) for trustless, atomic, and feeless asset bridges. Full interoperability between all smart contracts. This takes the lego blocks concept of DeFi to the next level, with all smart contracts being fully composable.
- Flexible Development environment to build your dApps tailored to your needs. IOTA Smart Contracts enable you to use your preferred language, Smart Contract Virtual Machine, self-defined fees for users, incentives for validators, and committee structure. dApp customization and composability are now possible even on the base network layer.
- Scalability with sharding and the right incentives. IOTA Smart Contracts is a sharded smart contract network, where each smart contract chain is limited by its own scalability and is not hindered by the rest of the network. What makes this exciting is that each smart contract chain can define its own incentives and fees (potentially even feeless), offering new possibilities to get mainstream adoption with dApps.
- Full Ethereum Virtual Machine (EVM) compatibility, making it possible to easily port over smart contracts and tooling from the established Ethereum ecosystem without any modifications or changes. It also offers a great opportunity for IOTA to bridge with Ethereum at a later stage.
- Develop smart contracts in Solidity, Rust, and Go (TinyGo).
The primary objective of the beta release is to help the IOTA team further improve and optimize our solution. We expect there to be bugs and still more improvements to come before a final product release. But with this beta release, we are already encouraging builders to start realizing the opportunities offered by IOTA Smart Contracts. With this release, we begin to unlock the full range of possibilities for developers to build decentralized applications for NFTs, DeFi, Gaming (in particular Play-to-Earn), and the Metaverse.
Released in March this year, the alpha version of IOTA Smart Contracts displayed how smart contracts work on IOTA. Multiple chains could be spawned and their state was anchored to the Layer 1 IOTA Tangle. Developers were able to start writing smart contracts in a solo testing environment but deploying them to a chain was not possible at this time. While this gave us a good overview of the architecture of IOTA Smart Contracts and how smart contracts will work with IOTA, it did not allow us to run custom smart contracts on a public network. That changes with this beta release.
In the beta release, several key elements have been improved and added to turn the beta version into a platform that can be utilized by interested parties looking to develop smart contracts on top of IOTA.
Refactoring and compatibility
- The GoShimmer UTXO ledger, utilized on the IOTA 2.0 DevNet, has been extended with novel features that support IOTA Smart Contract chains, enabling the rotation of validators and introducing new aspects of requesting smart contracts and tokenization.
- The full Wasp node codebase has been refactored to match the latest GoShimmer version, making it fully compatible with the IOTA 2.0 DevNet. Anyone can now run their own IOTA Smart Contract chains anchored to the IOTA 2.0 DevNet or a private GoShimmer-based network.
- Next to this refactor, the temporary consensus algorithm of the alpha version has been replaced with a more robust, modified version of the Honey Badger consensus algorithm. We also included miner extractable value (MEV) prevention measures in the implementation of consensus.
- All parts of IOTA Smart Contracts have had a thorough round of automated testing and profiling for better reliability and performance.
- The database layer used by IOTA Wasp nodes has been replaced with a more performant implementation based on RocksDB.
Experimental Ethereum Virtual Machine (EVM)/Solidity support
Next to the existing Rust and Go-based WASM smart contracts introduced earlier this year, we decided to add support for the Ethereum Virtual Machine (EVM). This allows developers to write Solidity smart contracts inside an EVM chain anchored to the IOTA Tangle. The predominant smart contract ecosystem mainly revolves around EVM-based solutions, which carry a lot of readily available developer expertise, learning materials, and tooling. This made it an obvious choice for supporting a first, additional virtual machine. Our first EVM implementation (which we still deem experimental) is fully compatible with existing smart contracts from the Ethereum ecosystem and will hopefully lower the barrier to entry to build smart contracts on IOTA and more easily integrate with existing ecosystems on other chains.
This experimental support consists of a complete EVM integration fully compatible with existing tooling like MetaMask, Hardhat, and Remix. As a user, you can spawn an EVM chain, create a full supply of the main token of that chain allocated to yourself and deploy contracts that can work with one another. Interaction with Layer 1 IOTA tokens and data is currently not available in this version, but an implementation that makes this possible is planned for a future IOTA Smart Contracts release.
Extended support for smart contract chains by the UTXO ledger
With the IOTA Smart Contracts beta release, we have implemented novel features in the UTXO ledger of GoShimmer. The ledger now provides a new and powerful level of support for IOTA Smart Contracts and other applications running on smart contract chains. It includes support for address aliasing, chain constraints, timelocks, fallback options for on-ledger requests, and many other features.
Most importantly, the new UTXO ledger supports chain identity independent from the distributed private keys needed to operate it. It means that we can now rotate the validators in the committee completely transparently for the chain and its operations.
Also new to this release are the off-ledger requests. While it is possible to interact with smart contracts through regular IOTA transactions on the base layer, it is not always the most efficient and fastest way to do it. Waiting for the message to be propagated and confirmed takes several seconds, and users are limited by the amount of throughput of the IOTA ledger.
In the future, we see on-ledger requests mostly as a way for trustless and atomic asset transfers to take place between smart contracts on different chains and between base layer user wallets and on-chain accounts.
Off-ledger requests add a high throughput alternative to on-ledger atomic transacting by allowing you to interact directly with Wasp nodes as well, without having to issue a base layer transaction. By introducing yourself to the chain and depositing tokens there you will be able to send any requests to the smart contracts on the chain securely and use those tokens for any fees if applicable while interacting with smart contracts on their respective chains directly. This approach reduces the reliance and load on the IOTA base layer and highly improves throughput and the time it takes for a smart contract function to execute. The off-ledger requests also include replay protection.
There is often a lot of boilerplate that needs to be provided while writing smart contracts. Not only is this cumbersome to recreate every time a smart contract is developed, but it can also be error-prone and time-consuming. Therefore, the beta release comes with a new tool to bootstrap new Go (TinyGo) or Rust-based smart contracts (compiled to Wasm binaries). This schema tool takes a schema description as an input (defining what functionality one wishes to use) and creates all the boilerplate code and tests for implementation, allowing the developer to focus on writing the code that matters for the contract. All existing proof of concept smart contracts within the codebase written in Rust or Go (TinyGo) have been redone using the IOTA Smart Contracts Schema tool. The IOTA Foundation will continue using it as a default for any new wasm-based smart contracts from hereon.
The Schema tool will be extended in a later release with even more convenience (like automatically generated client libraries), with the goal of turning a development job from a chore into a pleasure. The documentation for the IOTA Smart Contracts Schema tool can be found here.
To try out the current functionality of IOTA Smart Contracts, it is possible to run your own validator nodes and create a separate chain anchored to a GoShimmer-based network. To make it easier to test without having to go through this specific setup, we have created a public testnet for anyone to use. This network consists of a new GoShimmer network and a committee of several Wasp nodes. To make the barrier to entry for trying out the testnet as low as possible, we decided to set all possible fees to zero. Since we expect that this decision will pollute the chain quite quickly we’ll perform regular, unscheduled resets of this network if needed.
You can find all the details for connecting to the public testnet on the wiki.
Renewed smart contract Proof of Concept: Roulette
To demonstrate some of the changes in this release we decided to renew the Fair Roulette proof of concept and deploy it on a publicly available chain for anyone to test. This demonstration allows the user to deposit DevNet IOTA tokens and gamble with them on a virtual roulette table. This concept uses IOTA Smart Contract’s built-in Distributed Random Number Generator (dRNG) to generate a provable random number that determines the winning number. The code for the roulette demo is available in the Wasp repository and fully compatible with the new IOTA Smart Contracts Schema tool. The demonstration can be tried out as well on our public testnet with a graphical interface running on demo.sc.iota.org. Enjoy!
While we are approaching a stage of usable smart contracts, good documentation is extremely important for anyone who wants to start building on IOTA Smart Contracts. The documentation has therefore been completely rewritten, focusing on developers using IOTA Smart Contracts, with a separate new version of the IOTA Smart Contracts Architecture document describing how IOTA Smart Contracts work in detail. The new documentation can be found here.
Now that all the core components to run programmable smart contracts have been brought to a fully usable state, the IOTA Smart Contract team will focus on several deliverables for the next releases. These deliverables are mainly geared towards bringing IOTA Smart Contracts in a user-friendly and robust way to the IOTA mainnet (a.k.a. Chrysalis).
IOTA Mainnet (Chrysalis) Support
The current IOTA Smart Contracts implementation runs on the experimental next-generation of IOTA 2.0, deployed on the fully decentralized IOTA 2.0 DevNet, powered by GoShimmer nodes. As IOTA Smart Contracts should be available on the IOTA mainnet before switching to the fully decentralized IOTA 2.0 protocol (in a process known as “Coordicide”), an important deliverable for the next release will be to support anchoring to the current IOTA mainnet. The current IOTA mainnet and the fully decentralized future IOTA 2.0 protocol have some fundamental differences, making it difficult to support both at the same time. Our primary focus is therefore to support smart contracts on the current IOTA mainnet using the Hornet node software from now on.
Extended EVM support
The current experimental EVM implementation is completely unaware of the IOTA base layer. The next release will allow the withdrawal and deposit of IOTA tokens from the IOTA base layer (L1) from within EVM-based smart contracts. This will support the seamless transfer of assets between different smart contract chains and the IOTA base layer without requiring a special bridging solution. This functionality will make the EVM integration more useful and will enable scalable, sharded smart contract chains to communicate with each other and exchange assets seamlessly. By spreading traditional smart contract applications/DeFi over different chains using this approach, the high fees for interacting with them can remain a tale of the past.
Commitments to the state of the chain
We plan to implement a special layer of access to the state with commitments to the state of the chain and to its individual partitions with proofs of inclusion.
These features will provide IOTA Smart Contracts with the characteristics necessary for high throughputs/high volume chains like the ones used for Decentralised Finance (DeFi) applications, immutable long term storage of data, and similar use cases:
- Proofs of inclusion of data elements into the state
- Snapshots of the chain’s state
- Selective pruning of the state of the chain or of the contract by the smart contract without losing the consistency of its state
The tokenization framework
While the existing implementation based on IOTA 2.0 already supports and uses digital assets in an early version of the IOTA tokenization framework, this is not yet supported on the current IOTA mainnet (Chrysalis). The respective RFCs are currently being defined and used for the implementation of the tokenization framework on both the future IOTA 2.0 and the current IOTA mainnet (Chrysalis). The tokenization framework will, among other benefits, allow for the creation of tokens and NFTs as native assets on the base layer that can also be used on smart contracts chains and bring some unique functionality to IOTA in combination with smart contracts which are not yet possible on any other existing platforms. We believe that the ability to seamlessly transition between the base layer and smart contract chains anchored in it will offer unprecedented utility for NFTs and DeFi applications, especially when taking into account that IOTA’s base layer is feeless.
Permissionless chain validators
While this release allows anyone to run a chain with its own set of handpicked validators, permissioned setup is not suitable for all use cases. Traditional smart contracts and DeFi applications thrive in permissionless environments and that is currently not part of this beta release. But we are aware of this requirement and are actively researching and working towards a solution to cater to this market as well. We will provide more information on this matter very soon.
We cannot wait for you to try out our new beta. The best way to get started is by following the steps in our documentation, starting with our Wiki, or by checking out the WASP GitHub repository and deploying your first smart contracts. Let us know what you think and feel free to reach out with any questions on our Discord channels.