Skip to main content
The createHiveChain() function creates a WAX instance with full blockchain connectivity. You can query accounts, fetch blocks, broadcast transactions, and access all Hive APIs.

When to use createHiveChain

Use createHiveChain() when you need:
  • API access - Query blockchain data (accounts, blocks, witnesses, etc.)
  • Transaction broadcasting - Send signed transactions to the network
  • Automatic TaPoS - Create transactions with automatic reference block handling
  • Online validation - Verify transactions against current chain state
  • REST API calls - Access high-performance REST endpoints
For offline operations, use createWaxFoundation() instead.

Creating a chain instance

Basic initialization:
With custom configuration:

Interface reference

The IHiveChainInterface extends IWaxBaseInterface with:

Creating transactions

Create transactions with automatic TaPoS:
With custom expiration:

Broadcasting transactions

Send a signed transaction to the network:
Broadcast with automatic validation:

API access

The api property provides access to all Hive JSON-RPC APIs:

database_api

Query blockchain data:

block_api

Fetch block data:

network_broadcast_api

Broadcast transactions:

rc_api

Query resource credits:

account_by_key_api

Find accounts by public key:

REST API access

The restApi property provides high-performance REST endpoints:
Configure endpoint URLs:

Extending APIs

Extend JSON-RPC API

Add custom API methods:

Extend REST API

Add custom REST endpoints:

Request/response interception

Intercept API calls for logging or modification:

Manabar calculations

Calculate manabar values with live chain data:

Configuration management

Change endpoint URL

Update the API endpoint at runtime:

Extend configuration

Create a new instance with modified settings:

Error handling

Handle API errors gracefully:

Complete example

A full workflow using createHiveChain():

Next steps

Explore more capabilities: