Documentation 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.
Overview
Makes JSON-RPC calls with quorum consensus verification. The function cross-checks results from multiple nodes before returning, ensuring data consistency and reliability for critical operations. This is particularly useful for operations where data integrity is crucial, such as checking balances before transfers or verifying transaction status.Function Signature
Parameters
The API method name (e.g.,
'condenser_api.get_accounts', 'condenser_api.get_dynamic_global_properties')Parameters for the API method as an array or object. Most Hive API methods expect an array of parameters.
The number of nodes that must return the same result to reach consensus. Default is 2 (recommended minimum).Must be less than or equal to the total number of configured nodes.
Return Type
Returns a Promise that resolves to the API response once consensus is reached. The response type can be specified using TypeScript generics.
How It Works
The quorum consensus mechanism:- Random Node Selection: Nodes are randomly shuffled for better security
- Parallel Batch Calls: Makes parallel calls to
quorumnumber of nodes - Result Comparison: Compares results using JSON serialization
- Consensus Check: Returns when
quorumnodes agree on the result - Retry Logic: If consensus fails, tries the next batch of nodes
- Error on Failure: Throws error if all nodes are exhausted without reaching consensus
When to Use callWithQuorum
UsecallWithQuorum for critical operations where data consistency is paramount:
- Financial Operations: Checking balances before transfers
- Transaction Verification: Confirming transaction inclusion
- Critical State Queries: Getting account recovery status
- Security-Sensitive Data: Verifying account authorities
callRPC instead for better performance.
Examples
Basic Usage with Default Quorum
Verify Account Balance Before Transfer
Check Transaction Confirmation
Get Dynamic Global Properties with Consensus
Higher Quorum for Critical Operations
With TypeScript Type Safety
Error Handling
Performance Considerations
- Slower than callRPC: Makes multiple parallel calls to reach consensus
- Network Overhead: Requires more bandwidth and API calls
- Best for Critical Data: Use only when data consistency is crucial
- Quorum Size: Higher quorum = more reliability but slower response
Comparison with callRPC
Behavior
- Randomly shuffles nodes for better security distribution
- Makes parallel calls to multiple nodes in batches
- Compares results using JSON string comparison
- Returns first result that reaches quorum threshold
- Automatically retries with new nodes if consensus fails
- Throws error if quorum exceeds available nodes
- Each node gets one retry attempt on network failure
Configuration Requirements
See Also
- callRPC - Standard JSON-RPC calls
- callREST - REST API calls
- Configuration - Configure nodes for quorum