Class Wif

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

public final class Wif extends Object
Wallet Import Format: a private key in Base58Check, the form paper wallets and dumpprivkey use. The trailing 0x01 flag says the key's addresses use the compressed public key.
  • Method Details

    • encode

      public static String encode(byte[] privateKey, boolean compressed, BitcoinNetwork network)
      Encodes a private key.
    • decode

      public static Wif decode(String wif, BitcoinNetwork network)

      Decodes a WIF string of the given network.

      Throws
      • IllegalArgumentException: for a malformed key, a bad checksum or another network
    • getPrivateKey

      public byte[] getPrivateKey()
      A copy of the private key. Wipe it after use.
    • isCompressed

      public boolean isCompressed()
      Tells whether the key's addresses use the compressed public key.
    • getPublicKey

      public byte[] getPublicKey()
      The public key in the form the flag selects.
    • getNetwork

      public BitcoinNetwork getNetwork()
      The network.
    • destroy

      public void destroy()
      Wipes the private key.