Class BlockChainInfo

java.lang.Object
org.consensusj.bitcoin.json.pojo.BlockChainInfo

public class BlockChainInfo extends Object
POJO for `getblockchaininfo` RPC response.
  • Constructor Details

    • BlockChainInfo

      public BlockChainInfo(String chain, int blocks, int headers, org.bitcoinj.base.Sha256Hash bestBlockHash, BigDecimal difficulty, BigDecimal verificationProgress, byte[] chainWork)
  • Method Details

    • getChain

      public String getChain()
      Returns:
      a short string identifying which chain (Note: this differs from BitcoinNetwork.toString()
    • getBlocks

      public int getBlocks()
    • getHeaders

      public int getHeaders()
    • getBestBlockHash

      public org.bitcoinj.base.Sha256Hash getBestBlockHash()
    • getDifficulty

    • getVerificationProgress

    • getChainWork

      public byte[] getChainWork()
    • chainToNetwork

      public static org.bitcoinj.base.Network chainToNetwork(BlockChainInfo info)
      Map a BlockChainInfo chain string to a Network. These strings are different from the standard values in BitcoinNetwork.toString().
      Parameters:
      info - BlockChainInfo
      Returns:
      the matching network.
    • networkToChainName

      public static String networkToChainName(org.bitcoinj.base.BitcoinNetwork network)
      Map BitcoinNetwork to a chain-id string. Bitcoin Core returns strings that differ from BitcoinNetwork.toString().
      Parameters:
      network - bitcoinj enum type
      Returns:
      Bitcoin Core-compatible chain string