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
    • Method Detail

      • 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 GenericRpcException
        The 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
      • getBlockCount

        int getBlockCount()
                   throws GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        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.
        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 order
        vout - 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 BitcoinRPCException
        Deprecated.
        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 generatetoaddress
        The 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 BitcoinRPCException
        Deprecated.
        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 generatetoaddress
        The 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 BitcoinRPCException
        The 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 BitcoinRPCException
        The 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
        maxTries - The maximum number of iterations that are tried to create the requested number of blocks.
        Throws:
        BitcoinRPCException
        See Also:
        generatetoaddress
      • 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 GenericRpcException
        Permanently 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 GenericRpcException
        Removes 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.0
        node - 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
      • 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 transaction
        outputs - 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
      • getRawTransactionHex

        java.lang.String getRawTransactionHex​(java.lang.String txId)
                                       throws GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        Deprecated.
        signrawtransaction was removed in v0.18. Clients should transition to using signrawtransactionwithkey and signrawtransactionwithwallet
        The 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 transaction
        inputs - The previous outputs being spent by this transaction
        privateKeys - 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 string
        privateKeys - List of base58-encoded private keys for signing
        prevTxs - 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 script
        keys - 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
      • 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 script
        keyObject - 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 script
        keyObject - An array of strings with each string being a public key or address
        account - 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 GenericRpcException
        The 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 GenericRpcException
        Deprecated.
        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 GenericRpcException
        Deprecated.
        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 GenericRpcException
        Deprecated.
        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​(java.lang.String account)
                                 throws GenericRpcException
        The 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 GenericRpcException
        The 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​(java.lang.String account)
                                throws GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        The 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
        minConf - 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
      • importAddress

        java.lang.Object importAddress​(java.lang.String address,
                                       java.lang.String account,
                                       boolean rescan)
                                throws GenericRpcException
        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.
        Parameters:
        address - Either a P2PKH or P2SH address encoded in base58check, or a pubkey script encoded as hex
        account - 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 GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        The 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 GenericRpcException
        Deprecated.
        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 GenericRpcException
        Deprecated.
        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 GenericRpcException
        Deprecated.
        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
      • 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​(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​(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​(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 GenericRpcException
        The 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 GenericRpcException
        Deprecated.
        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 from
        toAccount - The name of the account to move the funds to
        amount - 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 GenericRpcException
        Deprecated.
        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 from
        toAccount - The name of the account to move the funds to
        amount - The amount of bitcoins to move
        comment - 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,
                     java.lang.String comment)
              throws GenericRpcException
        Deprecated.
        Throws:
        GenericRpcException
        See Also:
        move
      • sendFrom

        @Deprecated
        java.lang.String sendFrom​(java.lang.String fromAccount,
                                  java.lang.String toAddress,
                                  java.math.BigDecimal amount)
                           throws GenericRpcException
        Deprecated.
        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 sent
        amount - 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 GenericRpcException
        Deprecated.
        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 sent
        amount - 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 GenericRpcException
        Deprecated.
        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 sent
        amount - 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 GenericRpcException
        Deprecated.
        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 sent
        amount - 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 GenericRpcException
        The sendtoaddress RPC spends an amount to a given address.
        Parameters:
        toAddress - A P2PKH or P2SH address to which the bitcoins should be sent
        amount - 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 GenericRpcException
        The sendtoaddress RPC spends an amount to a given address.
        Parameters:
        toAddress - A P2PKH or P2SH address to which the bitcoins should be sent
        amount - The amount to spent in bitcoins
        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:
        sendtoaddress
      • sendToAddress

        java.lang.String sendToAddress​(java.lang.String toAddress,
                                       java.math.BigDecimal amount,
                                       java.lang.String comment,
                                       java.lang.String commentTo)
                                throws GenericRpcException
        The sendtoaddress RPC spends an amount to a given address.
        Parameters:
        toAddress - A P2PKH or P2SH address to which the bitcoins should be sent
        amount - The amount to spent in bitcoins
        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:
        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 wallet
        message - 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 wallet
        timeOut - 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
        In the above, 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
      • 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 GenericRpcException
        Deprecated.
        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