Transactions are the fundamental unit of interaction with the Hive blockchain. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mahdiyari/hive-tx/llms.txt
Use this file to discover all available pages before exploring further.
Transaction class provides a complete lifecycle for creating, signing, and broadcasting operations.
Transaction Lifecycle
Every transaction follows this sequence:- Create - Initialize a transaction with default or custom expiration
- Add Operations - Append one or more operations to execute
- Sign - Sign with one or more private keys
- Broadcast - Submit to the Hive network
Transaction Structure
Under the hood, a Hive transaction contains these fields:ISO 8601 timestamp when the transaction expires (max 24 hours from creation)
Lower 16 bits of reference block number (prevents replay attacks)
Reference block prefix derived from head block ID
Array of operations to execute, each formatted as
[operationName, operationBody]Optional protocol extensions (rarely used)
Array of hex-encoded signatures (added when you call
sign())The
ref_block_num and ref_block_prefix are automatically set from the current head block when you call addOperation(). This ties your transaction to recent blockchain state and prevents replay attacks.Creating Transactions
You can create a transaction in two ways:With Default Expiration
By default, transactions expire 60 seconds after creation:With Custom Expiration
Set a custom expiration in milliseconds (max 86400000ms = 24 hours):Transaction Digest and ID
The transaction digest is a SHA256 hash used for signing. The transaction ID is derived from this digest.Getting the Digest
src/Transaction.ts:153
- Chain ID - Hive mainnet identifier (
beeab0de...) - Serialized Transaction - Binary representation of the transaction
Multi-Signature Transactions
Sign with multiple keys by passing an array or callingsign() multiple times:
Sign All at Once
Sign Incrementally
Broadcasting Transactions
Thebroadcast() method submits your signed transaction to the Hive network.
Quick Broadcast
Return immediately after submission (status may be unknown):src/Transaction.ts:106
Confirmed Broadcast
Wait for the transaction to be included in an irreversible block:unknown- Broadcast succeeded but status not checkedwithin_mempool- Waiting in transaction poolwithin_reversible_block- In a block but not yet irreversiblewithin_irreversible_block- Permanently confirmedexpired_reversible- Expired before becoming irreversibleexpired_irreversible- Expired after being irreversibletoo_old- Transaction is too old to check
Checking Transaction Status
Manually check a transaction’s status usingcheckStatus():
src/Transaction.ts:193
Adding External Signatures
If you sign transactions with external tools (hardware wallets, etc.), add signatures manually:src/Transaction.ts:178
Signatures must be exactly 130 hex characters (65 bytes). This includes the recovery byte and the 64-byte ECDSA signature.
Error Handling
Common errors and solutions:No Operations
No Signatures
Duplicate Transaction
The SDK automatically handles duplicate transaction errors when retrying broadcasts.Complete Example
Here’s a complete transaction workflow:Next Steps
Operations
Learn about all available Hive operations
Keys & Signatures
Understand cryptographic operations
Transaction API
Full API reference for Transaction class
Voting Guide
Build a voting application