Weaving the Cosmos: WASM-Powered Interchain Communication for AI Enabled Smart Contracts
Rabimba Karanjai, Lei Xu, Weidong Shi
TL;DR
This work addresses the challenge of running AI/LLM inferences directly on-chain to augment smart contracts. It proposes WICAS, a framework that leverages CosmWASM, WASMEdge, and WASM-based runtimes to deploy model inferences across blockchain nodes, with cross-node determinism strategies. Key contributions include demonstrating feasibility on commodity hardware, model and inference-engine portability, and security considerations such as mitigating GPU memory leakage and exploring TEEs. The results suggest that on-chain AI can expand smart-contract use cases (DeFi, governance, AI agents) while preserving performance and security, with future work on WebGPU-native implementations and streaming model weights.
Abstract
In this era, significant transformations in industries and tool utilization are driven by AI/Large Language Models (LLMs) and advancements in Machine Learning. There's a growing emphasis on Machine Learning Operations(MLOps) for managing and deploying these AI models. Concurrently, the imperative for richer smart contracts and on-chain computation is escalating. Our paper introduces an innovative framework that integrates blockchain technology, particularly the Cosmos SDK, to facilitate on-chain AI inferences. This system, built on WebAssembly (WASM), enables interchain communication and deployment of WASM modules executing AI inferences across multiple blockchain nodes. We critically assess the framework from feasibility, scalability, and model security, with a special focus on its portability and engine-model agnostic deployment. The capability to support AI on-chain may enhance and expand the scope of smart contracts, and as a result enable new use cases and applications.
