From ed27c34c1a84a47085cc9b11b18a7680f5b2993e Mon Sep 17 00:00:00 2001 From: Shannon Appelcline Date: Wed, 2 Sep 2020 11:37:05 -1000 Subject: [PATCH] Create 17_2_App-getinfo.java --- src/17_2_App-getinfo.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/17_2_App-getinfo.java diff --git a/src/17_2_App-getinfo.java b/src/17_2_App-getinfo.java new file mode 100644 index 0000000..1ee51a0 --- /dev/null +++ b/src/17_2_App-getinfo.java @@ -0,0 +1,36 @@ +package com.blockchaincommons.lbtc; + +import wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient; +import wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient; +import wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient.MiningInfo; +import wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient.AddressInfo; + +public class App +{ + + public static void main( String[] args ) throws Exception + { + + BitcoindRpcClient rpcClient = new BitcoinJSONRPCClient("http://StandUp:6 +305f1b2dbb3bc5a16cd0f4aac7e1eba@localhost:18332"); + + MiningInfo info = rpcClient.getMiningInfo(); + System.out.println("Mining Information"); + System.out.println("------------------"); + System.out.println("Chain......: " + info.chain()); + System.out.println("Blocks.....: " + info.blocks()); + System.out.println("Difficulty.: " + info.difficulty()); + System.out.println("Hash Power.: " + info.networkHashps()); + + /* Replace this with an address from your system */ + String addr1 = "mvLyH7Rs45c16FG2dfV7uuTKV6pL92kWxo"; + + AddressInfo addr1Info = rpcClient.getAddressInfo(addr1); + System.out.println("Address: " + addr1Info.address()); + System.out.println("MasterFingerPrint: " + addr1Info.hdMasterFingerprint +()); + System.out.println("HdKeyPath: " + addr1Info.hdKeyPath()); + System.out.println("PubKey: " + addr1Info.pubKey()); + + } +}