Summary: Mesmo – Exporting the Cardano Java SDK to Python, Go, Rust, and JavaScript
In this edition of the Developers Office Hour, a Senior Software Architect at the Cardano Foundation presents Mesmo, a native compilation pipeline that takes the Cardano Client Lib (the primary Java SDK for Cardano) and exports it as a native library for Python, Go, Rust, and JavaScript/TypeScript.
The Purpose: Filling the SDK Roadmap Gap
Cardano features a rich ecosystem of native language SDKs. However, protocol hard forks and rapid feature additions often create temporary backlog gaps across individual language libraries. Rather than replacing existing native SDKs, Mesmo is designed as a fallback to complement them, supplying missing feature coverage—such as newly released governance actions or transaction builder specs—without waiting for native language maintainers to catch up.
Under the Hood: GraalVM Native Image and C ABI
Mesmo achieves language portability using GraalVM Native Image technology. GraalVM compiles the Java-based Cardano Client Lib into platform-specific shared native binaries (such as .so, .dylib, or .dll) with a plain C Foreign Function Interface (C ABI). This completely removes the Java Virtual Machine (JVM) requirement at runtime while enabling local building, transaction hashing, signing, and Plutus cost calculation.
Core Capabilities and Architecture
Mesmo provides comprehensive transaction and cryptographic capabilities:
- YAML Transaction Plans (TX Plan): Transactions are expressed declaratively using intent-based YAML strings, supporting all standard, Plutus, and governance transaction types.
- Offline Plutus Costing: Execution units (memory and CPU) are computed completely offline without side effects using an embedded Scalus evaluator ``.
- Pluggable Interfaces: Chain data retrieval (such as UTXO queries and protocol parameters) is abstracted via pluggable interfaces for indexers like Yaci Store or Blockfrost ``.
- Stateless Execution: The Mesmo core library operates entirely statelessly and never opens network sockets or submits transactions directly, leaving network calls to the host language application.
Language Support and Trade-Offs
Mesmo provides native wrapper packages for Python, Rust, Bun (JavaScript/TypeScript), and Go (via CGo) ``. Node.js is currently unsupported due to FFI limitations. Main trade-offs include a relatively large binary footprint (~60 MB), making it ideal for server-side microservices rather than lightweight front-end web clients. Platform support covers Linux (x86_64 and ARM64) and Windows, with ongoing research into WebAssembly (WASM) compilation to expand cross-platform coverage.
Top Five Q&A (FAQ) about Mesmo
Question 1: What is Mesmo and what problem does it address for developers?
Answer: Mesmo is an export pipeline that compiles the Java-based Cardano Client Lib into native shared libraries with a C ABI. It provides Python, Go, Rust, and JavaScript developers with an immediate fallback when their native language SDKs lack support for newly released protocol features or complex transaction types.
Question 2: How does Mesmo eliminate the need for a Java Virtual Machine (JVM) at runtime?
Answer: Mesmo utilizes GraalVM Native Image technology to ahead-of-time (AOT) compile Java code into standalone, native shared binary libraries. The resulting binaries communicate with host languages via a standard C ABI, running natively on the operating system without any JVM runtime dependency.
Question 3: How are transactions constructed and evaluated inside Mesmo?
Answer: Transactions are defined declaratively using YAML transaction plans (TX Plan). For smart contracts, Plutus execution units (CPU and memory) are computed locally and offline using an embedded Scalus virtual machine evaluator, eliminating network latency during transaction building.
Question 4: Does Mesmo interact with the blockchain network directly?
Answer: No. Mesmo is entirely stateless and offline, opening zero network sockets. Chain data (like UTXOs and protocol parameters) is supplied through pluggable host-language indexers (e.g., Yaci Store or Blockfrost), and final transaction submission is handled by the calling application.
Question 5: What are the main limitations and supported runtime environments for Mesmo?
Answer: Mesmo produces a ~60 MB binary file, making it best suited for backend server applications rather than mobile or browser environments. It supports Linux (Intel and ARM) and Windows, and works with Python, Go, Rust, and Bun, but does not support Node.js due to FFI restrictions.