Skip to main content

Overview

The config object allows you to customize the behavior of the hive-tx library, including API node endpoints, timeout settings, retry attempts, and blockchain-specific parameters.

Configuration Object

string[]
Array of Hive API node endpoints for load balancing and failover. The library will attempt to connect to these nodes in order when making API calls.Default:
string[]
Array of Hive API node endpoints that support REST APIs. Note: URLs should not include a trailing slash.Default:
string
The Hive blockchain chain ID used for transaction signing and verification.Default: 'beeab0de00000000000000000000000000000000000000000000000000000000' (Mainnet)
string
Address prefix used for public key formatting.Default: 'STM' (for Hive mainnet)
number
Timeout in milliseconds for individual API calls. If an API call takes longer than this duration, it will be aborted and potentially retried.Default: 10000 (10 seconds)
number
Number of retry attempts for failed API calls before throwing an error. The library will try different nodes from the nodes array on each retry.Default: 8

Usage Examples

Modify Timeout and Retry Settings

Use Custom Nodes

Configure for Testnet

Optimize for Performance

Configure REST Nodes

Important Notes

  • Configuration changes affect all subsequent API calls and transactions
  • Always modify the configuration before making any API calls or creating transactions
  • The library will automatically cycle through available nodes if one fails
  • REST nodes must support the Hive REST API format (without trailing slash)
  • For production applications, consider using multiple reliable nodes for better failover