All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.gstojsic.bitcoin.proxy.BlockchainRpcAsync Maven / Gradle / Ivy

The newest version!
package io.github.gstojsic.bitcoin.proxy;

import io.github.gstojsic.bitcoin.proxy.json.model.Block1;
import io.github.gstojsic.bitcoin.proxy.json.model.Block2;
import io.github.gstojsic.bitcoin.proxy.json.model.BlockFilter;
import io.github.gstojsic.bitcoin.proxy.json.model.BlockHeader;
import io.github.gstojsic.bitcoin.proxy.json.model.BlockStats;
import io.github.gstojsic.bitcoin.proxy.json.model.BlockchainInfo;
import io.github.gstojsic.bitcoin.proxy.json.model.ChainTipData;
import io.github.gstojsic.bitcoin.proxy.json.model.ChainTxStats;
import io.github.gstojsic.bitcoin.proxy.json.model.DumpFile;
import io.github.gstojsic.bitcoin.proxy.json.model.MempoolData;
import io.github.gstojsic.bitcoin.proxy.json.model.MempoolInfo;
import io.github.gstojsic.bitcoin.proxy.json.model.MempoolWithSeq;
import io.github.gstojsic.bitcoin.proxy.json.model.ScanTxOutResult;
import io.github.gstojsic.bitcoin.proxy.json.model.ScanTxOutsetStatus;
import io.github.gstojsic.bitcoin.proxy.json.model.TransactionOutput;
import io.github.gstojsic.bitcoin.proxy.json.model.TransactionOutputSetInfo;
import io.github.gstojsic.bitcoin.proxy.json.model.TxSpendingPrevOutInfo;
import io.github.gstojsic.bitcoin.proxy.model.BlockStatOptions;
import io.github.gstojsic.bitcoin.proxy.model.HashType;
import io.github.gstojsic.bitcoin.proxy.model.PsbtDescriptor;
import io.github.gstojsic.bitcoin.proxy.model.Transaction;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

public interface BlockchainRpcAsync {

    /**
     * 

Calls getbestblockhash method on the bitcoin node which returns the hash of the best (tip) block in the * most-work fully-validated chain.

* Get more info with:
*
client.help(Command.getbestblockhash);
* * @return the block hash, hex-encoded */ CompletableFuture getBestBlockhash(); /** *

Calls getblock method on the bitcoin node which returns a string that is serialized, hex-encoded data for * block ‘hash’.

* Get more info with:
*
client.help(Command.getblock);
* * @param blockhash The block hash * @return A string that is serialized, hex-encoded data for block ‘hash’ */ CompletableFuture getBlock(String blockhash); /** *

Calls getblock method on the bitcoin node which returns an Object with information about block ‘hash’

* Get more info with:
*
client.help(Command.getblock);
* * @param blockhash The block hash * @return an Object with information about block ‘hash’. See {@link Block1} docs */ CompletableFuture getBlockVerbose1(String blockhash); /** *

Calls getblock method on the bitcoin node which returns an Object with information about block ‘hash’ * and information about each transaction.

* Get more info with:
*
client.help(Command.getblock); 
* * @param blockhash The block hash * @return an Object with information about block ‘hash’ and information about each transaction. * For more info check {@link Block2} docs */ CompletableFuture getBlockVerbose2(String blockhash); /** *

Calls getblock method on the bitcoin node which returns an Object with information about blockhash and * information about each transaction, including prevout information for inputs (only for unpruned blocks in the * current best chain).

* Get more info with:
*
client.help(Command.getblock); 
* * @param blockhash The block hash * @return an Object with information about blockhash and information about each transaction, including prevout * information for inputs (only for unpruned blocks in the current best chain). See {@link Block2} docs */ CompletableFuture getBlockVerbose3(String blockhash); /** *

Calls getblockchaininfo method on the bitcoin node which returns an object containing various state info * regarding blockchain processing.

* Get more info with:
*
client.help(Command.getblockchaininfo);
* * @return an object containing various state info regarding blockchain processing. See {@link BlockchainInfo} docs */ CompletableFuture getBlockchainInfo(); /** *

Calls getblockcount method on the bitcoin node which returns the height of the most-work fully-validated chain.

* Get more info with:
*
client.help(Command.getblockcount);
* * @return the height of the most-work fully-validated chain */ CompletableFuture getBlockCount(); /** *

Calls getblockfilter method on the bitcoin node which returns a BIP 157 content filter for a particular block.

* Get more info with:
*
client.help(Command.getblockfilter);
* * @param blockhash The hash of the block * @param filterType The type name of the filter * @return a BIP 157 content filter for a particular block. See {@link BlockFilter} docs */ CompletableFuture getBlockFilter(String blockhash, String filterType); /** *

Calls getblockhash method on the bitcoin node which returns the hash of block in best-block-chain at height provided.

* Get more info with:
*
client.help(Command.getblockhash);
* * @param height The height index * @return the hash of block in best-block-chain at height provided. */ CompletableFuture getBlockhash(int height); /** *

Calls getblockheader method on the bitcoin node which returns a string that is serialized, hex-encoded data for blockheader ‘hash’.

* Get more info with:
*
client.help(Command.getblockheader);
* * @param blockhash The block hash * @return a string that is serialized, hex-encoded data for blockheader ‘hash’. */ CompletableFuture getBlockHeader(String blockhash); /** *

Calls getblockheader method on the bitcoin node which returns an Object with information about blockheader ‘hash’.

* Get more info with:
*
client.help(Command.getblockheader);
* * @param blockhash The block hash * @return an Object with information about blockheader ‘hash’. See {@link BlockFilter} docs */ CompletableFuture getBlockHeaderVerbose(String blockhash); /** *

Calls getblockstats method on the bitcoin node which returns per block statistics for a given window. All amounts are in satoshis.

* Get more info with:
*
client.help(Command.getblockstats);
* * @param hash The block hash of the target block * @param options stats options. default is all values * @return per block statistics for a given window. See {@link BlockStats} docs */ CompletableFuture getBlockStats(String hash, Set options); /** *

Calls getblockstats method on the bitcoin node which returns per block statistics for a given window. All amounts are in satoshis.

* Get more info with:
*
client.help(Command.getblockstats);
* * @param height The height of the target block * @param options stats options. default is all values * @return per block statistics for a given window. See {@link BlockStats} docs */ CompletableFuture getBlockStats(int height, Set options); /** *

Calls getchaintips method on the bitcoin node which returns information about all known tips in the block tree, * including the main chain as well as orphaned branches.

* Get more info with:
*
client.help(Command.getchaintips);
* * @return information about all known tips in the block tree including the main chain as well as orphaned branches. * See {@link ChainTipData} docs */ CompletableFuture> getChainTips(); /** *

Calls getchaintxstats method on the bitcoin node which returns statistics about the total number and rate of * transactions in the chain.

* Get more info with:
*
client.help(Command.getchaintxstats);
* * @param nBlocks Size of the window in number of blocks * @param blockhash The hash of the block that ends the window. * @return statistics about the total number and rate of transactions in the chain. See {@link ChainTxStats} docs */ CompletableFuture getChainTxStats(Integer nBlocks, String blockhash); /** *

Calls getdifficulty method on the bitcoin node which returns the proof-of-work difficulty as a multiple of * the minimum difficulty.

* Get more info with:
*
client.help(Command.getdifficulty);
* * @return the proof-of-work difficulty as a multiple of the minimum difficulty. */ CompletableFuture getDifficulty(); /** *

Calls getmempoolancestors method on the bitcoin node which returns all in-mempool ancestors.

* Get more info with:
*
client.help(Command.getmempoolancestors);
* * @param txId The transaction id (must be in mempool) * @return list of in mempool ancestor transactions */ CompletableFuture> getMempoolAncestors(String txId); /** *

Calls getmempoolancestors method on the bitcoin node which returns all in-mempool ancestors.

* Get more info with:
*
client.help(Command.getmempoolancestors);
* * @param txId The transaction id (must be in mempool) * @return map of in mempool ancestor transactions. Key is transactionId, for value see {@link MempoolData} docs */ CompletableFuture> getMempoolAncestorsVerbose(String txId); /** *

Calls getmempooldescendants method on the bitcoin node which returns all in-mempool descendants.

* Get more info with:
*
client.help(Command.getmempooldescendants);
* * @param txId The transaction id (must be in mempool) * @return list of all in-mempool descendants. */ CompletableFuture> getMempoolDescendants(String txId); /** *

Calls getmempooldescendants method on the bitcoin node which returns all in-mempool descendants.

* Get more info with:
*
client.help(Command.getmempooldescendants);
* * @param txId The transaction id (must be in mempool) * @return map of in mempool descendant transactions. Key is transactionId, for value see {@link MempoolData} docs */ CompletableFuture> getMempoolDescendantsVerbose(String txId); /** *

Calls getmempoolentry method on the bitcoin node which returns mempool data for a given transaction

* Get more info with:
*
client.help(Command.getmempoolentry);
* * @param txId The transaction id (must be in mempool) * @return data about the mempool transaction. See {@link MempoolData} docs */ CompletableFuture getMempoolEntry(String txId); /** *

Calls getmempoolinfo method on the bitcoin node which returns details on the active state of the TX memory pool

* Get more info with:
*
client.help(Command.getmempoolinfo);
* * @return details on the active state of the TX memory pool. See {@link MempoolInfo} docs */ CompletableFuture getMempoolInfo(); /** *

Calls getrawmempool method on the bitcoin node which returns all transaction ids in memory pool as a list * of transaction ids

* Get more info with:
*
client.help(Command.getrawmempool);
* * @return list of transaction ids */ CompletableFuture> getRawMempool(); /** *

Calls getrawmempool method on the bitcoin node which returns all transaction ids in memory pool as a map * of transaction ids to mempool data

* Get more info with:
*
client.help(Command.getrawmempool);
* * @return map of txIds to {@link MempoolData} */ CompletableFuture> getRawMempoolVerbose(); /** *

Calls getrawmempool method on the bitcoin node which returns all transaction ids in memory pool

* Get more info with:
*
client.help(Command.getrawmempool);
* * @return an {@link MempoolWithSeq} object */ CompletableFuture getRawMempoolWithSequence(); /** *

Calls gettxout method on the bitcoin node which returns details about an unspent transaction output

* Get more info with:
*
client.help(Command.gettxout);
* * @param txId the transaction id * @param n vout number * @param includeMempool Whether to include the mempool. * @return details about an unspent transaction output. See {@link TransactionOutput} */ CompletableFuture getTxOut(String txId, int n, Boolean includeMempool); /** *

Calls gettxoutproof method on the bitcoin node which returns a hex-encoded proof that “txid” was included in * a block.

* Get more info with:
*
client.help(Command.gettxoutproof);
* * @param txIds the txids to filter * @param blockhash if specified, looks for txid in the block with this hash * @return A string that is a serialized, hex-encoded data for the proof. */ CompletableFuture getTxOutProof(List txIds, String blockhash); /** *

Calls gettxoutsetinfo method on the bitcoin node which returns statistics about the unspent transaction output set.

* Get more info with:
*
client.help(Command.gettxoutsetinfo);
* * @param hashType which UTXO set hash should be calculated * @param hash hash of target block, or * @param height height of target block * @param useIndex use coinstatsindex, if available. * @return statistics about the unspent transaction output set. See {@link TransactionOutputSetInfo} */ CompletableFuture getTxOutsetInfo( HashType hashType, String hash, Integer height, Boolean useIndex); /** *

Calls gettxspendingprevout method on the bitcoin node which scans the mempool to find transactions spending * any of the given outputs.

* Get more info with:
*
client.help(Command.gettxspendingprevout);
* * @return list of found transactions. See {@link TxSpendingPrevOutInfo} * @since bitcoin core v.24 */ CompletableFuture> getTxSpendingPrevOut(List utxoList); /** *

Calls preciousblock method on the bitcoin node which causes the node to treat a block as if it were received * before others with the same work.

* Get more info with:
*
client.help(Command.preciousblock);
* * @param blockhash the hash of the block to mark as precious * @return void */ CompletableFuture preciousBlock(String blockhash); /** *

Calls pruneblockchain method on the bitcoin node which prunes the stored blockchain

* Get more info with:
*
client.help(Command.pruneblockchain);
* * @param height The block height to prune up to * @return Height of the last block pruned */ CompletableFuture pruneBlockchain(int height); /** *

Calls savemempool method on the bitcoin node which dumps the mempool to disk

* Get more info with:
*
client.help(Command.savemempool);
* * @return the directory and file where the mempool was saved. See {@link DumpFile} */ CompletableFuture saveMempool(); /** *

Calls scantxoutset method on the bitcoin node which starts the scan of the unspent transaction output set for * entries that match certain output descriptors. Action start is implied.

* Get more info with:
*
client.help(Command.scantxoutset);
* * @param scanObjects list of scan objects * @return an object containing the results of the scan. See {@link ScanTxOutResult} */ CompletableFuture scanTxOutset(List scanObjects); /** *

Calls scantxoutset method on the bitcoin node which aborts the scan of the unspent transaction output set for * entries that match certain output descriptors. Action abort is implied.

* Get more info with:
*
client.help(Command.scantxoutset);
* * @return true if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort */ CompletableFuture scanTxOutsetAbort(); /** *

Calls scantxoutset method on the bitcoin node which gets the status of the scan of the unspent transaction * output set for entries that match certain output descriptors. Action status is implied.

* Get more info with:
*
client.help(Command.scantxoutset);
* * @return Approximate percent complete. See {@link ScanTxOutsetStatus} */ CompletableFuture scanTxOutsetStatus(); /** *

Calls verifychain method on the bitcoin node which verifies the blockchain database.

* Get more info with:
*
client.help(Command.verifychain);
* * @param checkLevel the level of how thorough the block verification is * @param nBlocks the number of blocks to check * @return true if the chain is verified */ CompletableFuture verifyChain(int checkLevel, int nBlocks); /** *

Calls verifytxoutproof method on the bitcoin node which verifies that a proof points to a transaction in * a block, returning the transaction it commits to and throwing an RPC error if the block is not in our best chain

* Get more info with:
*
client.help(Command.verifytxoutproof);
* * @param proof The hex-encoded proof generated by gettxoutproof * @return The txid(s) which the proof commits to, or empty list if the proof can not be validated. */ CompletableFuture> verifyTxOutProof(String proof); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy