Skip to main content
The createWaxFoundation() function creates a WAX instance for offline operations. You can build, sign, validate, and serialize transactions without connecting to the Hive network.

When to use createWaxFoundation

Use createWaxFoundation() when you need:
  • Offline transaction building - Construct transactions without network access
  • Transaction signing - Sign transactions with private keys or wallet integrations
  • Cryptographic operations - Generate keys, encrypt data, and calculate signatures
  • Transaction validation - Verify transaction structure before broadcasting
  • Lightweight applications - Minimize bundle size by excluding API functionality
For network operations, use createHiveChain() instead.

Creating a foundation instance

Basic initialization:
With custom chain ID:

Interface reference

The IWaxBaseInterface provides these capabilities:

Building transactions offline

Create a transaction with TaPoS (Transaction as Proof of Stake):
Expiration time formats:

Working with assets

Creating assets

Use precision-aware methods for fractional amounts:
Use satoshi methods for large integer values:

Reading assets

Convert NAI format to readable form:

Asset conversions

Convert between VESTS and HP:
Convert between HIVE and HBD:

Cryptographic operations

Generate brain key

Create a secure brain key for account creation:

Derive keys from password

Generate role-specific keys from a master password:

Calculate public key

Derive a public key from a private key:

Convert raw keys

Convert raw hex keys to WIF format:

Calculations

Calculate manabar

Get current manabar value and percentage:
Calculate full regeneration time:

Calculate HP APR

Calculate current Hive Power APR:

Estimate HBD interest

Calculate HBD savings interest:

Transaction operations

Get transaction ID

Calculate the transaction hash:

Get signature digest

Get the digest for signing:

Validate transaction

Check transaction structure:

Convert to API format

Convert transaction to Hive API format:

Binary serialization

Convert transaction to binary form:

Validation utilities

Validate account names

Check if an account name is valid:

Get impacted accounts

Find accounts affected by an operation:

Configuration

Extend configuration

Create a new instance with different settings:

Memory management

Clean up the WASM instance when done:
Note: You rarely need to call delete() explicitly. JavaScript garbage collection handles cleanup automatically in most cases.

Next steps

Explore more WAX capabilities: