forked from rust-bitcoin/rust-bitcoincore-rpc
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mayoreee/master
dashcore masternode RPC support
- Loading branch information
Showing
15 changed files
with
303 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
extern crate dashcore_rpc; | ||
|
||
use dashcore_rpc::{Auth, Client, RpcApi}; | ||
|
||
fn main() { | ||
let rpc = Client::new( | ||
"localhost:19998".to_string(), | ||
Auth::UserPass("dashrpc".to_string(), "rpcpassword".to_string()), | ||
) | ||
.unwrap(); | ||
|
||
// Get Dash network info | ||
let network_info = rpc.get_network_info().unwrap(); | ||
println!("\nDash network info: \n{:?}", network_info); | ||
|
||
// Get best block hash | ||
let best_block_hash = rpc.get_best_block_hash().unwrap(); | ||
println!("\n\nBest block hash: \n{}", best_block_hash); | ||
|
||
// Get block count | ||
let block_count = rpc.get_block_count().unwrap(); | ||
println!("\n\nBlock count: \n{}", block_count); | ||
|
||
// Get block hash (for the a specified block height) | ||
let block_hash = rpc.get_block_hash(block_count).unwrap(); | ||
println!("\n\nBlock hash at block height \n{}: {}", block_count, block_hash); | ||
|
||
// Get masternode count | ||
let masternode_count = rpc.get_masternode_count().unwrap(); | ||
println!("\n\nMasternode Count: \n{:?}", masternode_count); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.