Package | Description |
---|---|
org.bitcoinj.core |
The core package contains classes for network messages like
Block and
Transaction , peer connectivity via PeerGroup ,
and block chain management. |
org.bitcoinj.jni | |
org.bitcoinj.protocols.channels |
Micropayment channels allow for rapid tiny payments to be made to a third party once a channel has been set up, using
some of the advanced features of the Bitcoin protocol.
|
org.bitcoinj.script |
Classes for working with and executing Bitcoin script programs, as embedded in inputs and outputs.
|
org.bitcoinj.signers |
Transaction signers know how to calculate signatures over transactions in different contexts, for example, using
local private keys or fetching them from remote servers.
|
org.bitcoinj.wallet |
Classes that support the
Wallet , which knows how to find and save transactions relevant to
a set of keys or scripts, calculate balances, and spend money: the wallet has many features and can be extended
in various ways, please refer to the website for documentation on how to use it. |
org.bitcoinj.wallet.listeners |
Modifier and Type | Method and Description |
---|---|
Script |
UTXO.getScript()
The Script object which you can use to get address, script bytes or script type.
|
Script |
TransactionOutput.getScriptPubKey() |
Script |
TransactionInput.getScriptSig()
Returns the script that is fed to the referenced output (scriptPubKey) script in order to satisfy it: usually
contains signatures and maybe keys, but can contain arbitrary data if the output script accepts it.
|
Modifier and Type | Method and Description |
---|---|
TransactionInput |
Transaction.addInput(Sha256Hash spendTxHash,
long outputIndex,
Script script)
Creates and adds an input to this transaction, with no checking that it's valid.
|
TransactionOutput |
Transaction.addOutput(Coin value,
Script script)
Creates an output that pays to the given script.
|
TransactionInput |
Transaction.addSignedInput(TransactionOutPoint prevOut,
Script scriptPubKey,
ECKey sigKey)
Same as
Transaction.addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)
but defaults to Transaction.SigHash.ALL and "false" for the anyoneCanPay flag. |
TransactionInput |
Transaction.addSignedInput(TransactionOutPoint prevOut,
Script scriptPubKey,
ECKey sigKey,
Transaction.SigHash sigHash,
boolean anyoneCanPay)
Adds a new and fully signed input for the given parameters.
|
TransactionSignature |
Transaction.calculateSignature(int inputIndex,
ECKey key,
Script redeemScript,
Transaction.SigHash hashType,
boolean anyoneCanPay)
Calculates a signature that is valid for being inserted into the input at the given position.
|
static Address |
Address.fromP2SHScript(NetworkParameters params,
Script scriptPubKey)
Returns an Address that represents the script hash extracted from the given scriptPubKey
|
Sha256Hash |
Transaction.hashForSignature(int inputIndex,
Script redeemScript,
Transaction.SigHash type,
boolean anyoneCanPay)
Calculates a signature hash, that is, a hash of a simplified form of the transaction.
|
boolean |
TransactionBag.isWatchedScript(Script script)
Returns true if this wallet is watching transactions for outputs with the script.
|
void |
TransactionInput.setScriptSig(Script scriptSig)
Set the given program as the scriptSig that is supposed to satisfy the connected output script.
|
Constructor and Description |
---|
UTXO(Sha256Hash hash,
long index,
Coin value,
int height,
boolean coinbase,
Script script)
Creates a stored transaction output.
|
UTXO(Sha256Hash hash,
long index,
Coin value,
int height,
boolean coinbase,
Script script,
String address)
Creates a stored transaction output.
|
Modifier and Type | Method and Description |
---|---|
void |
NativeWalletEventListener.onScriptsChanged(Wallet wallet,
List<Script> scripts,
boolean isAddingScripts) |
void |
NativeScriptsChangeEventListener.onScriptsChanged(Wallet wallet,
List<Script> scripts,
boolean isAddingScripts) |
Modifier and Type | Method and Description |
---|---|
protected Script |
PaymentChannelV2ServerState.createOutputScript()
Creates a P2SH script outputting to the client and server pubkeys
|
protected abstract Script |
PaymentChannelServerState.createOutputScript() |
protected Script |
PaymentChannelV1ServerState.createOutputScript() |
protected Script |
PaymentChannelV1ClientState.getContractScript() |
protected Script |
PaymentChannelV2ClientState.getContractScript() |
Script |
PaymentChannelServerState.getContractScript() |
protected abstract Script |
PaymentChannelClientState.getContractScript() |
protected Script |
PaymentChannelV1ClientState.getSignedScript() |
protected Script |
PaymentChannelV2ServerState.getSignedScript() |
protected Script |
PaymentChannelV2ClientState.getSignedScript() |
protected abstract Script |
PaymentChannelServerState.getSignedScript()
Gets the script that signatures should sign against.
|
protected abstract Script |
PaymentChannelClientState.getSignedScript()
Gets the script that is signed.
|
protected Script |
PaymentChannelV1ServerState.getSignedScript() |
Modifier and Type | Method and Description |
---|---|
Script |
ScriptBuilder.build()
Creates a new immutable Script based on the state of the builder.
|
static Script |
ScriptBuilder.createCLTVPaymentChannelInput(byte[] from,
byte[] to) |
static Script |
ScriptBuilder.createCLTVPaymentChannelInput(TransactionSignature from,
TransactionSignature to) |
static Script |
ScriptBuilder.createCLTVPaymentChannelOutput(BigInteger time,
ECKey from,
ECKey to) |
static Script |
ScriptBuilder.createCLTVPaymentChannelP2SHInput(byte[] from,
byte[] to,
Script redeemScript) |
static Script |
ScriptBuilder.createCLTVPaymentChannelP2SHRefund(TransactionSignature signature,
Script redeemScript) |
static Script |
ScriptBuilder.createCLTVPaymentChannelRefund(TransactionSignature signature) |
Script |
Script.createEmptyInputScript(ECKey key,
Script redeemScript)
Creates an incomplete scriptSig that, once filled with signatures, can redeem output containing this scriptPubKey.
|
static Script |
ScriptBuilder.createInputScript(TransactionSignature signature)
Creates a scriptSig that can redeem a pay-to-pubkey output.
|
static Script |
ScriptBuilder.createInputScript(TransactionSignature signature,
ECKey pubKey)
Creates a scriptSig that can redeem a pay-to-address output.
|
static Script |
ScriptBuilder.createMultiSigInputScript(List<TransactionSignature> signatures)
Create a program that satisfies an OP_CHECKMULTISIG program.
|
static Script |
ScriptBuilder.createMultiSigInputScript(TransactionSignature... signatures)
Create a program that satisfies an OP_CHECKMULTISIG program.
|
static Script |
ScriptBuilder.createMultiSigInputScriptBytes(List<byte[]> signatures)
Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures.
|
static Script |
ScriptBuilder.createMultiSigInputScriptBytes(List<byte[]> signatures,
byte[] multisigProgramBytes)
Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures.
|
static Script |
ScriptBuilder.createMultiSigOutputScript(int threshold,
List<ECKey> pubkeys)
Creates a program that requires at least N of the given keys to sign, using OP_CHECKMULTISIG.
|
static Script |
ScriptBuilder.createOpReturnScript(byte[] data)
Creates a script of the form OP_RETURN [data].
|
static Script |
ScriptBuilder.createOutputScript(Address to)
Creates a scriptPubKey that encodes payment to the given address.
|
static Script |
ScriptBuilder.createOutputScript(ECKey key)
Creates a scriptPubKey that encodes payment to the given raw public key.
|
static Script |
ScriptBuilder.createP2SHMultiSigInputScript(List<TransactionSignature> signatures,
Script multisigProgram)
Create a program that satisfies a pay-to-script hashed OP_CHECKMULTISIG program.
|
static Script |
ScriptBuilder.createP2SHOutputScript(byte[] hash)
Creates a scriptPubKey that sends to the given script hash.
|
static Script |
ScriptBuilder.createP2SHOutputScript(int threshold,
List<ECKey> pubkeys)
Creates a P2SH output script with given public keys and threshold.
|
static Script |
ScriptBuilder.createP2SHOutputScript(Script redeemScript)
Creates a scriptPubKey for the given redeem script.
|
static Script |
ScriptBuilder.createRedeemScript(int threshold,
List<ECKey> pubkeys)
Creates redeem script with given public keys and threshold.
|
Script |
Script.getScriptSigWithSignature(Script scriptSig,
byte[] sigBytes,
int index)
Returns a copy of the given scriptSig with the signature inserted in the given position.
|
static Script |
ScriptBuilder.updateScriptWithSignature(Script scriptSig,
byte[] signature,
int targetIndex,
int sigsPrefixCount,
int sigsSuffixCount)
Returns a copy of the given scriptSig with the signature inserted in the given position.
|
Modifier and Type | Method and Description |
---|---|
void |
Script.correctlySpends(Transaction txContainingThis,
long scriptSigIndex,
Script scriptPubKey)
Deprecated.
Use
correctlySpends(org.bitcoinj.core.Transaction, long, org.bitcoinj.script.Script, java.util.Set)
instead so that verification flags do not change as new verification options
are added. |
void |
Script.correctlySpends(Transaction txContainingThis,
long scriptSigIndex,
Script scriptPubKey,
Set<Script.VerifyFlag> verifyFlags)
Verifies that this script (interpreted as a scriptSig) correctly spends the given scriptPubKey.
|
static Script |
ScriptBuilder.createCLTVPaymentChannelP2SHInput(byte[] from,
byte[] to,
Script redeemScript) |
static Script |
ScriptBuilder.createCLTVPaymentChannelP2SHRefund(TransactionSignature signature,
Script redeemScript) |
Script |
Script.createEmptyInputScript(ECKey key,
Script redeemScript)
Creates an incomplete scriptSig that, once filled with signatures, can redeem output containing this scriptPubKey.
|
static Script |
ScriptBuilder.createP2SHMultiSigInputScript(List<TransactionSignature> signatures,
Script multisigProgram)
Create a program that satisfies a pay-to-script hashed OP_CHECKMULTISIG program.
|
static Script |
ScriptBuilder.createP2SHOutputScript(Script redeemScript)
Creates a scriptPubKey for the given redeem script.
|
static void |
Script.executeScript(Transaction txContainingThis,
long index,
Script script,
LinkedList<byte[]> stack,
boolean enforceNullDummy)
|
static void |
Script.executeScript(Transaction txContainingThis,
long index,
Script script,
LinkedList<byte[]> stack,
Set<Script.VerifyFlag> verifyFlags)
Exposes the script interpreter.
|
int |
Script.getNumberOfBytesRequiredToSpend(ECKey pubKey,
Script redeemScript)
Returns number of bytes required to spend this script.
|
Script |
Script.getScriptSigWithSignature(Script scriptSig,
byte[] sigBytes,
int index)
Returns a copy of the given scriptSig with the signature inserted in the given position.
|
static Script |
ScriptBuilder.updateScriptWithSignature(Script scriptSig,
byte[] signature,
int targetIndex,
int sigsPrefixCount,
int sigsSuffixCount)
Returns a copy of the given scriptSig with the signature inserted in the given position.
|
Constructor and Description |
---|
ScriptBuilder(Script template)
Creates a fresh ScriptBuilder with the given program as the starting point.
|
Modifier and Type | Field and Description |
---|---|
Map<Script,List<ChildNumber>> |
TransactionSigner.ProposedTransaction.keyPaths
HD key paths used for each input to derive a signing key.
|
Modifier and Type | Field and Description |
---|---|
Script |
RedeemData.redeemScript |
Modifier and Type | Method and Description |
---|---|
Script |
MarriedKeyChain.freshOutputScript(KeyChain.KeyPurpose purpose)
Create a new married key and return the matching output script
|
Script |
DeterministicKeyChain.freshOutputScript(KeyChain.KeyPurpose purpose)
Create a new key and return the matching output script.
|
Modifier and Type | Method and Description |
---|---|
List<Script> |
Wallet.getWatchedScripts()
Returns a snapshot of the watched scripts.
|
Modifier and Type | Method and Description |
---|---|
boolean |
Wallet.canSignFor(Script script)
Returns true if this wallet has at least one of the private keys needed to sign for this scriptPubKey.
|
boolean |
Wallet.isWatchedScript(Script script)
Returns true if this wallet is watching transactions for outputs with the script.
|
static RedeemData |
RedeemData.of(ECKey key,
Script program)
Creates RedeemData for pay-to-address or pay-to-pubkey input.
|
static RedeemData |
RedeemData.of(List<ECKey> keys,
Script redeemScript) |
Modifier and Type | Method and Description |
---|---|
int |
Wallet.addWatchedScripts(List<Script> scripts)
Adds the given output scripts to the wallet to be watched.
|
protected void |
Wallet.queueOnScriptsChanged(List<Script> scripts,
boolean isAddingScripts) |
boolean |
Wallet.removeWatchedScripts(List<Script> scripts)
Removes the given output scripts from the wallet that were being watched.
|
Modifier and Type | Method and Description |
---|---|
void |
ScriptsChangeEventListener.onScriptsChanged(Wallet wallet,
List<Script> scripts,
boolean isAddingScripts)
Called whenever a new watched script is added to the wallet.
|
void |
AbstractWalletEventListener.onScriptsChanged(Wallet wallet,
List<Script> scripts,
boolean isAddingScripts)
Deprecated.
|
Copyright © 2016. All rights reserved.