Skip to main content

Crate hivecomb

Crate hivecomb 

Source
Expand description

§hivecomb

A Rust library for the Hive blockchain: key handling, Graphene binary serialization, transaction construction, signing and RPC.

hivecomb is a from-scratch reimplementation, in Rust, of the Python library beem by Holger Nahrstaedt, which in turn descends from python-bitshares and python-graphenelib by Fabian Schuh. See CREDITS.md for the full lineage — the design, the wire format and the great majority of the domain knowledge encoded here are theirs.

The port exists because beem stopped being maintained at version 0.24.26 (its classifiers stop at Python 3.9), because several defects in it are security- rather than convenience-relevant, and because Hive has added operations since that beem cannot serialize at all. Every such defect is documented at the point in the code that fixes it, and collected in SECURITY_FINDINGS.md.

§Design rules

  • No silent fallbacks. Where beem swallowed an error and continued with a default — a chain id, an ECDSA backend, a base58 character — hivecomb returns an error. A silent fallback in a signing path produces a valid-looking signature over the wrong bytes, which is the worst possible failure mode.
  • Signing never needs the network. The chain id is a compile-time constant and the block reference is cached with an explicit staleness bound, so producing a signature is a pure CPU operation.
  • Secrets do not render, and do not linger. See keys.
  • Unknown input is refused, never defaulted.

Re-exports§

pub use asset::Amount;
pub use authority::Authority;
pub use authority::AuthorityCheck;
pub use chains::Chain;
pub use chains::ChainId;
pub use error::Error;
pub use error::Result;
pub use keys::PrivateKey;
pub use keys::PublicKey;
pub use operations::AnyOperation;
pub use operations::Operation;
pub use operations::OperationId;
pub use operations::VirtualOperation;
pub use reader::GrapheneDeserialize;
pub use reader::Reader;
pub use sign::Signature;
pub use tapos::TaposCache;
pub use transaction::BlockRef;
pub use transaction::SignedTransaction;
pub use transaction::Transaction;
pub use types::GrapheneSerialize;

Modules§

asset
Assets and amounts.
authority
Authorities: the weighted key/account sets behind Hive’s owner, active and posting permissions.
base58
Base58 with the two checksum schemes Graphene uses.
bip32
BIP-32 hierarchical deterministic keys, and the derivation paths Hive wallets use.
bip38
BIP-38 encrypted private keys, in the Graphene variant.
bip39
BIP-39 mnemonic seed phrases.
chain
Chain state: the objects a node returns.
chains
Chain parameters: chain ids, address prefixes and native assets.
error
Error type for hivecomb.
keys
Key handling: WIF private keys, compressed public keys, and the password/brain-key derivations Hive inherited from Graphene.
memo
Encrypted memos.
operations
See the note on chain for why the fields here are not individually documented. Hive operations: the things a transaction contains.
reader
Reading the Graphene wire format.
rpc
JSON-RPC access to Hive nodes.
sign
ECDSA signing over secp256k1, in the compact recoverable form Graphene requires.
tapos
The TaPoS cache: a block reference kept fresh in the background so that signing never waits on the network.
transaction
Transactions: building, digesting and signing.
types
Graphene wire-format primitives.
wallet
An encrypted key store.