HiveXPH SDKhivexph-sdk
NPM
Developer toolkit for Hive Custom JSON and Hive Engine transactions.

RPC

Raw RPC

Anything the SDK does not wrap is one call away. The raw client shares the same endpoint resolution and failover as every other module, so you can reach every hived and Hivemind API.

Open the RPC playground

Calling a method

TypeScript
const props = await hive.rpc.call("condenser_api.get_dynamic_global_properties", []);

// Positional params (array) — legacy condenser_api style.
const accounts = await hive.rpc.call("condenser_api.get_accounts", [["alice"]]);

// Named params (object) — appbase style used by the modern APIs.
const found = await hive.rpc.call("database_api.find_accounts", { accounts: ["alice"] });

// Abortable.
const controller = new AbortController();
const block = await hive.rpc.call("block_api.get_block", { block_num: 90_000_000 }, {
  signal: controller.signal,
});
hive.rpc.call(method, params?, options?)
ParameterTypeRequiredDescription
methodstringYesFully qualified "namespace.method", e.g. "block_api.get_block_range".
paramsunknown[] | objectNoArray for positional params, object for named params. Defaults to []. Check the method's docs for which it expects.
options.signalAbortSignalNoCancels the in-flight request; AbortError is rethrown untouched.

Note

Node errors are normalized into SDK errors, so failures look the same whether they come from the raw client or a wrapped module: transport problems raise HTTP_ERROR (and trigger failover to the next node), while a JSON-RPC error body raises RPC_ERROR.

The wire format

Hive nodes speak JSON-RPC 2.0 over HTTP POST at the root path of the node. There is no REST-style GET API on hived — every read and write is the same POST with a different method. The SDK sends exactly this body, so anything you can curl you can call:

Shell
curl -s https://api.hive.blog \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "condenser_api.get_dynamic_global_properties",
    "params": [],
    "id": 1
  }'

Older clients also accept the two-argument form {"method":"call","params":["condenser_api","get_accounts",[["alice"]]]}. Prefer the fully qualified namespace.method form shown above — it is what current nodes document and what this SDK uses.

Important

Broadcasting requires a signed transaction. Use hive.issuer, hive.payments or Keychain to produce one — passing an unsigned transaction to network_broadcast_api.broadcast_transaction is rejected by the node.

Built-in helpers

The most common reads already have typed wrappers on hive.rpc — use those before reaching for call.

TypeScript
await hive.rpc.getDynamicGlobalProperties(); // DynamicGlobalProperties
await hive.rpc.getHeadBlockNumber();        // number
await hive.rpc.getBlock(90_000_000);        // HiveBlock | null

hive.rpc.endpoint;          // currently selected node
hive.rpc.fallbackEndpoint;  // failover target
hive.rpc.resetEndpoint();   // drop failure history, re-run Beacon discovery next call

API namespaces

Every method belongs to a namespace, and each namespace is a plugin the node operator must have enabled — a public node may not serve all of them. The full, authoritative method list lives in the Hive API Definitions; the namespaces you will actually use are:

Namespace / served by
ParameterTypeRequiredDescription
condenser_apihivedNoLegacy-compatible catch-all: accounts, blocks, transactions, chain properties, content. Easiest starting point.
database_apihivedNoModern typed reads: find_accounts, list_accounts, get_dynamic_global_properties, find_votes, list_witnesses.
block_apihivedNoget_block, get_block_header, get_block_range — the fastest way to read blocks.
account_history_apihivedNoget_transaction, get_account_history, enum_virtual_ops — used by the SDK transaction reader.
network_broadcast_apihivedNobroadcast_transaction and broadcast_transaction_synchronous for signed transactions.
account_by_key_apihivedNoget_key_references — resolve a public key back to the accounts that use it.
rc_apihivedNofind_rc_accounts, get_resource_params — Resource Credit accounting.
market_history_apihivedNoInternal HIVE/HBD market: get_ticker, get_trade_history, get_market_history.
transaction_status_apihivedNofind_transaction — check whether a broadcast transaction was included.
bridgehivemindNoSocial layer served by Hivemind (not hived): get_ranked_posts, get_discussion, get_profile, get_follow_list.

Note

If a call fails with a “could not find API” style RPC error, the node simply does not run that plugin. Pick another node from PeakD Beacon or the node health playground, and see the plugin & API list for which plugin backs which namespace.

Common methods

A practical starter set — the ones most apps built on this SDK end up calling. Full parameter documentation for each is on developers.hive.io.

TypeScript
// Chain state
await hive.rpc.call("condenser_api.get_dynamic_global_properties", []);
await hive.rpc.call("condenser_api.get_chain_properties", []);
await hive.rpc.call("condenser_api.get_current_median_history_price", []);

// Accounts
await hive.rpc.call("condenser_api.get_accounts", [["alice", "bob"]]);
await hive.rpc.call("database_api.find_accounts", { accounts: ["alice"] });
await hive.rpc.call("account_by_key_api.get_key_references", { keys: ["STM7..."] });
await hive.rpc.call("rc_api.find_rc_accounts", { accounts: ["alice"] });

// Blocks
await hive.rpc.call("block_api.get_block", { block_num: 90000000 });
await hive.rpc.call("block_api.get_block_range", { starting_block_num: 90000000, count: 10 });
await hive.rpc.call("condenser_api.get_block_header", [90000000]);

// Transactions & history
await hive.rpc.call("account_history_api.get_transaction", {
  id: "0000000000000000000000000000000000000000",
  include_reversible: true,
});
await hive.rpc.call("account_history_api.get_account_history", {
  account: "alice",
  start: -1,
  limit: 100,
  include_reversible: true,
});
await hive.rpc.call("transaction_status_api.find_transaction", { transaction_id: "..." });

// Broadcast (transaction must already be signed)
await hive.rpc.call("network_broadcast_api.broadcast_transaction", { trx: signedTransaction });

// Market
await hive.rpc.call("market_history_api.get_ticker", {});

// Social layer (Hivemind)
await hive.rpc.call("bridge.get_ranked_posts", { sort: "trending", tag: "hive", limit: 20 });
await hive.rpc.call("bridge.get_profile", { account: "alice" });

Hive Engine RPC

Layer 2 (Hive Engine) is a different JSON-RPC service — it is not reachable through a hived node. The SDK talks to it internally for token and NFT state; if you need a raw Layer 2 contract read, POST to the sidechain node directly:

Shell
curl -s https://api.hive-engine.com/rpc/contracts \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "find",
    "params": { "contract": "tokens", "table": "balances", "query": { "account": "alice" } },
    "id": 1
  }'

Endpoints: /rpc/contracts (contract state via find / findOne) and /rpc/blockchain (sidechain blocks and transactions). See the Hive Engine contracts wiki.

Reference repositories

There are hundreds of methods across the namespaces and they change with each hardfork, so rather than mirroring them here, go to the source: