Class RegTestFundingSource
java.lang.Object
org.consensusj.bitcoin.jsonrpc.test.RegTestFundingSource
- All Implemented Interfaces:
FundingSource
FundingSource using RegTest mining, BitcoinExtendedClient (with getRegTestMiningAddress),
and the server's default wallet for accumulating coins.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bitcoinj.base.Address
createFundedAddress
(org.bitcoinj.base.Coin amount) Create an address and fund it with bitcoin.createIngredients
(org.bitcoinj.base.Coin amount) Create everything needed to assemble a custom transactionvoid
An opportunity to do any necessary housekeeping.org.bitcoinj.base.Sha256Hash
requestBitcoin
(org.bitcoinj.base.Address toAddress, org.bitcoinj.base.Coin requestAmount) Generate blocks (if necessary) and fund an address with requested amount of BTC.
-
Field Details
-
client
-
-
Constructor Details
-
RegTestFundingSource
-
-
Method Details
-
requestBitcoin
public org.bitcoinj.base.Sha256Hash requestBitcoin(org.bitcoinj.base.Address toAddress, org.bitcoinj.base.Coin requestAmount) throws JsonRpcException, IOException Generate blocks (if necessary) and fund an address with requested amount of BTC. This will create, sign, and transmit a transaction to fund an address with BTC. This method does not mine a block to confirm the transaction. A separate call toBitcoinExtendedClient.generateBlocks(int)
or equivalent must be made to confirm the transaction.- Specified by:
requestBitcoin
in interfaceFundingSource
- Parameters:
toAddress
- Address to fund with BTCrequestAmount
- Amount of BTC to "mine" and send (minimum ending balance of toAddress?)- Returns:
- The hash of an unconfirmed transaction that provides the funds.
- Throws:
JsonRpcException
IOException
-
createFundedAddress
public org.bitcoinj.base.Address createFundedAddress(org.bitcoinj.base.Coin amount) throws Exception Create an address and fund it with bitcoin. This will create, sign, and transmit a transaction to fund an address with BTC. This method does not mine a block to confirm the transaction. A separate call toBitcoinExtendedClient.generateBlocks(int)
or equivalent must be made to confirm the transaction.- Specified by:
createFundedAddress
in interfaceFundingSource
- Parameters:
amount
- requested amount of BTC- Returns:
- Newly created address that will have the requested amount of bitcoin after the next block is mined
- Throws:
Exception
-
createIngredients
public TransactionIngredients createIngredients(org.bitcoinj.base.Coin amount) throws JsonRpcException, IOException Create everything needed to assemble a custom transaction- Parameters:
amount
- Amount of BTC to be available on new address- Returns:
- An address, private key, and list of unspent outputs
- Throws:
JsonRpcException
IOException
-
fundingSourceMaintenance
Description copied from interface:FundingSource
An opportunity to do any necessary housekeeping. (e.g. consolidation)- Specified by:
fundingSourceMaintenance
in interfaceFundingSource
-