Package org.bitcoinj.core
Class DumpedPrivateKey
java.lang.Object
org.bitcoinj.core.PrefixedChecksummedBytes
org.bitcoinj.core.DumpedPrivateKey
- All Implemented Interfaces:
Serializable,Cloneable
Parses and generates private keys in the form used by the Bitcoin "dumpprivkey" command. This is the private key
bytes with a header byte and 4 checksum bytes at the end. If there are 33 private key bytes instead of 32, then
the last byte is a discriminator value for the compressed pubkey.
- See Also:
-
Field Summary
Fields inherited from class org.bitcoinj.core.PrefixedChecksummedBytes
bytes, params -
Method Summary
Modifier and TypeMethodDescriptionstatic DumpedPrivateKeyfromBase58(NetworkParameters params, String base58) Construct a private key from its Base58 representation.getKey()Returns an ECKey created from this encoded private key.booleanReturns true if the public key corresponding to this private key is compressed.toBase58()Returns the base58-encoded textual form, including version and checksum bytes.toString()Methods inherited from class org.bitcoinj.core.PrefixedChecksummedBytes
clone, equals, getParameters, hashCode
-
Method Details
-
fromBase58
public static DumpedPrivateKey fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork Construct a private key from its Base58 representation.- Parameters:
params- The expected NetworkParameters or null if you don't want validation.base58- The textual form of the private key.- Throws:
AddressFormatException- if the given base58 doesn't parse or the checksum is invalidAddressFormatException.WrongNetwork- if the given private key is valid but for a different chain (eg testnet vs mainnet)
-
toBase58
Returns the base58-encoded textual form, including version and checksum bytes.- Returns:
- textual form
-
getKey
Returns an ECKey created from this encoded private key. -
isPubKeyCompressed
public boolean isPubKeyCompressed()Returns true if the public key corresponding to this private key is compressed. -
toString
-