Crate pivx_rpc_rs

Crate pivx_rpc_rs 

Source
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§

reply

Structs§

BatcherPair
Block
Block header information from PIVX Core.
BlockChainInfo
Blockchain state and consensus information.
BudgetInfo
Budget proposal information.
ColdUtxo
Cold staking UTXO.
FullBlock
Complete block data including all transactions.
GetInfo
General node and wallet information.
GetRawTransactionInfo
Detailed raw transaction information.
ListColdUtxos
List of cold staking UTXOs.
MasternodeCount
Masternode count statistics.
MasternodeList
Masternode information.
MemPoolInfo
Memory pool information.
MemPoolTx
Mempool transaction details.
MoneySupply
PIVX money supply information.
PivxRpcClient
PivxStatus
PIVX staking status.
Reject
Softfork rejection status.
ReqBatcher
ScriptPubKey
Script public key (locking script).
ScriptSig
Script signature (unlocking script).
ShieldPoolValue
Sapling shield pool value statistics.
SignedTx
Signed transaction result.
Softfork
Softfork deployment information.
Tip
Blockchain tip information.
Transaction
PIVX transaction data.
TransactionDetail
Transaction detail for wallet transactions.
TxInput
Transaction input for raw transaction creation.
TxOut
Unspent transaction output details.
TxOutSetInfo
UTXO set statistics.
TxOutput
Transaction output for signing.
Upgrade
Protocol upgrade activation details.
Upgrades
PIVX network protocol upgrades status.
VShieldOutput
Sapling shield output description.
VShieldSpend
Sapling shield spend description.
VinCoinbase
Coinbase transaction input (block reward).
VinTx
Transaction input referencing a previous output.
Vout
Transaction output.

Enums§

GetTxOutReply
Response from gettxout RPC.
RawMemPool
Vin

Traits§

BatchRequest

Type Aliases§

SerializedData
Raw hex-encoded blockchain data (blocks, transactions, etc.).