From 203d6b84fae7ceee6d128a57a3d28cc68e2454b7 Mon Sep 17 00:00:00 2001 From: Shannon Appelcline <shannon.appelcline@gmail.com> Date: Tue, 8 Sep 2020 12:02:19 -1000 Subject: [PATCH] Create 17_5_main-getinfo.rs --- src/17_5_main-getinfo.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/17_5_main-getinfo.rs diff --git a/src/17_5_main-getinfo.rs b/src/17_5_main-getinfo.rs new file mode 100644 index 0000000..2c01dfb --- /dev/null +++ b/src/17_5_main-getinfo.rs @@ -0,0 +1,20 @@ +use bitcoincore_rpc::{Auth, Client, RpcApi}; + +fn main() { + let rpc = Client::new( + "http://localhost:18332".to_string(), + Auth::UserPass("StandUp".to_string(), "6305f1b2dbb3bc5a16cd0f4aac7e1eba" +.to_string()), + ) + .unwrap(); + + let mining_info = rpc.get_mining_info().unwrap(); + println!("{:#?}", mining_info); + + let hash = rpc.get_best_block_hash().unwrap(); + let block = rpc.get_block(&hash).unwrap(); + println!("{:?}", block); + + let _ = rpc.stop().unwrap(); + +}