Class BitcoinKey
java.lang.Object
com.codename1.crypto.bitcoin.BitcoinKey
A secp256k1 key that signs Bitcoin inputs without necessarily exposing its private key.
Psbt.sign(int, BitcoinKey) takes one, so an input can be signed by a key held in memory
(fromPrivateKey(byte[])), by a wallet that derives it per signature, or by a hardware device or
key service that implements the two signing methods.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Wipes any key material the instance holds.static BitcoinKeyfromPrivateKey(byte[] privateKey) A key over a 32-byte private key, which is copied;destroy()wipes the copy.byte[]The 32-byte x-only Taproot internal key.abstract byte[]The compressed 33-byte public key.byte[]The uncompressed 65-byte public key, which some legacy outputs pay to.abstract Secp256k1.EcdsaSignaturesignEcdsa(byte[] sighash) An ECDSA signature over a 32-byte sighash, RFC 6979 deterministic and low-S.abstract byte[]signTaproot(byte[] sighash, byte[] merkleRoot) A BIP-340 signature over a 32-byte Taproot sighash, made with the key tweaked by BIP-341 formerkleRoot(nullfor a key-path-only output, as BIP-86 derives).
-
Constructor Details
-
BitcoinKey
public BitcoinKey()
-
-
Method Details
-
getPublicKey
public abstract byte[] getPublicKey()The compressed 33-byte public key. -
signEcdsa
An ECDSA signature over a 32-byte sighash, RFC 6979 deterministic and low-S. -
signTaproot
public abstract byte[] signTaproot(byte[] sighash, byte[] merkleRoot) A BIP-340 signature over a 32-byte Taproot sighash, made with the key tweaked by BIP-341 formerkleRoot(nullfor a key-path-only output, as BIP-86 derives). -
getUncompressedPublicKey
public byte[] getUncompressedPublicKey()The uncompressed 65-byte public key, which some legacy outputs pay to. -
getInternalKey
public byte[] getInternalKey()The 32-byte x-only Taproot internal key. -
destroy
public void destroy()Wipes any key material the instance holds. The default holds none. -
fromPrivateKey
A key over a 32-byte private key, which is copied;
destroy()wipes the copy.Throws
IllegalArgumentException: if the bytes are not a valid private key
-