Class BitcoinNetwork

java.lang.Object
com.codename1.crypto.bitcoin.BitcoinNetwork

public final class BitcoinNetwork extends Object
The parameters that make an address or key belong to one Bitcoin network.
  • Field Details

    • MAINNET

      public static final BitcoinNetwork MAINNET
      Bitcoin mainnet: 1..., 3..., bc1....
    • TESTNET

      public static final BitcoinNetwork TESTNET
      testnet3 and testnet4: m.../n..., 2..., tb1....
    • SIGNET

      public static final BitcoinNetwork SIGNET
      Signet, which shares testnet's encodings.
    • REGTEST

      public static final BitcoinNetwork REGTEST
      Regtest: testnet's encodings except for the bcrt HRP.
  • Method Details

    • getName

      public String getName()
      The network's name.
    • getP2pkhVersion

      public int getP2pkhVersion()
      The Base58Check version byte of a P2PKH address.
    • getP2shVersion

      public int getP2shVersion()
      The Base58Check version byte of a P2SH address.
    • getBech32Hrp

      public String getBech32Hrp()
      The Bech32 human-readable part of a SegWit address.
    • getWifPrefix

      public int getWifPrefix()
      The first byte of a WIF private key.
    • getXpubVersion

      public int getXpubVersion()
      The BIP-32 public version bytes (xpub/tpub).
    • getXprvVersion

      public int getXprvVersion()
      The BIP-32 private version bytes (xprv/tprv).
    • getCoinType

      public int getCoinType()
      The BIP-44 coin type: 0 on mainnet, 1 on every test network.
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object