Use
Configuration
The config object sets the nodes, timeout, retries, chain id, and address prefix.
import { config } from 'hive-tx'
console.log(config.nodes) // the default public JSON-RPC nodes
config.nodes = ['https://api.hive.blog', 'https://api.deathwing.me']
config.restNodes = ['https://rpc.mahdiyari.info']
config.timeout = 5_000
config.retry = 3
| Field | Type | Default |
|---|---|---|
nodes | URL array | Public JSON-RPC nodes, maintained with each release |
restNodes | URL array, no trailing slash | Public REST nodes, maintained with each release |
timeout | milliseconds | 10000 |
retry | count | 8 |
address_prefix | string | STM |
chain_id | 64 hex characters | Hive mainnet: beeab0de00…00 |
Calls go to the current node and move down the list on failure, wrapping around at the end; they stay on the node that worked. Put your preferred node first. For a testnet, set chain_id, address_prefix, and nodes to the testnet's values; changes apply to the next call and signature.
Caution
config is global to the process. Set it once at startup; changing config.nodes while calls are in flight can send them to the wrong node.