mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
Create 17_5_main-getinfo.rs
This commit is contained in:
parent
9e10c7eb2f
commit
203d6b84fa
20
src/17_5_main-getinfo.rs
Normal file
20
src/17_5_main-getinfo.rs
Normal file
@ -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();
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user