MCPcopy
hub / github.com/bitcoinj/bitcoinj / KeyBag

Interface KeyBag

core/src/main/java/org/bitcoinj/wallet/KeyBag.java:28–61  ·  view source on GitHub ↗

A KeyBag is simply an object that can map public keys, their 160-bit hashes and script hashes to ECKey and RedeemData objects.

Source from the content-addressed store, hash-verified

26 * and {@link RedeemData} objects.
27 */
28public interface KeyBag {
29 /**
30 * Locates a keypair from the keychain given the hash of the public key, and (optionally) by usage for a specific
31 * script type. This is needed when finding out which key we need to use to redeem a transaction output.
32 *
33 * @param pubKeyHash
34 * hash of the keypair to look for
35 * @param scriptType
36 * only look for given usage (currently {@link ScriptType#P2PKH} or
37 * {@link ScriptType#P2WPKH}) or {@code null} if we don't care
38 * @return found key or null if no such key was found.
39 */
40 @Nullable
41 ECKey findKeyFromPubKeyHash(byte[] pubKeyHash, @Nullable ScriptType scriptType);
42
43 /**
44 * Locates a keypair from the keychain given the raw public key bytes.
45 *
46 * @return ECKey or null if no such key was found.
47 */
48 @Nullable
49 ECKey findKeyFromPubKey(byte[] pubKey);
50
51 /**
52 * Locates a redeem data (redeem script and keys) from the keychain given the hash of the script.
53 * This is needed when finding out which key and script we need to use to locally sign a P2SH transaction input.
54 * It is assumed that wallet should not have more than one private key for a single P2SH tx for security reasons.
55 *
56 * Returns RedeemData object or null if no such data was found.
57 */
58 @Nullable
59 RedeemData findRedeemDataFromScriptHash(byte[] scriptHash);
60
61}

Callers 19

findKeyMethod · 0.65
keyRotationRandomMethod · 0.65
signInputsMethod · 0.65
findKeyFromPubKeyHashMethod · 0.65
findKeyMethod · 0.65
findKeyFromPubKeyHashMethod · 0.65
getConnectedKeyMethod · 0.65
importKeysMethod · 0.65
encryptDecryptMethod · 0.65
watchingMethod · 0.65
deriveMethod · 0.65

Implementers 4

Walletcore/src/main/java/org/bitcoinj/wallet
KeyChainGroupcore/src/main/java/org/bitcoinj/wallet
DecryptingKeyBagcore/src/main/java/org/bitcoinj/wallet
GenerateLowSTestsexamples/src/main/java/org/bitcoinj/ex

Calls

no outgoing calls

Tested by

no test coverage detected