Skip to content

Choosing a language

All five targets produce the same kind of artifact (a Hive Bytecode .hbc) and run on the same nodes. They differ in size, gas per call and what they can be used for.

Rust Go (TinyGo) TypeScript (AssemblyScript) JavaScript / TypeScript (engine) Python
SDK hivekit-rs hivekit-go hivekit-js, .ts default hivekit-js, .js or --target js hivekit
Handler shape #[hive_export] fn(T) -> R with serde types Define, DefineJSON, DefineRaw (input: string): string (input, ctx) => any (JSON in/out) @hive.define on fn(input) / fn(ctx)
Typical module.wasm 100–180 KB 400–500 KB a few KB ~3.4 MB ~9.6 MiB
Small call (measured) ~10–20k gas ~90–100k gas ~12k gas ~2.5 M gas ~3.5–5 M gas
JSON serde encoding/json none built in (parse by hand) native json module
Third-party code crates that compile to wasm32-unknown-unknown without WASI (e.g. k256, ed25519-dalek) pure-Go packages TinyGo supports (e.g. crypto/ed25519) single file, hivekit import only bundle into one source file built-in deterministic modules only
Native unit tests hivekit::testing mock host hivekit.Mock, InvokeLocal via hivec run hive.invoke in Node hive.invoke_local
Committee worker (mining project) Yes (when it imports no storage / hive.call) Yes Yes No (runtime always imports storage) No (runtime always imports storage)
Best for Production workers, crypto, heavy compute Teams that know Go Tiny, cheap modules Prototypes, app logic on validators Prototypes, scripts on validators
  • Mining project workers: Rust first (smallest gas for real work, best crypto libraries), then Go or AssemblyScript. Measured on the same ed25519 workload, Rust used 12.6 M gas and TinyGo 73.7 M; see DePIN & IoT telemetry.
  • Stateful modules on validators (/v1/execute): any language. JavaScript and Python cost a few million gas per call, which is fine for low-volume logic; always pass a gas_limit.
  • Mixing languages: modules call each other by address regardless of language, so you can keep heavy code in Rust and glue in JavaScript. Composition