Introduction to the Wasm VM for ISC
The Wasm VM is in experimental state, showcasing ISC's "VM plugin" architecture.
Experiment but avoid using it for production applications; opt for EVM.
Smart Contracts are currently only compatible with the Stardust protocol and therefore only compatible with the Shimmer and Public Testnet networks.
IOTA Smart Contracts (ISC) provide a sandboxed environment through an API, facilitating secure and deterministic interactions with ISC functions. This API supports any Virtual Machine (VM) aiming to build a system for smart contract code execution on ISC.
We offer a VM example utilizing WebAssembly (Wasm) as a compilation target, facilitated by the open-source Wasmtime runtime. This setup encourages dynamic smart contract operations compiled to Wasm code, promoting security and adaptability with different programming languages.
The Wasm VM operates with self-contained WasmLib
libraries linked to individual Wasm codes, optimizing the ISC sandbox functionality and smart contract state storage access.
Supported Functionalities
The ISC sandbox environment offers:
- Smart contract metadata and state data access
- Request data retrieval for function calls
- Token management within the contract
- Utility functions from the host
- Smooth initiation of other smart contract functions
- Logging facility
Supported Languages
The WasmLib started with Rust support, expanding to include Go and TypeScript with the help of respective Wasm code generators:
Language | Wasm code generator |
---|---|
Go | TinyGo |
Rust | wasm-pack |
TypeScript | AssemblyScript |
These generators maintain a common subset of their host language, aiming for a unified coding style to simplify the initiation into smart contract creation, welcoming developers with a C-style language background to quickly adapt.