Expand description
§PIVX RPC Client
A Rust client library for interacting with PIVX Core’s JSON-RPC interface.
PIVX (Private Instant Verified Transaction) is a privacy-focused proof-of-stake cryptocurrency. This library provides type-safe bindings to the PIVX Core RPC API, enabling developers to build wallets, explorers, and other blockchain applications.
§Features
- Type-safe RPC calls: All RPC methods return properly typed Rust structures
- PIVX-specific support: Includes PoS staking, masternodes, and Sapling shield transactions
- Comprehensive coverage: Supports block queries, transactions, wallet operations, and more
§Quick Start
use pivx_rpc_rs::PivxRpcClient;
// Create a client connected to local PIVX Core node
let client = PivxRpcClient::new(
"http://127.0.0.1:51473".to_string(),
Some("rpcuser".to_string()),
Some("rpcpassword".to_string()),
3, // max_retries
10, // retry_delay_ms
1000 // timeout_ms
);
// Get the current block count
let block_count = client.getblockcount()?;
println!("Current block height: {}", block_count);
// Get the best block hash
let best_hash = client.getbestblockhash()?;
println!("Best block hash: {}", best_hash);
// Get full block details
let block = client.getblock(best_hash)?;
println!("Block has {} transactions", block.tx.len());§PIVX Core Compatibility
This library is tested against PIVX Core 5.3 through 5.6. Some RPCs may not be available in older versions. Always check your PIVX Core version compatibility.
§Examples
See the examples/ directory for complete usage examples including:
- Basic blockchain queries
- Masternode operations
- Staking status checks
§Note on Error Handling
This library uses modern error handling with typed errors from
the throttled_json_rpc crate, providing clear and actionable error
messages for all RPC operations.
Modules§
Structs§
- Batcher
Pair - Block
- Block header information from PIVX Core.
- Block
Chain Info - Blockchain state and consensus information.
- Budget
Info - Budget proposal information.
- Cold
Utxo - Cold staking UTXO.
- Full
Block - Complete block data including all transactions.
- GetInfo
- General node and wallet information.
- GetRaw
Transaction Info - Detailed raw transaction information.
- List
Cold Utxos - List of cold staking UTXOs.
- Masternode
Count - Masternode count statistics.
- Masternode
List - Masternode information.
- MemPool
Info - Memory pool information.
- MemPool
Tx - Mempool transaction details.
- Money
Supply - PIVX money supply information.
- Pivx
RpcClient - Pivx
Status - PIVX staking status.
- Reject
- Softfork rejection status.
- ReqBatcher
- Script
PubKey - Script public key (locking script).
- Script
Sig - Script signature (unlocking script).
- Shield
Pool Value - Sapling shield pool value statistics.
- Signed
Tx - Signed transaction result.
- Softfork
- Softfork deployment information.
- Tip
- Blockchain tip information.
- Transaction
- PIVX transaction data.
- Transaction
Detail - Transaction detail for wallet transactions.
- TxInput
- Transaction input for raw transaction creation.
- TxOut
- Unspent transaction output details.
- TxOut
SetInfo - UTXO set statistics.
- TxOutput
- Transaction output for signing.
- Upgrade
- Protocol upgrade activation details.
- Upgrades
- PIVX network protocol upgrades status.
- VShield
Output - Sapling shield output description.
- VShield
Spend - Sapling shield spend description.
- VinCoinbase
- Coinbase transaction input (block reward).
- VinTx
- Transaction input referencing a previous output.
- Vout
- Transaction output.
Enums§
- GetTx
OutReply - Response from
gettxoutRPC. - RawMem
Pool - Vin
Traits§
Type Aliases§
- Serialized
Data - Raw hex-encoded blockchain data (blocks, transactions, etc.).