Dual-language design
WAX provides Hive blockchain protocol features to both Python and TypeScript/JavaScript through a shared C++ core. This architecture allows you to work with the same blockchain functionality in your preferred language while maintaining consistency and performance.Language bindings
TypeScript/JavaScript
The TypeScript implementation uses WebAssembly (WASM) compiled from C++ via Emscripten:- Package:
@hiveio/waxpublished to npm - Location:
ts/wasm/lib/in the source tree - Build target: WASM artifacts in
ts/wasm/build_wasm/ - Design principle: Minimal bundle size for web applications
Python
The Python implementation uses Cython bindings compiled to native.so modules:
- Package:
hiveio-waxpublished to PyPI - Location:
python/wax/in the source tree - Bridge:
cpp_python_bridge.pyxprovides Cython bindings - Requirements: Python 3.14+
C++ core
Thecore/ subdirectory contains the common C++ implementation shared by both language bindings:
Key components
Core files
Protocol buffers
WAX uses Protocol Buffers (protobuf) as the canonical format for representing blockchain operations and types. These definitions come from the Hive blockchain source in thehive/ submodule:
Source location: hive/libraries/protocol/proto/
Generation process
1
TypeScript generation
Protocol buffers are compiled to TypeScript using
ts-proto:2
Python generation
Protocol buffers are compiled to Python using
grpcio-tools:Example operation definitions
Entry points
Both language implementations provide two main entry points that separate offline and online functionality:Offline operations (Foundation)
- TypeScript
- Python
- TypeScript:
ts/wasm/lib/detailed/base.ts - Python:
python/wax/wax_factory.py
Online operations (Chain)
- TypeScript
- Python
- TypeScript:
ts/wasm/lib/detailed/chain.ts - Python:
python/wax/_private/chain_api.py
Project structure
The repository is organized to maintain separation between language implementations while sharing the core:Build process
TypeScript
1
Compile protobuf definitions
2
Compile C++ to WASM
3
Build TypeScript
Python
1
Compile protobuf definitions
2
Compile Cython bindings
3
Build wheel
Performance characteristics
TypeScript/WASM
- Near-native performance in browsers
- Small bundle size (optimized for web)
- Instant startup
- Memory-efficient
Python/Cython
- Native C++ performance
- Direct memory access
- Minimal overhead
- Ideal for server applications
Next steps
Transactions
Learn how transactions work in WAX
Operations
Understand operations and protocol buffers
Signing
Explore transaction signing and wallets
Quickstart
Build your first application