io.github.gstojsic.bitcoin.proxy.MiningRpcAsync Maven / Gradle / Ivy
Show all versions of proxy Show documentation
package io.github.gstojsic.bitcoin.proxy;
import io.github.gstojsic.bitcoin.proxy.json.model.BlockTemplate;
import io.github.gstojsic.bitcoin.proxy.json.model.MiningInfo;
import io.github.gstojsic.bitcoin.proxy.model.MiningTemplate;
import java.util.concurrent.CompletableFuture;
public interface MiningRpcAsync {
/**
* Calls getblocktemplate method on the bitcoin node which returns data needed to construct a block to work on
* Get more info with:
* client.help(Command.getblocktemplate);
*
* @param templateRequest the template request. for details check bitcoin node docs.
* @return data needed to construct a block to work on. See {@link BlockTemplate}
*/
CompletableFuture getBlockTemplate(MiningTemplate templateRequest);
/**
* Calls getblocktemplate method on the bitcoin node which returns data needed to construct a block to work on
* Get more info with:
* client.help(Command.getblocktemplate);
*
* @param templateRequest the template request. for details check bitcoin node docs.
* @return null if proposal was accepted, else a string according to BIP22
*/
CompletableFuture getBlockTemplateProposal(MiningTemplate templateRequest);
/**
* Calls getmininginfo method on the bitcoin node which returns mining-related information./p>
* Get more info with:
*
client.help(Command.getmininginfo);
*
* @return object containing mining-related information. See {@link MiningInfo}
*/
CompletableFuture getMiningInfo();
/**
* Calls getnetworkhashps method on the bitcoin node which returns the estimated network hashes per second
* based on the last n blocks
* Get more info with:
* client.help(Command.getnetworkhashps);
*
* @param nBlocks the number of blocks, or -1 for blocks since last difficulty change.
* @param height to estimate at the time of the given height
* @return hashes per second estimated
*/
CompletableFuture getNetworkHashPs(Integer nBlocks, Integer height);
/**
* Calls prioritisetransaction method on the bitcoin node which accepts the transaction into mined blocks at
* a higher (or lower) priority
* Get more info with:
* client.help(Command.prioritisetransaction);
*
* @param txId the id of the transaction
* @param feeDelta the fee value (in satoshis) to add (or subtract, if negative)
* @return true if successful
*/
CompletableFuture prioritiseTransaction(String txId, int feeDelta);
/**
* Calls submitheader method on the bitcoin node which attempts to submit new block to network.
* Get more info with:
* client.help(Command.submitblock);
*
* @param hexData the hex-encoded block data to submit
* @return null if valid, a string according to BIP22 otherwise
*/
CompletableFuture submitBlock(String hexData);
/**
* Calls submitheader method on the bitcoin node which decodes the given hexdata as a header and submits it
* as a candidate chain tip if valid
* Get more info with:
* client.help(Command.submitheader);
*
* @param hexData the hex-encoded block header data
* @return void
*/
CompletableFuture submitHeader(String hexData);
}