Package wf.bitcoin.javabitcoindrpcclient
Interface BitcoindRpcClient
-
- All Known Implementing Classes:
BitcoinJSONRPCClient
public interface BitcoindRpcClient- Author:
- Mikhail Yevchenko m.ṥῥẚɱ.ѓѐḿởύḙ@azazar.com Small modifications by Alessandro Polverini polverini at gmail.com
-
-
Nested Class Summary
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.BooleanabortScanTxOutSet()Aborts the current scanBitcoindRpcClient.MultiSigaddMultiSigAddress(int nRequired, java.util.List<java.lang.String> keyObject)The addmultisigaddress RPC adds a P2SH multisig address to the wallet.BitcoindRpcClient.MultiSigaddMultiSigAddress(int nRequired, java.util.List<java.lang.String> keyObject, java.lang.String account)Deprecated.voidaddNode(java.lang.String node, java.lang.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.voidbackupWallet(java.lang.String destination)The backupwallet RPC safely copies wallet.dat to the specified file, which can be a directory or a path with filename.BitcoindRpcClient.MultiSigcreateMultiSig(int nRequired, java.util.List<java.lang.String> keys)The createmultisig RPC creates a P2SH multi-signature address.java.lang.StringcreateRawTransaction(java.util.List<BitcoindRpcClient.TxInput> inputs, java.util.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.DecodedScriptdecodeScript(java.lang.String hex)The decodescript RPC decodes a hex-encoded P2SH redeem script.java.lang.StringdumpPrivKey(java.lang.String address)The dumpprivkey RPC returns the wallet-import-format (WIF) private key corresponding to an address.voiddumpWallet(java.lang.String filename)The dumpwallet RPC creates or overwrites a file with all wallet keys in a human-readable format.voidencryptWallet(java.lang.String passPhrase)The encryptwallet RPC encrypts the wallet with a passphrase.java.math.BigDecimalestimateFee(int nBlocks)Deprecated.BitcoindRpcClient.SmartFeeResultestimateSmartFee(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.java.util.List<java.lang.String>generate(int numBlocks)Deprecated.The wallet generate rpc method is deprecated and will be fully removed in v0.19.java.util.List<java.lang.String>generate(int numBlocks, long maxTries)Deprecated.The wallet generate rpc method is deprecated and will be fully removed in v0.19.java.util.List<java.lang.String>generateToAddress(int numBlocks, java.lang.String address)The generatetoaddress RPC mines blocks immediately to a specified address.java.util.List<java.lang.String>generateToAddress(int numBlocks, java.lang.String address, long maxTries)The generatetoaddress RPC mines blocks immediately to a specified address.java.lang.StringgetAccount(java.lang.String address)Deprecated.java.lang.StringgetAccountAddress(java.lang.String account)Deprecated.java.util.List<BitcoindRpcClient.NodeInfo>getAddedNodeInfo(boolean details, java.lang.String node)The getaddednodeinfo RPC returns information about the given added node, or all added nodes (except onetry nodes).java.util.List<java.lang.String>getAddressesByAccount(java.lang.String account)Deprecated.BitcoindRpcClient.AddressInfogetAddressInfo(java.lang.String address)java.math.BigDecimalgetBalance()The getbalance RPC gets the balance in decimal bitcoins for the default account.java.math.BigDecimalgetBalance(java.lang.String account)The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.java.math.BigDecimalgetBalance(java.lang.String account, int minConf)The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.java.lang.StringgetBestBlockHash()The getbestblockhash RPC returns the header hash of the most recent block on the best block chain.BitcoindRpcClient.BlockgetBlock(int height)Gets a block at the given height from the local block database.BitcoindRpcClient.BlockgetBlock(java.lang.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.BlockChainInfogetBlockChainInfo()The getblockchaininfo RPC provides information about the current state of the block chain.intgetBlockCount()The getblockcount RPC returns the number of blocks in the local best block chain.java.lang.StringgetBlockHash(int height)The getblockhash RPC returns the header hash of a block at the given height in the local best block chain.longgetConnectionCount()The getconnectioncount RPC returns the number of connections to other nodes.java.math.BigDecimalgetDifficulty()The getdifficulty RPCBitcoindRpcClient.MiningInfogetMiningInfo()The getmininginfo RPC returns various mining-related information.BitcoindRpcClient.NetTotalsgetNetTotals()The getnettotals RPC returns information about network traffic, including bytes in, bytes out, and the current time.java.math.BigDecimalgetNetworkHashPs()The getnetworkhashps RPC returns the estimated current or historical network hashes per second based on the last n blocks.BitcoindRpcClient.NetworkInfogetNetworkInfo()The getnetworkinfo RPC returns information about the node’s connection to the network.java.lang.StringgetNewAddress()The getnewaddress RPC returns a new Bitcoin address for receiving payments.java.lang.StringgetNewAddress(java.lang.String account)The getnewaddress RPC returns a new Bitcoin address for receiving payments.java.lang.StringgetNewAddress(java.lang.String account, java.lang.String addressType)The getnewaddress RPC returns a new Bitcoin address for receiving payments.java.util.List<BitcoindRpcClient.PeerInfoResult>getPeerInfo()The getpeerinfo RPC returns data about each connected network node.java.lang.StringgetRawBlock(java.lang.String blockHash)The getblock RPC gets a block with a particular header hash from the local block database as a serialized block.java.lang.StringgetRawChangeAddress()The getrawchangeaddress RPC returns a new Bitcoin address for receiving change.java.util.List<java.lang.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.RawTransactiongetRawTransaction(java.lang.String txId)The getrawtransaction RPC gets a hex-encoded serialized transaction or a JSON object describing the transaction.java.lang.StringgetRawTransactionHex(java.lang.String txId)The getrawtransaction RPC gets a hex-encoded serialized transaction.java.util.List<BitcoindRpcClient.RawTransaction>getRawTransactions(java.util.List<java.lang.String> txIds)Get list of raw transactionsjava.math.BigDecimalgetReceivedByAccount(java.lang.String account)Deprecated.java.math.BigDecimalgetReceivedByAddress(java.lang.String address)The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations.java.math.BigDecimalgetReceivedByAddress(java.lang.String address, int minConf)The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations.BitcoindRpcClient.TransactiongetTransaction(java.lang.String txId)The gettransaction RPC gets detailed information about an in-wallet transaction.BitcoindRpcClient.TxOutgetTxOut(java.lang.String txId, long vout)The gettxout RPC returns details about an unspent transaction output (UTXO).BitcoindRpcClient.TxOutSetInfogetTxOutSetInfo()The gettxoutsetinfo RPC returns statistics about the confirmed unspent transaction output (UTXO) set.java.math.BigDecimalgetUnconfirmedBalance()The getunconfirmedbalance RPC returns the wallet’s total unconfirmed balance.BitcoindRpcClient.WalletInfogetWalletInfo()The getwalletinfo RPC provides information about the wallet.java.lang.ObjectimportAddress(java.lang.String address, java.lang.String account, 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.voidimportPrivKey(java.lang.String bitcoinPrivKey)The importprivkey RPC adds a private key to your wallet.voidimportPrivKey(java.lang.String bitcoinPrivKey, java.lang.String account)The importprivkey RPC adds a private key to your wallet.voidimportPrivKey(java.lang.String bitcoinPrivKey, java.lang.String account, boolean rescan)The importprivkey RPC adds a private key to your wallet.voidimportWallet(java.lang.String filename)The importwallet RPC imports private keys from a file in wallet dump file format (see the dumpwallet RPC).voidinvalidateBlock(java.lang.String blockHash)Permanently marks a block as invalid, as if it violated a consensus rule.voidkeyPoolRefill()The keypoolrefill RPC fills the cache of unused pre-generated keys (the keypool).java.util.Map<java.lang.String,java.lang.Number>listAccounts()Deprecated.java.util.Map<java.lang.String,java.lang.Number>listAccounts(int minConf)Deprecated.java.util.Map<java.lang.String,java.lang.Number>listAccounts(int minConf, boolean watchonly)Deprecated.java.util.List<BitcoindRpcClient.LockedUnspent>listLockUnspent()The listlockunspent RPC returns a list of temporarily unspendable (locked) outputs.java.util.List<BitcoindRpcClient.ReceivedAddress>listReceivedByAddress()The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.java.util.List<BitcoindRpcClient.ReceivedAddress>listReceivedByAddress(int minConf)The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.java.util.List<BitcoindRpcClient.ReceivedAddress>listReceivedByAddress(int minConf, boolean includeEmpty)The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.BitcoindRpcClient.TransactionsSinceBlocklistSinceBlock()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.TransactionsSinceBlocklistSinceBlock(java.lang.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.TransactionsSinceBlocklistSinceBlock(java.lang.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.BitcoindRpcClient.TransactionsSinceBlocklistSinceBlock(java.lang.String blockHash, int targetConfirmations, boolean includeWatchOnly)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.java.util.List<BitcoindRpcClient.Transaction>listTransactions()The listtransactions RPC returns the most recent transactions that affect the wallet.java.util.List<BitcoindRpcClient.Transaction>listTransactions(java.lang.String account)The listtransactions RPC returns the most recent transactions that affect the wallet.java.util.List<BitcoindRpcClient.Transaction>listTransactions(java.lang.String account, int count)The listtransactions RPC returns the most recent transactions that affect the wallet.java.util.List<BitcoindRpcClient.Transaction>listTransactions(java.lang.String account, int count, int skip)The listtransactions RPC returns the most recent transactions that affect the wallet.java.util.List<BitcoindRpcClient.Unspent>listUnspent()The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.java.util.List<BitcoindRpcClient.Unspent>listUnspent(int minConf)The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.java.util.List<BitcoindRpcClient.Unspent>listUnspent(int minConf, int maxConf)The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.java.util.List<BitcoindRpcClient.Unspent>listUnspent(int minConf, int maxConf, java.lang.String... addresses)The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.booleanlockUnspent(boolean unlock, java.lang.String txid, int vout)The lockunspent RPC temporarily locks or unlocks specified transaction outputs.booleanmove(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount)Deprecated.booleanmove(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, int minConf)Deprecated.booleanmove(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, int minConf, java.lang.String comment)Deprecated.booleanmove(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, java.lang.String comment)Deprecated.voidping()The ping RPC sends a P2P ping message to all connected nodes to measure ping time.voidreconsiderBlock(java.lang.String blockHash)Removes invalidity status of a block and its descendants, reconsider them for activation.BitcoindRpcClient.UtxoSetscanTxOutSet(java.util.List<BitcoindRpcClient.ScanObject> scanObjects)The scantxoutset RPC scans the unspent transaction output set for entries that match certain output descriptors.BitcoindRpcClient.UtxoSetscanTxOutSetAddresses(java.util.List<java.lang.String> addresses)Convenience method for retrieving UTXO SET for a list of addresses.BitcoindRpcClient.UtxoSetscanTxOutSetPubKey(java.lang.String pubkey, int range)Convenience method for retrieving UTXO SET (P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs) for a given pubkey.java.lang.IntegerscanTxOutSetStatus()Returns the status for progress report (in %) of the current scan.java.lang.StringsendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount)Deprecated.java.lang.StringsendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf)Deprecated.java.lang.StringsendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf, java.lang.String comment)Deprecated.java.lang.StringsendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf, java.lang.String comment, java.lang.String commentTo)Deprecated.java.lang.StringsendRawTransaction(java.lang.String hex)The sendrawtransaction RPC validates a transaction and broadcasts it to the peer-to-peer network.java.lang.StringsendToAddress(java.lang.String toAddress, java.math.BigDecimal amount)The sendtoaddress RPC spends an amount to a given address.java.lang.StringsendToAddress(java.lang.String toAddress, java.math.BigDecimal amount, java.lang.String comment)The sendtoaddress RPC spends an amount to a given address.java.lang.StringsendToAddress(java.lang.String toAddress, java.math.BigDecimal amount, java.lang.String comment, java.lang.String commentTo)The sendtoaddress RPC spends an amount to a given address.booleansetTxFee(java.math.BigDecimal amount)The settxfee RPC sets the transaction fee per kilobyte paid by transactions created by this wallet.java.lang.StringsignMessage(java.lang.String adress, java.lang.String message)The signmessage RPC signs a message with the private key of an address.java.lang.StringsignRawTransaction(java.lang.String hex, java.util.List<? extends BitcoindRpcClient.TxInput> inputs, java.util.List<java.lang.String> privateKeys)Deprecated.signrawtransaction was removed in v0.18.BitcoindRpcClient.SignedRawTransactionsignRawTransactionWithKey(java.lang.String hex, java.util.List<java.lang.String> privateKeys, java.util.List<? extends BitcoindRpcClient.TxInput> prevTxs, SignatureHashType sigHashType)The signrawtransactionwithkey RPC sign inputs for raw transaction (serialized, hex-encoded).voidstop()The stop RPC safely shuts down the Bitcoin Core server.voidsubmitBlock(java.lang.String hexData)The submitblock RPC accepts a block, verifies it is a valid addition to the block chain, and broadcasts it to the network.BitcoindRpcClient.AddressValidationResultvalidateAddress(java.lang.String address)The validateaddress RPC returns information about the given Bitcoin address.booleanverifyChain()The verifychain RPC verifies each entry in the local block chain database.booleanverifyMessage(java.lang.String address, java.lang.String signature, java.lang.String message)The verifymessage RPC verifies a signed message.voidwalletPassPhrase(java.lang.String passPhrase, long timeOut)The walletpassphrase RPC stores the wallet decryption key in memory for the indicated number of seconds.
-
-
-
Method Detail
-
getBestBlockHash
java.lang.String getBestBlockHash() throws GenericRpcExceptionThe getbestblockhash RPC returns the header hash of the most recent block on the best block chain.- Throws:
GenericRpcException- See Also:
- getbestblockhash
-
getBlock
BitcoindRpcClient.Block getBlock(int height) throws GenericRpcException
Gets a block at the given height from the local block database. This is a convenience method as a combination ofgetBlockHash(int)andgetBlock(String).- Throws:
GenericRpcException- See Also:
- getblockhash, getblock
-
getBlock
BitcoindRpcClient.Block getBlock(java.lang.String blockHash) throws GenericRpcException
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.- Parameters:
blockHash- The hash of the header of the block to get, encoded as hex in RPC byte order- Throws:
GenericRpcException- See Also:
- getblock
-
getRawBlock
java.lang.String getRawBlock(java.lang.String blockHash) throws GenericRpcExceptionThe getblock RPC gets a block with a particular header hash from the local block database as a serialized block.- Parameters:
blockHash- The hash of the header of the block to get, encoded as hex in RPC byte order- Throws:
GenericRpcException- See Also:
- getblock
-
getBlockChainInfo
BitcoindRpcClient.BlockChainInfo getBlockChainInfo() throws GenericRpcException
The getblockchaininfo RPC provides information about the current state of the block chain.- Returns:
- Information about the current state of the local block chain
- Throws:
GenericRpcException- See Also:
- getblockchaininfo
-
getAddressInfo
BitcoindRpcClient.AddressInfo getAddressInfo(java.lang.String address) throws GenericRpcException
- Parameters:
address- The bitcoin address to get the information of- Returns:
- Return information about the given bitcoin address. Some information requires the address to be in the wallet
- Throws:
GenericRpcException- See Also:
- getaddressinfo
-
getBlockCount
int getBlockCount() throws GenericRpcExceptionThe getblockcount RPC returns the number of blocks in the local best block chain.- Returns:
- The number of blocks in the local best block chain.
- Throws:
GenericRpcException- See Also:
- getblockcount
-
getBlockHash
java.lang.String getBlockHash(int height) throws GenericRpcExceptionThe getblockhash RPC returns the header hash of a block at the given height in the local best block chain.- Parameters:
height- The height of the block whose header hash should be returned.- Returns:
- The hash of the block at the requested height, encoded as hex in RPC byte order, or JSON null if an error occurred
- Throws:
GenericRpcException- See Also:
- getblockhash
-
getDifficulty
java.math.BigDecimal getDifficulty()
The getdifficulty RPC- Returns:
- The difficulty of creating a block with the same target threshold (nBits) as the highest-height block in the local best block chain.
- See Also:
- getdifficulty
-
getRawMemPool
java.util.List<java.lang.String> getRawMemPool() throws GenericRpcExceptionThe 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.- Returns:
- An array of TXIDs belonging to transactions in the memory pool.
- Throws:
GenericRpcException- See Also:
- getrawmempool
-
getTxOut
BitcoindRpcClient.TxOut getTxOut(java.lang.String txId, long vout)
The gettxout RPC returns details about an unspent transaction output (UTXO).- Parameters:
txId- 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 transaction- Returns:
- Information about the output.
- See Also:
- gettxout
-
getTxOutSetInfo
BitcoindRpcClient.TxOutSetInfo getTxOutSetInfo()
The gettxoutsetinfo RPC returns statistics about the confirmed unspent transaction output (UTXO) set. Note that this call may take some time and that it only counts outputs from confirmed transactions—it does not count outputs from the memory pool.- Returns:
- Information about the UTXO set
- See Also:
- gettxoutsetinfo
-
verifyChain
boolean verifyChain()
The verifychain RPC verifies each entry in the local block chain database.- See Also:
- verifychain [TODO] Add parameters checkLevel, numOfBlocks
-
stop
void stop()
The stop RPC safely shuts down the Bitcoin Core server.- See Also:
- stop
-
generate
@Deprecated java.util.List<java.lang.String> generate(int numBlocks) throws BitcoinRPCExceptionDeprecated.The wallet generate rpc method is deprecated and will be fully removed in v0.19. To use generate in v0.18, restart bitcoind with -deprecatedrpc=generate. Clients should transition to using the node rpc method generatetoaddressThe generate RPC nearly instantly generates blocks.- Parameters:
numBlocks- The number of blocks to generate.- Returns:
- An array containing the block header hashes of the generated blocks
- Throws:
BitcoinRPCException- See Also:
- generate
-
generate
@Deprecated java.util.List<java.lang.String> generate(int numBlocks, long maxTries) throws BitcoinRPCExceptionDeprecated.The wallet generate rpc method is deprecated and will be fully removed in v0.19. To use generate in v0.18, restart bitcoind with -deprecatedrpc=generate. Clients should transition to using the node rpc method generatetoaddressThe generate RPC nearly instantly generates blocks.- Parameters:
numBlocks- The number of blocks to generate.maxTries- The maximum number of iterations that are tried to create the requested number of blocks.- Returns:
- An array containing the block header hashes of the generated blocks
- Throws:
BitcoinRPCException- See Also:
- generate
-
generateToAddress
java.util.List<java.lang.String> generateToAddress(int numBlocks, java.lang.String address) throws BitcoinRPCExceptionThe generatetoaddress RPC mines blocks immediately to a specified address.- Parameters:
numBlocks- The number of blocks to generate.address- The address to send the newly generated Bitcoin to- Throws:
BitcoinRPCException- See Also:
- generatetoaddress
-
generateToAddress
java.util.List<java.lang.String> generateToAddress(int numBlocks, java.lang.String address, long maxTries) throws BitcoinRPCExceptionThe generatetoaddress RPC mines blocks immediately to a specified address.- Parameters:
numBlocks- The number of blocks to generate.address- The address to send the newly generated Bitcoin tomaxTries- The maximum number of iterations that are tried to create the requested number of blocks.- Throws:
BitcoinRPCException- See Also:
- generatetoaddress
-
getMiningInfo
BitcoindRpcClient.MiningInfo getMiningInfo() throws GenericRpcException
The getmininginfo RPC returns various mining-related information.- Returns:
- Various mining-related information
- Throws:
GenericRpcException- See Also:
- getmininginfo
-
getNetworkHashPs
java.math.BigDecimal getNetworkHashPs()
The getnetworkhashps RPC returns the estimated current or historical network hashes per second based on the last n blocks.- Returns:
- The estimated number of hashes per second based on the parameters provided.
- See Also:
- getgenerate [TODO] Add parameters blocks, height
-
submitBlock
void submitBlock(java.lang.String hexData)
The submitblock RPC accepts a block, verifies it is a valid addition to the block chain, and broadcasts it to the network.- Parameters:
hexData- The full block to submit in serialized block format as hex- See Also:
- submitblock
-
invalidateBlock
void invalidateBlock(java.lang.String blockHash) throws GenericRpcExceptionPermanently marks a block as invalid, as if it violated a consensus rule.- Parameters:
blockHash- the hash of the block to mark as invalid [TODO] Add to https://bitcoin.org/en/developer-reference- Throws:
GenericRpcException
-
reconsiderBlock
void reconsiderBlock(java.lang.String blockHash) throws GenericRpcExceptionRemoves invalidity status of a block and its descendants, reconsider them for activation. This can be used to undo the effects of invalidateblock.- Parameters:
blockHash- The hash of the block to reconsider [TODO] Add to https://bitcoin.org/en/developer-reference- Throws:
GenericRpcException
-
addNode
void addNode(java.lang.String node, java.lang.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.- Parameters:
node- The node to add as a string in the form of: . command- What to do with the IP address above.- See Also:
- addnode
-
getAddedNodeInfo
java.util.List<BitcoindRpcClient.NodeInfo> getAddedNodeInfo(boolean details, java.lang.String node)
The getaddednodeinfo RPC returns information about the given added node, or all added nodes (except onetry nodes). Only nodes which have been manually added using the addnode RPC will have their information displayed.- Parameters:
details- Removed in Bitcoin Core 0.14.0node- The node to get information about in the same: format as the addnode RPC. - Returns:
- An array containing objects describing each added node.
- See Also:
- getaddednodeinfo
-
getConnectionCount
long getConnectionCount()
The getconnectioncount RPC returns the number of connections to other nodes.- Returns:
- The total number of connections to other nodes (both inbound and outbound)
- See Also:
- getconnectioncount
-
getNetTotals
BitcoindRpcClient.NetTotals getNetTotals()
The getnettotals RPC returns information about network traffic, including bytes in, bytes out, and the current time.- Returns:
- An object containing information about the node’s network totals
- See Also:
- getnettotals
-
getNetworkInfo
BitcoindRpcClient.NetworkInfo getNetworkInfo() throws GenericRpcException
The getnetworkinfo RPC returns information about the node’s connection to the network.- Returns:
- Information about this node’s connection to the network
- Throws:
GenericRpcException- See Also:
- getnetworkinfo
-
getPeerInfo
java.util.List<BitcoindRpcClient.PeerInfoResult> getPeerInfo()
The getpeerinfo RPC returns data about each connected network node.- Returns:
- An array of objects each describing one connected node.
- See Also:
- getpeerinfo
-
ping
void ping()
The ping RPC sends a P2P ping message to all connected nodes to measure ping time. Results are provided by the getpeerinfo RPC pingtime and pingwait fields as decimal seconds.- See Also:
- ping
-
createRawTransaction
java.lang.String createRawTransaction(java.util.List<BitcoindRpcClient.TxInput> inputs, java.util.List<BitcoindRpcClient.TxOutput> outputs) throws GenericRpcException
The createrawtransaction RPC creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network.- Parameters:
inputs- An array of objects, each one to be used as an input to the transactionoutputs- The addresses and amounts to pay- Returns:
- The resulting unsigned raw transaction in serialized transaction format encoded as hex.
- Throws:
GenericRpcException- See Also:
- createrawtransaction
-
decodeScript
BitcoindRpcClient.DecodedScript decodeScript(java.lang.String hex)
The decodescript RPC decodes a hex-encoded P2SH redeem script.- Parameters:
hex- The redeem script to decode as a hex-encoded serialized script- Returns:
- An object describing the decoded script, or JSON null if the script could not be decoded
- See Also:
- decodescript
-
getRawTransaction
BitcoindRpcClient.RawTransaction getRawTransaction(java.lang.String txId) throws GenericRpcException
The getrawtransaction RPC gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Bitcoin Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default txindex=1 in your Bitcoin Core startup settings.- Parameters:
txId- The TXID of the transaction to get, encoded as hex in RPC byte order- Throws:
GenericRpcException- See Also:
- getrawtransaction
-
getRawTransactions
java.util.List<BitcoindRpcClient.RawTransaction> getRawTransactions(java.util.List<java.lang.String> txIds) throws GenericRpcException
Get list of raw transactions- Parameters:
txIds- The TXIDs of the transactions to get, encoded as hex in RPC byte order- Throws:
GenericRpcException- See Also:
for details
-
getRawTransactionHex
java.lang.String getRawTransactionHex(java.lang.String txId) throws GenericRpcExceptionThe getrawtransaction RPC gets a hex-encoded serialized transaction.- Parameters:
txId- The TXID of the transaction to get, encoded as hex in RPC byte order- Throws:
GenericRpcException- See Also:
- getrawtransaction
-
sendRawTransaction
java.lang.String sendRawTransaction(java.lang.String hex) throws GenericRpcExceptionThe sendrawtransaction RPC validates a transaction and broadcasts it to the peer-to-peer network.- Parameters:
hex- The serialized transaction to broadcast encoded as hex- Returns:
- If the transaction was accepted by the node for broadcast, this will be the TXID of the transaction encoded as hex in RPC byte order.
- Throws:
GenericRpcException- See Also:
- sendrawtransaction
-
signRawTransaction
@Deprecated java.lang.String signRawTransaction(java.lang.String hex, java.util.List<? extends BitcoindRpcClient.TxInput> inputs, java.util.List<java.lang.String> privateKeys) throws GenericRpcExceptionDeprecated.signrawtransaction was removed in v0.18. Clients should transition to using signrawtransactionwithkey and signrawtransactionwithwalletThe signrawtransaction RPC signs a transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.- Parameters:
hex- The transaction to sign as a serialized transactioninputs- The previous outputs being spent by this transactionprivateKeys- An array holding private keys.- Returns:
- The results of the signature
- Throws:
GenericRpcException- See Also:
- signrawtransaction
-
signRawTransactionWithKey
BitcoindRpcClient.SignedRawTransaction signRawTransactionWithKey(java.lang.String hex, java.util.List<java.lang.String> privateKeys, java.util.List<? extends BitcoindRpcClient.TxInput> prevTxs, SignatureHashType sigHashType)
The signrawtransactionwithkey RPC sign inputs for raw transaction (serialized, hex-encoded).- Parameters:
hex- The transaction hex stringprivateKeys- List of base58-encoded private keys for signingprevTxs- List of previous transaction outputs that this transaction depends on but may not yet be in the block chain (optional)sigHashType- The signature hash type (optional, default = ALL)- Returns:
- The results of the signature
- See Also:
- Bitcoin Core Documentation for signrawtransactionwithkey
-
createMultiSig
BitcoindRpcClient.MultiSig createMultiSig(int nRequired, java.util.List<java.lang.String> keys) throws GenericRpcException
The createmultisig RPC creates a P2SH multi-signature address.- Parameters:
nRequired- 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 address- Throws:
GenericRpcException- See Also:
- createmultisig
-
estimateSmartFee
BitcoindRpcClient.SmartFeeResult estimateSmartFee(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. Uses virtual transaction size as defined in BIP 141 (witness data is discounted).- Parameters:
blocks- Confirmation target in blocks- Returns:
- estimate fee rate in BTC/kB [TODO] Add to https://bitcoin.org/en/developer-reference
-
validateAddress
BitcoindRpcClient.AddressValidationResult validateAddress(java.lang.String address) throws GenericRpcException
The validateaddress RPC returns information about the given Bitcoin address.- Parameters:
address- The P2PKH or P2SH address to validate encoded in base58check format- Returns:
- Information about the address
- Throws:
GenericRpcException- See Also:
- validateaddress
-
verifyMessage
boolean verifyMessage(java.lang.String address, java.lang.String signature, java.lang.String message)The verifymessage RPC verifies a signed message.- Parameters:
address- 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 signed- See Also:
- verifymessage
-
addMultiSigAddress
BitcoindRpcClient.MultiSig addMultiSigAddress(int nRequired, java.util.List<java.lang.String> keyObject)
The addmultisigaddress RPC adds a P2SH multisig address to the wallet.- Parameters:
nRequired- 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 address- Returns:
- The P2SH multisig address.
- See Also:
- addmultisigaddress
-
addMultiSigAddress
@Deprecated BitcoindRpcClient.MultiSig addMultiSigAddress(int nRequired, java.util.List<java.lang.String> keyObject, java.lang.String account)
Deprecated.The addmultisigaddress RPC adds a P2SH multisig address to the wallet.- Parameters:
nRequired- 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.- Returns:
- The P2SH multisig address.
- See Also:
- addmultisigaddress
-
backupWallet
void backupWallet(java.lang.String destination)
The backupwallet RPC safely copies wallet.dat to the specified file, which can be a directory or a path with filename.- Parameters:
destination- A filename or directory name.- See Also:
- backupwallet
-
dumpPrivKey
java.lang.String dumpPrivKey(java.lang.String address) throws GenericRpcExceptionThe dumpprivkey RPC returns the wallet-import-format (WIF) private key corresponding to an address. (But does not remove it from the wallet.)- Parameters:
address- The P2PKH address corresponding to the private key you want returned.- Throws:
GenericRpcException- See Also:
- dumpprivkey
-
dumpWallet
void dumpWallet(java.lang.String filename)
The dumpwallet RPC creates or overwrites a file with all wallet keys in a human-readable format.- Parameters:
filename- The file in which the wallet dump will be placed.- See Also:
- dumpwallet
-
encryptWallet
void encryptWallet(java.lang.String passPhrase)
The encryptwallet RPC encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys.- Parameters:
passPhrase- The passphrase to use for the encrypted wallet.- See Also:
- encryptwallet
-
getAccount
@Deprecated java.lang.String getAccount(java.lang.String address) throws GenericRpcExceptionDeprecated.The getaccount RPC returns the name of the account associated with the given address.- Parameters:
address- A P2PKH or P2SH Bitcoin address belonging either to a specific account or the default account- Returns:
- The name of an account, or an empty string
- Throws:
GenericRpcException- See Also:
- getaccount
-
getAccountAddress
@Deprecated java.lang.String getAccountAddress(java.lang.String account) throws GenericRpcExceptionDeprecated.The getaccountaddress RPC returns the current Bitcoin address for receiving payments to this account. If the account doesn’t exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address.- Parameters:
account- The name of an account.- Returns:
- An address, belonging to the account specified, which has not yet received any payments
- Throws:
GenericRpcException- See Also:
- getaccountaddress
-
getAddressesByAccount
@Deprecated java.util.List<java.lang.String> getAddressesByAccount(java.lang.String account) throws GenericRpcExceptionDeprecated.The getaddressesbyaccount RPC returns a list of every address assigned to a particular account.- Parameters:
account- The name of an account to get the balance for.- Throws:
GenericRpcException- See Also:
- getaddressesbyaccount
-
getBalance
java.math.BigDecimal getBalance() throws GenericRpcExceptionThe getbalance RPC gets the balance in decimal bitcoins for the default account.- Throws:
GenericRpcException- See Also:
- getbalance
-
getBalance
java.math.BigDecimal getBalance(java.lang.String account) throws GenericRpcExceptionThe getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.- Parameters:
account- The name of an account to get the balance for.- Throws:
GenericRpcException- See Also:
- getbalance
-
getBalance
java.math.BigDecimal getBalance(java.lang.String account, int minConf) throws GenericRpcExceptionThe getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.- Parameters:
account- The name of an account to get the balance for.minConf- The minimum number of confirmations- Throws:
GenericRpcException- See Also:
- getbalance
-
getNewAddress
java.lang.String getNewAddress() throws GenericRpcExceptionThe getnewaddress RPC returns a new Bitcoin address for receiving payments.- Throws:
GenericRpcException- See Also:
- getnewaddress
-
getNewAddress
java.lang.String getNewAddress(java.lang.String account) throws GenericRpcExceptionThe getnewaddress RPC returns a new Bitcoin address for receiving payments. If an account is specified, payments received with the address will be credited to that account.- Throws:
GenericRpcException- See Also:
- getnewaddress
-
getNewAddress
java.lang.String getNewAddress(java.lang.String account, java.lang.String addressType) throws GenericRpcExceptionThe getnewaddress RPC returns a new Bitcoin address for receiving payments. If an account is specified, payments received with the address will be credited to that account. The address type to use. Options are "legacy", "p2sh-segwit", and "bech32".- Throws:
GenericRpcException- See Also:
- getnewaddress
-
getRawChangeAddress
java.lang.String getRawChangeAddress()
The getrawchangeaddress RPC returns a new Bitcoin address for receiving change. This is for use with raw transactions, not normal use.- Returns:
- A P2PKH address which has not previously been returned by this RPC.
- See Also:
- getrawchangeaddress
-
getReceivedByAccount
@Deprecated java.math.BigDecimal getReceivedByAccount(java.lang.String account)
Deprecated.The getreceivedbyaccount RPC returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations.- Parameters:
account- The name of the account containing the addresses to get.- Returns:
- The number of bitcoins received by the account.
- See Also:
- getreceivedbyaccount
-
getReceivedByAddress
java.math.BigDecimal getReceivedByAddress(java.lang.String address) throws GenericRpcExceptionThe getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions.- Parameters:
address- The address whose transactions should be tallied- Returns:
- The number of bitcoins received by the address
- Throws:
GenericRpcException- See Also:
- getreceivedbyaddress
-
getReceivedByAddress
java.math.BigDecimal getReceivedByAddress(java.lang.String address, int minConf) throws GenericRpcExceptionThe getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions.- Parameters:
address- The address whose transactions should be talliedminConf- The minimum number of confirmations- Returns:
- The number of bitcoins received by the address
- Throws:
GenericRpcException- See Also:
- getreceivedbyaddress
-
getTransaction
BitcoindRpcClient.Transaction getTransaction(java.lang.String txId)
The gettransaction RPC gets detailed information about an in-wallet transaction.- Parameters:
txId- The TXID of the transaction to get details about.- See Also:
- gettransaction
-
getUnconfirmedBalance
java.math.BigDecimal getUnconfirmedBalance()
The getunconfirmedbalance RPC returns the wallet’s total unconfirmed balance.- Returns:
- The total number of bitcoins paid to this wallet in unconfirmed transactions
- See Also:
- getunconfirmedbalance
-
getWalletInfo
BitcoindRpcClient.WalletInfo getWalletInfo()
The getwalletinfo RPC provides information about the wallet.- Returns:
- An object describing the wallet
- See Also:
- getwalletinfo
-
importAddress
java.lang.Object importAddress(java.lang.String address, java.lang.String account, boolean rescan) throws GenericRpcExceptionThe 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.- Parameters:
address- Either a P2PKH or P2SH address encoded in base58check, or a pubkey script encoded as hexaccount- An account name into which the address should be placed.rescan- Set to true (the default) to rescan the entire local block database- Returns:
- Null on success
- Throws:
GenericRpcException- See Also:
- importaddress [TODO] Should this really return Object?
-
importPrivKey
void importPrivKey(java.lang.String bitcoinPrivKey) throws GenericRpcExceptionThe importprivkey RPC adds a private key to your wallet. The key should be formatted in the wallet import format created by the dumpprivkey RPC.- Parameters:
bitcoinPrivKey- The private key to import into the wallet encoded in base58check using wallet import format (WIF)- Throws:
GenericRpcException- See Also:
- importprivkey
-
importPrivKey
void importPrivKey(java.lang.String bitcoinPrivKey, java.lang.String account) throws GenericRpcExceptionThe importprivkey RPC adds a private key to your wallet. The key should be formatted in the wallet import format created by the dumpprivkey RPC.- Parameters:
bitcoinPrivKey- The private key to import into the wallet encoded in base58check using wallet import format (WIF)account- The name of an account to which transactions involving the key should be assigned.- Throws:
GenericRpcException- See Also:
- importprivkey
-
importPrivKey
void importPrivKey(java.lang.String bitcoinPrivKey, java.lang.String account, boolean rescan) throws GenericRpcExceptionThe importprivkey RPC adds a private key to your wallet. The key should be formatted in the wallet import format created by the dumpprivkey RPC.- Parameters:
bitcoinPrivKey- The private key to import into the wallet encoded in base58check using wallet import format (WIF)account- 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.- Throws:
GenericRpcException- See Also:
- importprivkey
-
importWallet
void importWallet(java.lang.String filename)
The importwallet RPC imports private keys from a file in wallet dump file format (see the dumpwallet RPC). These keys will be added to the keys currently in the wallet.- Parameters:
filename- The file to import. The path is relative to Bitcoin Core’s working directory- See Also:
- importwallet
-
keyPoolRefill
void keyPoolRefill()
The keypoolrefill RPC fills the cache of unused pre-generated keys (the keypool).- See Also:
- keypoolrefill
-
listAccounts
@Deprecated java.util.Map<java.lang.String,java.lang.Number> listAccounts() throws GenericRpcExceptionDeprecated.The listaccounts RPC lists accounts and their balances.- Returns:
- Map that has account names as keys, account balances as values
- Throws:
GenericRpcException- See Also:
- listaccounts
-
listAccounts
@Deprecated java.util.Map<java.lang.String,java.lang.Number> listAccounts(int minConf) throws GenericRpcExceptionDeprecated.The listaccounts RPC lists accounts and their balances.- Parameters:
minConf- The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.- Returns:
- Map that has account names as keys, account balances as values
- Throws:
GenericRpcException- See Also:
- listaccounts
-
listAccounts
@Deprecated java.util.Map<java.lang.String,java.lang.Number> listAccounts(int minConf, boolean watchonly) throws GenericRpcExceptionDeprecated.The listaccounts RPC lists accounts and their balances.- Parameters:
minConf- The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.watchonly- Include balances in watch-only addresses.- Returns:
- Map that has account names as keys, account balances as values
- Throws:
GenericRpcException- See Also:
- listaccounts
-
listLockUnspent
java.util.List<BitcoindRpcClient.LockedUnspent> listLockUnspent()
The listlockunspent RPC returns a list of temporarily unspendable (locked) outputs.- See Also:
- listlockunspent
-
listReceivedByAddress
java.util.List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress() throws GenericRpcException
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.- Returns:
- An array containing objects each describing a particular address
- Throws:
GenericRpcException- See Also:
- listreceivedbyaddress
-
listReceivedByAddress
java.util.List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress(int minConf) throws GenericRpcException
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.- Parameters:
minConf- The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.- Returns:
- An array containing objects each describing a particular address
- Throws:
GenericRpcException- See Also:
- listreceivedbyaddress
-
listReceivedByAddress
java.util.List<BitcoindRpcClient.ReceivedAddress> listReceivedByAddress(int minConf, boolean includeEmpty) throws GenericRpcException
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.- Parameters:
minConf- 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.- Returns:
- An array containing objects each describing a particular address
- Throws:
GenericRpcException- See Also:
- listreceivedbyaddress
-
listSinceBlock
BitcoindRpcClient.TransactionsSinceBlock listSinceBlock() throws GenericRpcException
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.- Returns:
- An object containing an array of transactions and the lastblock field
- Throws:
GenericRpcException- See Also:
- listsinceblock
-
listSinceBlock
BitcoindRpcClient.TransactionsSinceBlock listSinceBlock(java.lang.String blockHash) throws GenericRpcException
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.- Parameters:
blockHash- The hash of a block header encoded as hex in RPC byte order.- Returns:
- An object containing an array of transactions and the lastblock field
- Throws:
GenericRpcException- See Also:
- listsinceblock
-
listSinceBlock
BitcoindRpcClient.TransactionsSinceBlock listSinceBlock(java.lang.String blockHash, int targetConfirmations) throws GenericRpcException
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.- Parameters:
blockHash- 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.- Returns:
- An object containing an array of transactions and the lastblock field
- Throws:
GenericRpcException- See Also:
- listsinceblock
-
listSinceBlock
BitcoindRpcClient.TransactionsSinceBlock listSinceBlock(java.lang.String blockHash, int targetConfirmations, boolean includeWatchOnly) throws GenericRpcException
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.- Parameters:
blockHash- 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.includeWatchOnly- Include transactions to watch-only addresses- Returns:
- An object containing an array of transactions and the lastblock field
- Throws:
GenericRpcException- See Also:
- listsinceblock, Bitcoin Core Documentation for listsinceblock
-
listTransactions
java.util.List<BitcoindRpcClient.Transaction> listTransactions() throws GenericRpcException
The listtransactions RPC returns the most recent transactions that affect the wallet.- Returns:
- An array containing objects, with each object describing a payment or internal accounting entry (not a transaction).
- Throws:
GenericRpcException- See Also:
- listtransactions
-
listTransactions
java.util.List<BitcoindRpcClient.Transaction> listTransactions(java.lang.String account) throws GenericRpcException
The listtransactions RPC returns the most recent transactions that affect the wallet.- Parameters:
account- The name of an account to get transactinos from (deprecated).- Returns:
- An array containing objects, with each object describing a payment or internal accounting entry (not a transaction).
- Throws:
GenericRpcException- See Also:
- listtransactions
-
listTransactions
java.util.List<BitcoindRpcClient.Transaction> listTransactions(java.lang.String account, int count) throws GenericRpcException
The listtransactions RPC returns the most recent transactions that affect the wallet.- Parameters:
account- The name of an account to get transactinos from (deprecated).count- The number of the most recent transactions to list.- Returns:
- An array containing objects, with each object describing a payment or internal accounting entry (not a transaction).
- Throws:
GenericRpcException- See Also:
- listtransactions
-
listTransactions
java.util.List<BitcoindRpcClient.Transaction> listTransactions(java.lang.String account, int count, int skip) throws GenericRpcException
The listtransactions RPC returns the most recent transactions that affect the wallet.- Parameters:
account- 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.- Returns:
- An array containing objects, with each object describing a payment or internal accounting entry (not a transaction).
- Throws:
GenericRpcException- See Also:
- listtransactions
-
listUnspent
java.util.List<BitcoindRpcClient.Unspent> listUnspent() throws GenericRpcException
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.- Returns:
- An array of objects each describing an unspent output.
- Throws:
GenericRpcException- See Also:
- Developer reference documentation, Bitcoin Core API documentation
-
listUnspent
java.util.List<BitcoindRpcClient.Unspent> listUnspent(int minConf) throws GenericRpcException
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.- Parameters:
minConf- The minimum number of confirmations the transaction containing an output must have in order to be returned.- Returns:
- An array of objects each describing an unspent output.
- Throws:
GenericRpcException- See Also:
- listunspent
-
listUnspent
java.util.List<BitcoindRpcClient.Unspent> listUnspent(int minConf, int maxConf) throws GenericRpcException
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.- Parameters:
minConf- 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.- Returns:
- An array of objects each describing an unspent output.
- Throws:
GenericRpcException- See Also:
- listunspent
-
listUnspent
java.util.List<BitcoindRpcClient.Unspent> listUnspent(int minConf, int maxConf, java.lang.String... addresses) throws GenericRpcException
The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.- Parameters:
minConf- 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 returned- Returns:
- An array of objects each describing an unspent output.
- Throws:
GenericRpcException- See Also:
- listunspent
-
lockUnspent
boolean lockUnspent(boolean unlock, java.lang.String txid, int vout) throws GenericRpcExceptionThe lockunspent RPC temporarily locks or unlocks specified transaction outputs. A locked transaction output will not be chosen by automatic coin selection when spending bitcoins.- Parameters:
unlock- Set to false to lock the outputs specified in the following parameter. Set to true to unlock the outputs specified.txid- The TXID of the transaction containing the output to lock or unlock, encoded as hex.vout- The output index number (vout) of the output to lock or unlock.- Returns:
- true if successful.
- Throws:
GenericRpcException- See Also:
- lockunspent
-
move
@Deprecated boolean move(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount) throws GenericRpcExceptionDeprecated.The move RPC moves a specified amount from one account in your wallet to another using an off-block-chain transaction.- Parameters:
fromAccount- The name of the account to move the funds fromtoAccount- The name of the account to move the funds toamount- The amount of bitcoins to move- Throws:
GenericRpcException- See Also:
- move
-
move
@Deprecated boolean move(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, java.lang.String comment) throws GenericRpcExceptionDeprecated.The move RPC moves a specified amount from one account in your wallet to another using an off-block-chain transaction.- Parameters:
fromAccount- The name of the account to move the funds fromtoAccount- The name of the account to move the funds toamount- The amount of bitcoins to movecomment- A comment to assign to this move payment- Throws:
GenericRpcException- See Also:
- move
-
move
boolean move(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, int minConf) throws GenericRpcExceptionDeprecated.- Throws:
GenericRpcException- See Also:
- move
-
move
boolean move(java.lang.String fromAccount, java.lang.String toAccount, java.math.BigDecimal amount, int minConf, java.lang.String comment) throws GenericRpcExceptionDeprecated.- Throws:
GenericRpcException- See Also:
- move
-
sendFrom
@Deprecated java.lang.String sendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount) throws GenericRpcExceptionDeprecated.The sendfrom RPC spends an amount from a local account to a bitcoin address.- Parameters:
fromAccount- 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.- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendfrom
-
sendFrom
@Deprecated java.lang.String sendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf) throws GenericRpcExceptionDeprecated.The sendfrom RPC spends an amount from a local account to a bitcoin address.- Parameters:
fromAccount- 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.- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendfrom
-
sendFrom
@Deprecated java.lang.String sendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf, java.lang.String comment) throws GenericRpcExceptionDeprecated.The sendfrom RPC spends an amount from a local account to a bitcoin address.- Parameters:
fromAccount- 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.- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendfrom
-
sendFrom
@Deprecated java.lang.String sendFrom(java.lang.String fromAccount, java.lang.String toAddress, java.math.BigDecimal amount, int minConf, java.lang.String comment, java.lang.String commentTo) throws GenericRpcExceptionDeprecated.The sendfrom RPC spends an amount from a local account to a bitcoin address.- Parameters:
fromAccount- 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 transaction- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendfrom
-
sendToAddress
java.lang.String sendToAddress(java.lang.String toAddress, java.math.BigDecimal amount) throws GenericRpcExceptionThe sendtoaddress RPC spends an amount to a given address.- Parameters:
toAddress- A P2PKH or P2SH address to which the bitcoins should be sentamount- The amount to spent in bitcoins- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendtoaddress
-
sendToAddress
java.lang.String sendToAddress(java.lang.String toAddress, java.math.BigDecimal amount, java.lang.String comment) throws GenericRpcExceptionThe sendtoaddress RPC spends an amount to a given address.- Parameters:
toAddress- 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.- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendtoaddress
-
sendToAddress
java.lang.String sendToAddress(java.lang.String toAddress, java.math.BigDecimal amount, java.lang.String comment, java.lang.String commentTo) throws GenericRpcExceptionThe sendtoaddress RPC spends an amount to a given address.- Parameters:
toAddress- 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 transaction- Returns:
- The TXID of the sent transaction, encoded as hex in RPC byte order
- Throws:
GenericRpcException- See Also:
- sendtoaddress
-
setTxFee
boolean setTxFee(java.math.BigDecimal amount)
The settxfee RPC sets the transaction fee per kilobyte paid by transactions created by this wallet.- Parameters:
amount- The transaction fee to pay, in bitcoins, for each kilobyte of transaction data.- See Also:
- settxfee
-
signMessage
java.lang.String signMessage(java.lang.String adress, java.lang.String message)The signmessage RPC signs a message with the private key of an address.- Parameters:
adress- A P2PKH address whose private key belongs to this walletmessage- The message to sign- Returns:
- The signature of the message, encoded in base64.
- See Also:
- signmessage
-
walletPassPhrase
void walletPassPhrase(java.lang.String passPhrase, long timeOut)The walletpassphrase RPC stores the wallet decryption key in memory for the indicated number of seconds. Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one.- Parameters:
passPhrase- The passphrase that unlocks the wallettimeOut- The number of seconds after which the decryption key will be automatically deleted from memory- See Also:
- walletpassphrase
-
scanTxOutSet
BitcoindRpcClient.UtxoSet scanTxOutSet(java.util.List<BitcoindRpcClient.ScanObject> scanObjects)
The scantxoutset RPC scans the unspent transaction output set for entries that match certain output descriptors.Examples of output descriptors are:
- addr(<address>}) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)
- raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts
- combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey
- pkh(<pubkey>) P2PKH outputs for the given pubkey
- sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys
either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one or more path elements separated by "/", and optionally ending in "/*" (unhardened), or "/*'" or "/*h" (hardened) to specify all unhardened or hardened child keys. In the latter case, a range needs to be specified by below if different from 1000. For more information on output descriptors, see the documentation in the doc/descriptors.md file. - Parameters:
scanObjects- Output descriptors- Returns:
- See Also:
- scantxoutset
-
scanTxOutSetStatus
java.lang.Integer scanTxOutSetStatus() throws GenericRpcExceptionReturns the status for progress report (in %) of the current scan.- Returns:
- Throws:
GenericRpcException- See Also:
scanTxOutSet(List)
-
abortScanTxOutSet
java.lang.Boolean abortScanTxOutSet() throws GenericRpcExceptionAborts the current scan- Returns:
- true when abort was successful
- Throws:
GenericRpcException- See Also:
scanTxOutSet(List)
-
scanTxOutSetAddresses
BitcoindRpcClient.UtxoSet scanTxOutSetAddresses(java.util.List<java.lang.String> addresses) throws GenericRpcException
Convenience method for retrieving UTXO SET for a list of addresses. (Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK))- Parameters:
addresses-- Returns:
- Throws:
GenericRpcException- See Also:
scanTxOutSet(List)
-
scanTxOutSetPubKey
BitcoindRpcClient.UtxoSet scanTxOutSetPubKey(java.lang.String pubkey, int range) throws GenericRpcException
Convenience method for retrieving UTXO SET (P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs) for a given pubkey.either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one or more path elements separated by "/", and optionally ending in "/*" (unhardened), or "/*'" or "/*h" (hardened) to specify all unhardened or hardened child keys. - Parameters:
addresses-- Returns:
- Throws:
GenericRpcException- See Also:
scanTxOutSet(List)
-
estimateFee
@Deprecated java.math.BigDecimal estimateFee(int nBlocks) throws GenericRpcExceptionDeprecated.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.- Parameters:
nBlocks- The maximum number of blocks a transaction should have to wait before it is predicted to be included in a block.- Returns:
- The estimated fee the transaction should pay in order to be included within the specified number of blocks.
- Throws:
GenericRpcException- See Also:
- estimatefee
-
-