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
| File | Purpose |
|---|---|
foundation.cpp/hpp | Core transaction and cryptographic operations |
api_converter.hpp | Converts between API JSON and protocol buffers |
proto_converter.hpp | Protocol buffer conversion utilities |
signing_keys_collector.cpp/hpp | Extracts required signing keys from transactions |
binary_view_helper.cpp/hpp | Binary serialization metadata |
operations_fwd.hpp | Forward declarations for all operations |
val_protocol.hpp | Validation rules for protocol operations |
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
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
Python
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