public class BitcoinJSONRPCClient extends Object implements BitcoindRpcClient
| Modifier and Type | Class and Description |
|---|---|
class |
BitcoinJSONRPCClient.NetTotalsImpl |
BitcoindRpcClient.Address, BitcoindRpcClient.AddressBalance, BitcoindRpcClient.AddressUtxo, BitcoindRpcClient.AddressValidationResult, BitcoindRpcClient.BasicTxInput, BitcoindRpcClient.BasicTxOutput, BitcoindRpcClient.Block, BitcoindRpcClient.BlockChainInfo, BitcoindRpcClient.DecodedScript, BitcoindRpcClient.ExtendedTxInput, BitcoindRpcClient.Info, BitcoindRpcClient.MiningInfo, BitcoindRpcClient.MultiSig, BitcoindRpcClient.NetTotals, BitcoindRpcClient.Network, BitcoindRpcClient.NetworkInfo, BitcoindRpcClient.NodeInfo, BitcoindRpcClient.PeerInfoResult, BitcoindRpcClient.RawTransaction, BitcoindRpcClient.ReceivedAddress, BitcoindRpcClient.SmartFeeResult, BitcoindRpcClient.Transaction, BitcoindRpcClient.TransactionsSinceBlock, BitcoindRpcClient.TxInput, BitcoindRpcClient.TxOut, BitcoindRpcClient.TxOutput, BitcoindRpcClient.TxOutSetInfo, BitcoindRpcClient.Unspent, BitcoindRpcClient.WalletInfo| Modifier and Type | Field and Description |
|---|---|
static URL |
DEFAULT_JSONRPC_REGTEST_URL |
static URL |
DEFAULT_JSONRPC_TESTNET_URL |
static URL |
DEFAULT_JSONRPC_URL |
static Charset |
QUERY_CHARSET |
URL |
rpcURL |
| Constructor and Description |
|---|
BitcoinJSONRPCClient() |
BitcoinJSONRPCClient(boolean testNet) |
BitcoinJSONRPCClient(String rpcUrl) |
BitcoinJSONRPCClient(URL rpc) |
| Modifier and Type | Method and Description |
|---|---|
String |
addMultiSigAddress(int nRequired,
List<String> keyObject)
The addmultisigaddress RPC adds a P2SH multisig address to the wallet.
|
String |
addMultiSigAddress(int nRequired,
List<String> keyObject,
String account)
The addmultisigaddress RPC adds a P2SH multisig address to the wallet.
|
void |
addNode(String node,
String command)
The addnode RPC attempts to add or remove a node from the addnode list, or to try a connection to a node once.
|
void |
backupWallet(String destination)
The backupwallet RPC safely copies wallet.dat to the specified file, which can be a directory or a path with filename.
|
BitcoindRpcClient.MultiSig |
createMultiSig(int nRequired,
List<String> keys)
The createmultisig RPC creates a P2SH multi-signature address.
|
String |
createRawTransaction(List<BitcoindRpcClient.TxInput> inputs,
List<BitcoindRpcClient.TxOutput> outputs)
The createrawtransaction RPC creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address.
|
BitcoindRpcClient.RawTransaction |
decodeRawTransaction(String hex) |
BitcoindRpcClient.DecodedScript |
decodeScript(String hex)
The decodescript RPC decodes a hex-encoded P2SH redeem script.
|
String |
dumpPrivKey(String address)
The dumpprivkey RPC returns the wallet-import-format (WIF) private key corresponding to an address.
|
void |
dumpWallet(String filename)
The dumpwallet RPC creates or overwrites a file with all wallet keys in a human-readable format.
|
void |
encryptWallet(String passPhrase)
The encryptwallet RPC encrypts the wallet with a passphrase.
|
List<String> |
generate(int numBlocks)
The generate RPC nearly instantly generates blocks.
|
List<String> |
generate(int numBlocks,
long maxTries)
The generate RPC nearly instantly generates blocks.
|
List<String> |
generateToAddress(int numBlocks,
String address)
The generatetoaddress RPC mines blocks immediately to a specified address.
|
String |
getAccount(String address)
The getaccount RPC returns the name of the account associated with the given address.
|
String |
getAccountAddress(String account)
The getaccountaddress RPC returns the current Bitcoin address for receiving payments to this account.
|
List<BitcoindRpcClient.NodeInfo> |
getAddedNodeInfo(boolean dummy,
String node)
The getaddednodeinfo RPC returns information about the given added node, or all added nodes (except onetry nodes).
|
BitcoindRpcClient.AddressBalance |
getAddressBalance(String address)
get the balance of specified address
PAY ATTENTION
This API only works on some bitcoind nodes which support addressindex option
satoshilabs/bitcoin is such a kind of these nodes
|
List<String> |
getAddressesByAccount(String account)
The getaddressesbyaccount RPC returns a list of every address assigned to a particular account.
|
List<BitcoindRpcClient.AddressUtxo> |
getAddressUtxo(String address)
get all the utxo list of a specified address
PAY ATTENTION
This API only works on some bitcoind nodes which support addressindex option
satoshilabs/bitcoin is such a kind of these nodes
|
BigDecimal |
getBalance()
The getbalance RPC gets the balance in decimal bitcoins for the default account.
|
BigDecimal |
getBalance(String account)
The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.
|
BigDecimal |
getBalance(String account,
int minConf)
The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.
|
String |
getBestBlockHash()
The getbestblockhash RPC returns the header hash of the most recent block on the best block chain.
|
BitcoindRpcClient.Block |
getBlock(int height)
Gets a block at the given height from the local block database.
|
BitcoindRpcClient.Block |
getBlock(String blockHash)
The getblock RPC gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block.
|
BitcoindRpcClient.BlockChainInfo |
getBlockChainInfo()
The getblockchaininfo RPC provides information about the current state of the block chain.
|
int |
getBlockCount()
The getblockcount RPC returns the number of blocks in the local best block chain.
|
String |
getBlockHash(int height)
The getblockhash RPC returns the header hash of a block at the given height in the local best block chain.
|
long |
getConnectionCount()
The getconnectioncount RPC returns the number of connections to other nodes.
|
BigDecimal |
getDifficulty()
The getdifficulty RPC
|
BigDecimal |
getEstimateFee(int nBlocks)
The estimatefee RPC estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks.
|
BigDecimal |
getEstimatePriority(int nBlocks)
The estimatepriority RPC estimates the priority (coin age) that a transaction needs in order to be included within a certain number of blocks as a free high-priority transaction.
|
BitcoindRpcClient.SmartFeeResult |
getEstimateSmartFee(int blocks)
Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible
and return the number of blocks for which the estimate is valid.
|
boolean |
getGenerate()
The getgenerate RPC was removed in Bitcoin Core 0.13.0.
|
HostnameVerifier |
getHostnameVerifier() |
BitcoindRpcClient.Info |
getInfo()
The getinfo RPC prints various information about the node and the network.
|
BitcoindRpcClient.MiningInfo |
getMiningInfo()
The getmininginfo RPC returns various mining-related information.
|
BitcoindRpcClient.NetTotals |
getNetTotals()
The getnettotals RPC returns information about network traffic, including bytes in, bytes out, and the current time.
|
BigDecimal |
getNetworkHashPs()
The getnetworkhashps RPC returns the estimated current or historical network hashes per second based on the last n blocks.
|
BitcoindRpcClient.NetworkInfo |
getNetworkInfo()
The getnetworkinfo RPC returns information about the node’s connection to the network.
|
String |
getNewAddress()
The getnewaddress RPC returns a new Bitcoin address for receiving payments.
|
String |
getNewAddress(String account)
The getnewaddress RPC returns a new Bitcoin address for receiving payments.
|
String |
getNewAddress(String account,
String addressType)
The getnewaddress RPC returns a new Bitcoin address for receiving payments.
|
List<BitcoindRpcClient.PeerInfoResult> |
getPeerInfo()
The getpeerinfo RPC returns data about each connected network node.
|
String |
getRawBlock(String blockHash)
The getblock RPC gets a block with a particular header hash from the local block database as a serialized block.
|
String |
getRawChangeAddress()
The getrawchangeaddress RPC returns a new Bitcoin address for receiving change.
|
List<String> |
getRawMemPool()
The getrawmempool RPC returns all transaction identifiers (TXIDs) in the memory pool as a JSON array,
or detailed information about each transaction in the memory pool as a JSON object.
|
BitcoindRpcClient.RawTransaction |
getRawTransaction(String txId)
The getrawtransaction RPC gets a hex-encoded serialized transaction or a JSON object describing the transaction.
|
String |
getRawTransactionHex(String txId)
The getrawtransaction RPC gets a hex-encoded serialized transaction.
|
BigDecimal |
getReceivedByAccount(String account)
The getreceivedbyaccount RPC returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations.
|
BigDecimal |
getReceivedByAccount(String account,
int minConf) |
BigDecimal |
getReceivedByAddress(String address)
The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations.
|
BigDecimal |
getReceivedByAddress(String address,
int minConf)
The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations.
|
SSLSocketFactory |
getSslSocketFactory() |
BitcoindRpcClient.Transaction |
getTransaction(String txId)
The gettransaction RPC gets detailed information about an in-wallet transaction.
|
BitcoindRpcClient.TxOut |
getTxOut(String txId,
long vout)
The gettxout RPC returns details about an unspent transaction output (UTXO).
|
BitcoindRpcClient.TxOut |
getTxOut(String txId,
long vout,
boolean includemempool) |
BitcoindRpcClient.TxOutSetInfo |
getTxOutSetInfo()
The gettxoutsetinfo RPC returns statistics about the confirmed unspent transaction output (UTXO) set.
|
BigDecimal |
getUnconfirmedBalance()
The getunconfirmedbalance RPC returns the wallet’s total unconfirmed balance.
|
BitcoindRpcClient.WalletInfo |
getWalletInfo()
The getwalletinfo RPC provides information about the wallet.
|
Object |
importAddress(String address,
String label,
boolean rescan)
The importaddress RPC adds an address or pubkey script to the wallet without the associated private key,
allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs.
|
void |
importPrivKey(String bitcoinPrivKey)
The importprivkey RPC adds a private key to your wallet.
|
void |
importPrivKey(String bitcoinPrivKey,
String label)
The importprivkey RPC adds a private key to your wallet.
|
void |
importPrivKey(String bitcoinPrivKey,
String label,
boolean rescan)
The importprivkey RPC adds a private key to your wallet.
|
void |
importWallet(String filename)
The importwallet RPC imports private keys from a file in wallet dump file format (see the dumpwallet RPC).
|
void |
invalidateBlock(String hash)
Permanently marks a block as invalid, as if it violated a consensus rule.
|
void |
keyPoolRefill()
The keypoolrefill RPC fills the cache of unused pre-generated keys (the keypool).
|
void |
keyPoolRefill(long size) |
Map<String,Number> |
listAccounts()
The listaccounts RPC lists accounts and their balances.
|
Map<String,Number> |
listAccounts(int minConf)
The listaccounts RPC lists accounts and their balances.
|
List<BitcoindRpcClient.ReceivedAddress> |
listReceivedByAddress()
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.
|
List<BitcoindRpcClient.ReceivedAddress> |
listReceivedByAddress(int minConf)
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.
|
List<BitcoindRpcClient.ReceivedAddress> |
listReceivedByAddress(int minConf,
boolean includeEmpty)
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.
|
BitcoindRpcClient.TransactionsSinceBlock |
listSinceBlock()
The listsinceblock RPC gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth.
|
BitcoindRpcClient.TransactionsSinceBlock |
listSinceBlock(String blockHash)
The listsinceblock RPC gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth.
|
BitcoindRpcClient.TransactionsSinceBlock |
listSinceBlock(String blockHash,
int targetConfirmations)
The listsinceblock RPC gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth.
|
List<BitcoindRpcClient.Transaction> |
listTransactions()
The listtransactions RPC returns the most recent transactions that affect the wallet.
|
List<BitcoindRpcClient.Transaction> |
listTransactions(String account)
The listtransactions RPC returns the most recent transactions that affect the wallet.
|
List<BitcoindRpcClient.Transaction> |
listTransactions(String account,
int count)
The listtransactions RPC returns the most recent transactions that affect the wallet.
|
List<BitcoindRpcClient.Transaction> |
listTransactions(String account,
int count,
int skip)
The listtransactions RPC returns the most recent transactions that affect the wallet.
|
List<BitcoindRpcClient.Unspent> |
listUnspent()
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.
|
List<BitcoindRpcClient.Unspent> |
listUnspent(int minConf)
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.
|
List<BitcoindRpcClient.Unspent> |
listUnspent(int minConf,
int maxConf)
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.
|
List<BitcoindRpcClient.Unspent> |
listUnspent(int minConf,
int maxConf,
String... addresses)
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.
|
Object |
loadResponse(InputStream in,
Object expectedID,
boolean close) |
boolean |
move(String fromAccount,
String toAddress,
BigDecimal amount)
The move RPC moves a specified amount from one account in your wallet to another using an off-block-chain transaction.
|
boolean |
move(String fromAccount,
String toAddress,
BigDecimal amount,
int minConf) |
boolean |
move(String fromAccount,
String toAddress,
BigDecimal amount,
int minConf,
String comment) |
boolean |
move(String fromAccount,
String toAddress,
BigDecimal amount,
String comment)
The move RPC moves a specified amount from one account in your wallet to another using an off-block-chain transaction.
|
void |
ping()
The ping RPC sends a P2P ping message to all connected nodes to measure ping time.
|
byte[] |
prepareRequest(String method,
Object... params) |
Object |
query(String method,
Object... o) |
void |
reconsiderBlock(String hash)
Removes invalidity status of a block and its descendants, reconsider them for activation.
|
String |
sendFrom(String fromAccount,
String toAddress,
BigDecimal amount)
The sendfrom RPC spends an amount from a local account to a bitcoin address.
|
String |
sendFrom(String fromAccount,
String toAddress,
BigDecimal amount,
int minConf)
The sendfrom RPC spends an amount from a local account to a bitcoin address.
|
String |
sendFrom(String fromAccount,
String toAddress,
BigDecimal amount,
int minConf,
String comment)
The sendfrom RPC spends an amount from a local account to a bitcoin address.
|
String |
sendFrom(String fromAccount,
String toAddress,
BigDecimal amount,
int minConf,
String comment,
String commentTo)
The sendfrom RPC spends an amount from a local account to a bitcoin address.
|
String |
sendRawTransaction(String hex)
The sendrawtransaction RPC validates a transaction and broadcasts it to the peer-to-peer network.
|
String |
sendToAddress(String toAddress,
BigDecimal amount)
The sendtoaddress RPC spends an amount to a given address.
|
String |
sendToAddress(String toAddress,
BigDecimal amount,
String comment)
The sendtoaddress RPC spends an amount to a given address.
|
String |
sendToAddress(String toAddress,
BigDecimal amount,
String comment,
String commentTo)
The sendtoaddress RPC spends an amount to a given address.
|
void |
setGenerate(boolean b) |
void |
setHostnameVerifier(HostnameVerifier hostnameVerifier) |
void |
setSslSocketFactory(SSLSocketFactory sslSocketFactory) |
boolean |
setTxFee(BigDecimal amount)
The settxfee RPC sets the transaction fee per kilobyte paid by transactions created by this wallet.
|
String |
signMessage(String bitcoinAdress,
String message)
The signmessage RPC signs a message with the private key of an address.
|
String |
signRawTransaction(String hex) |
String |
signRawTransaction(String hex,
List<? extends BitcoindRpcClient.TxInput> inputs,
List<String> privateKeys)
The signrawtransaction RPC signs a transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.
|
String |
signRawTransaction(String hex,
List<? extends BitcoindRpcClient.TxInput> inputs,
List<String> privateKeys,
String sigHashType) |
void |
stop()
The stop RPC safely shuts down the Bitcoin Core server.
|
void |
submitBlock(String hexData)
Attempts to submit new block to network.
|
BitcoindRpcClient.AddressValidationResult |
validateAddress(String address)
The validateaddress RPC returns information about the given Bitcoin address.
|
boolean |
verifyChain()
The verifychain RPC verifies each entry in the local block chain database.
|
boolean |
verifyChain(int checklevel,
int numblocks) |
boolean |
verifyMessage(String bitcoinAddress,
String signature,
String message)
The verifymessage RPC verifies a signed message.
|
void |
walletPassPhrase(String passPhrase,
long timeOut)
The walletpassphrase RPC stores the wallet decryption key in memory for the indicated number of seconds.
|
public final URL rpcURL
public static final URL DEFAULT_JSONRPC_URL
public static final URL DEFAULT_JSONRPC_TESTNET_URL
public static final URL DEFAULT_JSONRPC_REGTEST_URL
public static final Charset QUERY_CHARSET
public BitcoinJSONRPCClient(String rpcUrl) throws MalformedURLException
MalformedURLExceptionpublic BitcoinJSONRPCClient(URL rpc)
public BitcoinJSONRPCClient(boolean testNet)
public BitcoinJSONRPCClient()
public HostnameVerifier getHostnameVerifier()
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
public SSLSocketFactory getSslSocketFactory()
public void setSslSocketFactory(SSLSocketFactory sslSocketFactory)
public Object loadResponse(InputStream in, Object expectedID, boolean close) throws IOException, GenericRpcException
IOExceptionGenericRpcExceptionpublic Object query(String method, Object... o) throws GenericRpcException
GenericRpcExceptionpublic String createRawTransaction(List<BitcoindRpcClient.TxInput> inputs, List<BitcoindRpcClient.TxOutput> outputs) throws GenericRpcException
BitcoindRpcClientcreateRawTransaction in interface BitcoindRpcClientinputs - An array of objects, each one to be used as an input to the transactionoutputs - The addresses and amounts to payGenericRpcExceptionpublic String dumpPrivKey(String address) throws GenericRpcException
BitcoindRpcClientdumpPrivKey in interface BitcoindRpcClientaddress - The P2PKH address corresponding to the private key you want returned.GenericRpcExceptionpublic String getAccount(String address) throws GenericRpcException
BitcoindRpcClientgetAccount in interface BitcoindRpcClientaddress - A P2PKH or P2SH Bitcoin address belonging either to a specific account or the default accountGenericRpcExceptionpublic String getAccountAddress(String account) throws GenericRpcException
BitcoindRpcClientgetAccountAddress in interface BitcoindRpcClientaccount - The name of an account.GenericRpcExceptionpublic List<String> getAddressesByAccount(String account) throws GenericRpcException
BitcoindRpcClientgetAddressesByAccount in interface BitcoindRpcClientaccount - The name of an account to get the balance for.GenericRpcExceptionpublic BigDecimal getBalance() throws GenericRpcException
BitcoindRpcClientgetBalance in interface BitcoindRpcClientGenericRpcExceptionpublic BigDecimal getBalance(String account) throws GenericRpcException
BitcoindRpcClientgetBalance in interface BitcoindRpcClientaccount - The name of an account to get the balance for.GenericRpcExceptionpublic BigDecimal getBalance(String account, int minConf) throws GenericRpcException
BitcoindRpcClientgetBalance in interface BitcoindRpcClientaccount - The name of an account to get the balance for.minConf - The minimum number of confirmationsGenericRpcExceptionpublic BitcoindRpcClient.SmartFeeResult getEstimateSmartFee(int blocks)
BitcoindRpcClientgetEstimateSmartFee in interface BitcoindRpcClientblocks - Confirmation target in blockspublic BitcoindRpcClient.Block getBlock(int height) throws GenericRpcException
BitcoindRpcClientBitcoindRpcClient.getBlockHash(int) and BitcoindRpcClient.getBlock(String).getBlock in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.Block getBlock(String blockHash) throws GenericRpcException
BitcoindRpcClientgetBlock in interface BitcoindRpcClientblockHash - The hash of the header of the block to get, encoded as hex in RPC byte orderGenericRpcExceptionpublic String getRawBlock(String blockHash) throws GenericRpcException
BitcoindRpcClientgetRawBlock in interface BitcoindRpcClientblockHash - The hash of the header of the block to get, encoded as hex in RPC byte orderGenericRpcExceptionpublic String getBlockHash(int height) throws GenericRpcException
BitcoindRpcClientgetBlockHash in interface BitcoindRpcClientheight - The height of the block whose header hash should be returned.GenericRpcExceptionpublic BitcoindRpcClient.BlockChainInfo getBlockChainInfo() throws GenericRpcException
BitcoindRpcClientgetBlockChainInfo in interface BitcoindRpcClientGenericRpcExceptionpublic int getBlockCount()
throws GenericRpcException
BitcoindRpcClientgetBlockCount in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.Info getInfo() throws GenericRpcException
BitcoindRpcClientgetInfo in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.TxOutSetInfo getTxOutSetInfo() throws GenericRpcException
BitcoindRpcClientgetTxOutSetInfo in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.NetworkInfo getNetworkInfo() throws GenericRpcException
BitcoindRpcClientgetNetworkInfo in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.MiningInfo getMiningInfo() throws GenericRpcException
BitcoindRpcClientgetMiningInfo in interface BitcoindRpcClientGenericRpcExceptionpublic List<BitcoindRpcClient.NodeInfo> getAddedNodeInfo(boolean dummy, String node) throws GenericRpcException
BitcoindRpcClientgetAddedNodeInfo in interface BitcoindRpcClientdummy - Removed in Bitcoin Core 0.14.0node - The node to get information about in the same GenericRpcExceptionpublic BitcoindRpcClient.MultiSig createMultiSig(int nRequired, List<String> keys) throws GenericRpcException
BitcoindRpcClientcreateMultiSig in interface BitcoindRpcClientnRequired - The minimum (m) number of signatures required to spend this m-of-n multisig scriptkeys - An array of strings with each string being a public key or addressGenericRpcExceptionpublic BitcoindRpcClient.WalletInfo getWalletInfo()
BitcoindRpcClientgetWalletInfo in interface BitcoindRpcClientpublic String getNewAddress() throws GenericRpcException
BitcoindRpcClientgetNewAddress in interface BitcoindRpcClientGenericRpcExceptionpublic String getNewAddress(String account) throws GenericRpcException
BitcoindRpcClientgetNewAddress in interface BitcoindRpcClientGenericRpcExceptionpublic String getNewAddress(String account, String addressType) throws GenericRpcException
BitcoindRpcClientgetNewAddress in interface BitcoindRpcClientGenericRpcExceptionpublic List<String> getRawMemPool() throws GenericRpcException
BitcoindRpcClientgetRawMemPool in interface BitcoindRpcClientGenericRpcExceptionpublic String getBestBlockHash() throws GenericRpcException
BitcoindRpcClientgetBestBlockHash in interface BitcoindRpcClientGenericRpcExceptionpublic String getRawTransactionHex(String txId) throws GenericRpcException
BitcoindRpcClientgetRawTransactionHex in interface BitcoindRpcClienttxId - The TXID of the transaction to get, encoded as hex in RPC byte orderGenericRpcExceptionpublic BitcoindRpcClient.RawTransaction getRawTransaction(String txId) throws GenericRpcException
BitcoindRpcClientgetRawTransaction in interface BitcoindRpcClienttxId - The TXID of the transaction to get, encoded as hex in RPC byte orderGenericRpcExceptionpublic BigDecimal getReceivedByAddress(String address) throws GenericRpcException
BitcoindRpcClientgetReceivedByAddress in interface BitcoindRpcClientaddress - The address whose transactions should be talliedGenericRpcExceptionpublic BigDecimal getReceivedByAddress(String address, int minConf) throws GenericRpcException
BitcoindRpcClientgetReceivedByAddress in interface BitcoindRpcClientaddress - The address whose transactions should be talliedminConf - The minimum number of confirmationsGenericRpcExceptionpublic void importPrivKey(String bitcoinPrivKey) throws GenericRpcException
BitcoindRpcClientimportPrivKey in interface BitcoindRpcClientbitcoinPrivKey - The private key to import into the wallet encoded in base58check using wallet import format (WIF)GenericRpcExceptionpublic void importPrivKey(String bitcoinPrivKey, String label) throws GenericRpcException
BitcoindRpcClientimportPrivKey in interface BitcoindRpcClientbitcoinPrivKey - The private key to import into the wallet encoded in base58check using wallet import format (WIF)label - The name of an account to which transactions involving the key should be assigned.GenericRpcExceptionpublic void importPrivKey(String bitcoinPrivKey, String label, boolean rescan) throws GenericRpcException
BitcoindRpcClientimportPrivKey in interface BitcoindRpcClientbitcoinPrivKey - The private key to import into the wallet encoded in base58check using wallet import format (WIF)label - The name of an account to which transactions involving the key should be assigned.rescan - Set to true (the default) to rescan the entire local block database for transactions affecting any address or pubkey script in the wallet.GenericRpcExceptionpublic Object importAddress(String address, String label, boolean rescan) throws GenericRpcException
BitcoindRpcClientimportAddress in interface BitcoindRpcClientaddress - Either a P2PKH or P2SH address encoded in base58check, or a pubkey script encoded as hexlabel - An account name into which the address should be placed.rescan - Set to true (the default) to rescan the entire local block databaseGenericRpcExceptionpublic Map<String,Number> listAccounts() throws GenericRpcException
BitcoindRpcClientlistAccounts in interface BitcoindRpcClientGenericRpcExceptionpublic Map<String,Number> listAccounts(int minConf) throws GenericRpcException
BitcoindRpcClientlistAccounts in interface BitcoindRpcClientminConf - The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.GenericRpcExceptionpublic List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress() throws GenericRpcException
BitcoindRpcClientlistReceivedByAddress in interface BitcoindRpcClientGenericRpcExceptionpublic List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress(int minConf) throws GenericRpcException
BitcoindRpcClientlistReceivedByAddress in interface BitcoindRpcClientminConf - The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.GenericRpcExceptionpublic List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress(int minConf, boolean includeEmpty) throws GenericRpcException
BitcoindRpcClientlistReceivedByAddress in interface BitcoindRpcClientminConf - The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.includeEmpty - Set to true to display accounts which have never received a payment.GenericRpcExceptionpublic BitcoindRpcClient.TransactionsSinceBlock listSinceBlock() throws GenericRpcException
BitcoindRpcClientlistSinceBlock in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.TransactionsSinceBlock listSinceBlock(String blockHash) throws GenericRpcException
BitcoindRpcClientlistSinceBlock in interface BitcoindRpcClientblockHash - The hash of a block header encoded as hex in RPC byte order.GenericRpcExceptionpublic BitcoindRpcClient.TransactionsSinceBlock listSinceBlock(String blockHash, int targetConfirmations) throws GenericRpcException
BitcoindRpcClientlistSinceBlock in interface BitcoindRpcClientblockHash - The hash of a block header encoded as hex in RPC byte order.targetConfirmations - Sets the lastblock field of the results to the header hash of a block with this many confirmations.GenericRpcExceptionpublic List<BitcoindRpcClient.Transaction> listTransactions() throws GenericRpcException
BitcoindRpcClientlistTransactions in interface BitcoindRpcClientGenericRpcExceptionpublic List<BitcoindRpcClient.Transaction> listTransactions(String account) throws GenericRpcException
BitcoindRpcClientlistTransactions in interface BitcoindRpcClientaccount - The name of an account to get transactinos from (deprecated).GenericRpcExceptionpublic List<BitcoindRpcClient.Transaction> listTransactions(String account, int count) throws GenericRpcException
BitcoindRpcClientlistTransactions in interface BitcoindRpcClientaccount - The name of an account to get transactinos from (deprecated).count - The number of the most recent transactions to list.GenericRpcExceptionpublic List<BitcoindRpcClient.Transaction> listTransactions(String account, int count, int skip) throws GenericRpcException
BitcoindRpcClientlistTransactions in interface BitcoindRpcClientaccount - The name of an account to get transactinos from (deprecated).count - The number of the most recent transactions to list.skip - The number of the most recent transactions which should not be returned.GenericRpcExceptionpublic List<BitcoindRpcClient.Unspent> listUnspent() throws GenericRpcException
BitcoindRpcClientlistUnspent in interface BitcoindRpcClientGenericRpcExceptionpublic List<BitcoindRpcClient.Unspent> listUnspent(int minConf) throws GenericRpcException
BitcoindRpcClientlistUnspent in interface BitcoindRpcClientminConf - The minimum number of confirmations the transaction containing an output must have in order to be returned.GenericRpcExceptionpublic List<BitcoindRpcClient.Unspent> listUnspent(int minConf, int maxConf) throws GenericRpcException
BitcoindRpcClientlistUnspent in interface BitcoindRpcClientminConf - The minimum number of confirmations the transaction containing an output must have in order to be returned.maxConf - The maximum number of confirmations the transaction containing an output may have in order to be returned.GenericRpcExceptionpublic List<BitcoindRpcClient.Unspent> listUnspent(int minConf, int maxConf, String... addresses) throws GenericRpcException
BitcoindRpcClientlistUnspent in interface BitcoindRpcClientminConf - The minimum number of confirmations the transaction containing an output must have in order to be returned.maxConf - The maximum number of confirmations the transaction containing an output may have in order to be returned.addresses - Only outputs which pay an address in this array will be returnedGenericRpcExceptionpublic boolean move(String fromAccount, String toAddress, BigDecimal amount) throws GenericRpcException
BitcoindRpcClientmove in interface BitcoindRpcClientfromAccount - The name of the account to move the funds fromtoAddress - The name of the account to move the funds toamount - The amount of bitcoins to moveGenericRpcExceptionpublic boolean move(String fromAccount, String toAddress, BigDecimal amount, String comment) throws GenericRpcException
BitcoindRpcClientmove in interface BitcoindRpcClientfromAccount - The name of the account to move the funds fromtoAddress - The name of the account to move the funds toamount - The amount of bitcoins to movecomment - A comment to assign to this move paymentGenericRpcExceptionpublic boolean move(String fromAccount, String toAddress, BigDecimal amount, int minConf) throws GenericRpcException
move in interface BitcoindRpcClientGenericRpcExceptionpublic boolean move(String fromAccount, String toAddress, BigDecimal amount, int minConf, String comment) throws GenericRpcException
move in interface BitcoindRpcClientGenericRpcExceptionpublic String sendFrom(String fromAccount, String toAddress, BigDecimal amount) throws GenericRpcException
BitcoindRpcClientsendFrom in interface BitcoindRpcClientfromAccount - The name of the account from which the bitcoins should be spent.toAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spend in bitcoins.GenericRpcExceptionpublic String sendFrom(String fromAccount, String toAddress, BigDecimal amount, int minConf) throws GenericRpcException
BitcoindRpcClientsendFrom in interface BitcoindRpcClientfromAccount - The name of the account from which the bitcoins should be spent.toAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spend in bitcoins.minConf - The minimum number of confirmations an incoming transaction must have for its outputs to be credited to this account’s balance.GenericRpcExceptionpublic String sendFrom(String fromAccount, String toAddress, BigDecimal amount, int minConf, String comment) throws GenericRpcException
BitcoindRpcClientsendFrom in interface BitcoindRpcClientfromAccount - The name of the account from which the bitcoins should be spent.toAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spend in bitcoins.minConf - The minimum number of confirmations an incoming transaction must have for its outputs to be credited to this account’s balance.comment - A locally-stored (not broadcast) comment assigned to this transaction.GenericRpcExceptionpublic String sendFrom(String fromAccount, String toAddress, BigDecimal amount, int minConf, String comment, String commentTo) throws GenericRpcException
BitcoindRpcClientsendFrom in interface BitcoindRpcClientfromAccount - The name of the account from which the bitcoins should be spent.toAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spend in bitcoins.minConf - The minimum number of confirmations an incoming transaction must have for its outputs to be credited to this account’s balance.comment - A locally-stored (not broadcast) comment assigned to this transaction.commentTo - A locally-stored (not broadcast) comment assigned to this transactionGenericRpcExceptionpublic String sendRawTransaction(String hex) throws GenericRpcException
BitcoindRpcClientsendRawTransaction in interface BitcoindRpcClienthex - The serialized transaction to broadcast encoded as hexGenericRpcExceptionpublic String sendToAddress(String toAddress, BigDecimal amount) throws GenericRpcException
BitcoindRpcClientsendToAddress in interface BitcoindRpcClienttoAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spent in bitcoinsGenericRpcExceptionpublic String sendToAddress(String toAddress, BigDecimal amount, String comment) throws GenericRpcException
BitcoindRpcClientsendToAddress in interface BitcoindRpcClienttoAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spent in bitcoinscomment - A locally-stored (not broadcast) comment assigned to this transaction.GenericRpcExceptionpublic String sendToAddress(String toAddress, BigDecimal amount, String comment, String commentTo) throws GenericRpcException
BitcoindRpcClientsendToAddress in interface BitcoindRpcClienttoAddress - A P2PKH or P2SH address to which the bitcoins should be sentamount - The amount to spent in bitcoinscomment - A locally-stored (not broadcast) comment assigned to this transaction.commentTo - A locally-stored (not broadcast) comment assigned to this transactionGenericRpcExceptionpublic String signRawTransaction(String hex) throws GenericRpcException
GenericRpcExceptionpublic String signRawTransaction(String hex, List<? extends BitcoindRpcClient.TxInput> inputs, List<String> privateKeys) throws GenericRpcException
BitcoindRpcClientsignRawTransaction in interface BitcoindRpcClienthex - The transaction to sign as a serialized transactioninputs - The previous outputs being spent by this transactionprivateKeys - An array holding private keys.GenericRpcExceptionpublic String signRawTransaction(String hex, List<? extends BitcoindRpcClient.TxInput> inputs, List<String> privateKeys, String sigHashType)
public BitcoindRpcClient.RawTransaction decodeRawTransaction(String hex) throws GenericRpcException
GenericRpcExceptionpublic BitcoindRpcClient.AddressValidationResult validateAddress(String address) throws GenericRpcException
BitcoindRpcClientvalidateAddress in interface BitcoindRpcClientaddress - The P2PKH or P2SH address to validate encoded in base58check formatGenericRpcExceptionpublic void setGenerate(boolean b)
throws BitcoinRPCException
setGenerate in interface BitcoindRpcClientBitcoinRPCExceptionpublic List<String> generate(int numBlocks) throws BitcoinRPCException
BitcoindRpcClientgenerate in interface BitcoindRpcClientnumBlocks - The number of blocks to generate.BitcoinRPCExceptionpublic List<String> generate(int numBlocks, long maxTries) throws BitcoinRPCException
BitcoindRpcClientgenerate in interface BitcoindRpcClientnumBlocks - The number of blocks to generate.maxTries - The maximum number of iterations that are tried to create the requested number of blocks.BitcoinRPCExceptionpublic List<String> generateToAddress(int numBlocks, String address) throws BitcoinRPCException
BitcoindRpcClientgenerateToAddress in interface BitcoindRpcClientnumBlocks - The number of blocks to generate.address - The address to send the newly generated Bitcoin toBitcoinRPCExceptionpublic BigDecimal getEstimateFee(int nBlocks) throws GenericRpcException
BitcoindRpcClientgetEstimateFee in interface BitcoindRpcClientnBlocks - The maximum number of blocks a transaction should have to wait before it is predicted to be included in a block.GenericRpcExceptionpublic BigDecimal getEstimatePriority(int nBlocks) throws GenericRpcException
BitcoindRpcClientgetEstimatePriority in interface BitcoindRpcClientnBlocks - The maximum number of blocks a transaction should have to wait before it is predicted to be included in a block based purely on its priorityGenericRpcExceptionpublic void invalidateBlock(String hash) throws GenericRpcException
BitcoindRpcClientinvalidateBlock in interface BitcoindRpcClienthash - the hash of the block to mark as invalid
[TODO] Add to https://bitcoin.org/en/developer-referenceGenericRpcExceptionpublic void reconsiderBlock(String hash) throws GenericRpcException
BitcoindRpcClientreconsiderBlock in interface BitcoindRpcClienthash - The hash of the block to reconsider
[TODO] Add to https://bitcoin.org/en/developer-referenceGenericRpcExceptionpublic List<BitcoindRpcClient.PeerInfoResult> getPeerInfo() throws GenericRpcException
BitcoindRpcClientgetPeerInfo in interface BitcoindRpcClientGenericRpcExceptionpublic void stop()
BitcoindRpcClientstop in interface BitcoindRpcClientpublic String getRawChangeAddress() throws GenericRpcException
BitcoindRpcClientgetRawChangeAddress in interface BitcoindRpcClientGenericRpcExceptionpublic long getConnectionCount()
throws GenericRpcException
BitcoindRpcClientgetConnectionCount in interface BitcoindRpcClientGenericRpcExceptionpublic BigDecimal getUnconfirmedBalance() throws GenericRpcException
BitcoindRpcClientgetUnconfirmedBalance in interface BitcoindRpcClientGenericRpcExceptionpublic BigDecimal getDifficulty() throws GenericRpcException
BitcoindRpcClientgetDifficulty in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.NetTotals getNetTotals() throws GenericRpcException
BitcoindRpcClientgetNetTotals in interface BitcoindRpcClientGenericRpcExceptionpublic BitcoindRpcClient.DecodedScript decodeScript(String hex) throws GenericRpcException
BitcoindRpcClientdecodeScript in interface BitcoindRpcClienthex - The redeem script to decode as a hex-encoded serialized scriptGenericRpcExceptionpublic void ping()
throws GenericRpcException
BitcoindRpcClientping in interface BitcoindRpcClientGenericRpcExceptionpublic boolean getGenerate()
throws BitcoinRPCException
BitcoindRpcClientgetGenerate in interface BitcoindRpcClientBitcoinRPCExceptionpublic BigDecimal getNetworkHashPs() throws GenericRpcException
BitcoindRpcClientgetNetworkHashPs in interface BitcoindRpcClientGenericRpcExceptionpublic boolean setTxFee(BigDecimal amount) throws GenericRpcException
BitcoindRpcClientsetTxFee in interface BitcoindRpcClientamount - The transaction fee to pay, in bitcoins, for each kilobyte of transaction data.GenericRpcExceptionpublic void addNode(String node, String command) throws GenericRpcException
BitcoindRpcClientaddNode in interface BitcoindRpcClientnode - example: "192.168.0.6:8333"command - must be either "add", "remove" or "onetry"GenericRpcExceptionpublic void backupWallet(String destination) throws GenericRpcException
BitcoindRpcClientbackupWallet in interface BitcoindRpcClientdestination - A filename or directory name.GenericRpcExceptionpublic String signMessage(String bitcoinAdress, String message) throws GenericRpcException
BitcoindRpcClientsignMessage in interface BitcoindRpcClientbitcoinAdress - A P2PKH address whose private key belongs to this walletmessage - The message to signGenericRpcExceptionpublic void dumpWallet(String filename) throws GenericRpcException
BitcoindRpcClientdumpWallet in interface BitcoindRpcClientfilename - The file in which the wallet dump will be placed.GenericRpcExceptionpublic void importWallet(String filename) throws GenericRpcException
BitcoindRpcClientimportWallet in interface BitcoindRpcClientfilename - The file to import. The path is relative to Bitcoin Core’s working directoryGenericRpcExceptionpublic void keyPoolRefill()
throws GenericRpcException
BitcoindRpcClientkeyPoolRefill in interface BitcoindRpcClientGenericRpcExceptionpublic void keyPoolRefill(long size)
throws GenericRpcException
GenericRpcExceptionpublic BigDecimal getReceivedByAccount(String account) throws GenericRpcException
BitcoindRpcClientgetReceivedByAccount in interface BitcoindRpcClientaccount - The name of the account containing the addresses to get.GenericRpcExceptionpublic BigDecimal getReceivedByAccount(String account, int minConf) throws GenericRpcException
GenericRpcExceptionpublic void encryptWallet(String passPhrase) throws GenericRpcException
BitcoindRpcClientencryptWallet in interface BitcoindRpcClientpassPhrase - The passphrase to use for the encrypted wallet.GenericRpcExceptionpublic void walletPassPhrase(String passPhrase, long timeOut) throws GenericRpcException
BitcoindRpcClientwalletPassPhrase in interface BitcoindRpcClientpassPhrase - The passphrase that unlocks the wallettimeOut - The number of seconds after which the decryption key will be automatically deleted from memoryGenericRpcExceptionpublic boolean verifyMessage(String bitcoinAddress, String signature, String message) throws GenericRpcException
BitcoindRpcClientverifyMessage in interface BitcoindRpcClientbitcoinAddress - The P2PKH address corresponding to the private key which made the signature.signature - The signature created by the signer encoded as base-64 (the format output by the signmessage RPC)message - The message exactly as it was signedGenericRpcExceptionpublic String addMultiSigAddress(int nRequired, List<String> keyObject) throws GenericRpcException
BitcoindRpcClientaddMultiSigAddress in interface BitcoindRpcClientnRequired - The minimum (m) number of signatures required to spend this m-of-n multisig scriptkeyObject - An array of strings with each string being a public key or addressGenericRpcExceptionpublic String addMultiSigAddress(int nRequired, List<String> keyObject, String account) throws GenericRpcException
BitcoindRpcClientaddMultiSigAddress in interface BitcoindRpcClientnRequired - The minimum (m) number of signatures required to spend this m-of-n multisig scriptkeyObject - An array of strings with each string being a public key or addressaccount - The account name in which the address should be stored.GenericRpcExceptionpublic boolean verifyChain()
BitcoindRpcClientverifyChain in interface BitcoindRpcClientpublic boolean verifyChain(int checklevel,
int numblocks)
public void submitBlock(String hexData)
submitBlock in interface BitcoindRpcClienthexData - public BitcoindRpcClient.Transaction getTransaction(String txId)
BitcoindRpcClientgetTransaction in interface BitcoindRpcClienttxId - The TXID of the transaction to get details about.public BitcoindRpcClient.TxOut getTxOut(String txId, long vout) throws GenericRpcException
BitcoindRpcClientgetTxOut in interface BitcoindRpcClienttxId - The TXID of the transaction containing the output to get, encoded as hex in RPC byte ordervout - The output index number (vout) of the output within the transactionGenericRpcExceptionpublic BitcoindRpcClient.TxOut getTxOut(String txId, long vout, boolean includemempool) throws GenericRpcException
GenericRpcExceptionpublic BitcoindRpcClient.AddressBalance getAddressBalance(String address)
BitcoindRpcClientgetAddressBalance in interface BitcoindRpcClientpublic List<BitcoindRpcClient.AddressUtxo> getAddressUtxo(String address)
BitcoindRpcClientgetAddressUtxo in interface BitcoindRpcClientCopyright © 2018. All rights reserved.