hive-rs
A Rust client library for the Hive blockchain with API coverage modeled after dhive.
This crate gives you:
- Strongly typed request/response APIs for common Hive namespaces
- Signing and transaction serialization utilities
- Multi-node failover transport
- Helpers for RC estimation, assets, keys, memo encryption, and block streaming
Table Of Contents
- Installation
- Quick Start
- Client Configuration
- API Modules
- Transactions And Signing
- Streaming Blocks And Operations
- Raw RPC Calls
- Errors And Reliability
- Security Notes
- Smoke Test App
- Development
Installation
[]
= "0.1"
= { = "1", = ["macros", "rt-multi-thread"] }
TLS Features
- Default:
rustls - Optional:
native-tls
[]
= { = "0.1", = false, = ["native-tls"] }
Network Feature
testnet: switches default chain id inClientOptions::default()
Quick Start
use ;
async
Client Configuration
Use one or more node URLs. The transport rotates across nodes for retryable transport failures.
use Duration;
use BackoffStrategy;
use ;
async
API Modules
Client exposes namespace clients directly:
client.database(condenser_api)client.broadcast(condenser_apibroadcast helpers)client.blockchain(block/head helpers + streams)client.hivemind(bridgemethods)client.rc(rc_apimethods + RC cost estimator)client.keys(account_by_key_apiwith legacy fallback)client.transaction(transaction_status_apiwith condenser fallback)
Example combining account lookup + key references:
use ;
async
Transactions And Signing
High-level transfer
use ;
async
Build/sign manually
use ;
async
Streaming Blocks And Operations
use StreamExt;
use ;
use ;
async
Raw RPC Calls
If you need a method that is not wrapped yet, use Client::call.
use json;
use ;
async
Errors And Reliability
The crate uses HiveError for all fallible operations.
Common variants:
HiveError::Rpc { code, message, data }HiveError::Transport(...)HiveError::TimeoutHiveError::Serialization(...)HiveError::AllNodesFailed
Reliability behavior:
- Failover retries only retryable transport failures (not RPC/serialization logic errors).
AccountByKeyApi::get_key_referencesfalls back tocondenser_api.get_key_referenceswhen appbase format is unsupported by a node.TransactionStatusApi::find_transactionfalls back tocondenser_api.get_transactionwhentransaction_status_apiis unavailable.BroadcastApi::sendattempts synchronous broadcast first, then falls back to async broadcast plus transaction lookup for confirmation on nodes that do not support reliable synchronous responses.
Security Notes
- Never commit private keys.
- Use environment variables or a secrets manager for key material.
- Prefer dedicated active/posting keys with least privilege.
- Consider running your own trusted node for production traffic.
Smoke Test App
A runnable smoke-test client lives in smoke-test-app/ and can validate both read and authenticated flows.
For authenticated checks, create smoke-test-app/.env (already gitignored):
HIVE_NODE=https://api.hive.blog
HIVE_USERNAME=beggars
HIVE_ACTIVE_KEY=<ACTIVE_WIF>
HIVE_EXTENDED_CHECKS=1
HIVE_BROADCAST_SELF_TRANSFER=0
Set HIVE_BROADCAST_SELF_TRANSFER=1 to submit a real self-transfer test transaction.
Development
Current status:
- Unit tests cover serialization, crypto, API routing, failover behavior, fallback behavior, and RC calculations.
- The smoke-test app validates real-node integration for end-to-end sanity checks.