public interface TestBlockchain
| Modifier and Type | Interface and Description |
|---|---|
static class |
TestBlockchain.GenesisAccount |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
createAccount()
Creates a new account.
|
java.lang.String |
enableOracle()
Enables the oracle service.
|
java.lang.String |
execCommand(java.lang.String... commandParts)
Executes the given command.
|
java.lang.String |
fastForward(int n)
Fast-forwards the blockchain state by
n blocks. |
java.lang.String |
fastForward(int seconds,
int n)
Mints
n blocks with the last block being seconds in the future. |
java.lang.String |
getAccount(java.lang.String address)
Gets the private key corresponding to the given address.
|
TestBlockchain.GenesisAccount |
getGenesisAccount()
Gets the genesis account this blockchain is based on.
|
java.lang.String |
getNodeUrl() |
java.lang.String |
halt()
Halts the blockchain, i.e., stops block production.
|
java.lang.String |
resume()
Resumes the blockchain if it was stopped before.
|
void |
start()
Starts the blockchain, i.e., the process that includes the blockchain.
|
void |
stop()
Stops the blockchain, i.e., the process that includes the blockchain.
|
TestBlockchain |
withBatchFile(java.lang.String batchFile)
Adds the given batch file to the blockchain.
|
TestBlockchain |
withCheckpoint(java.lang.String checkpointFile)
Adds the given checkpoint file to the blockchain.
|
TestBlockchain |
withConfigFile(java.lang.String configFile)
Adds the given config file to the blockchain.
|
TestBlockchain |
withSecondsPerBlock(int secondsPerBlock)
Sets the given block time to be used by the blockchain.
|
TestBlockchain withSecondsPerBlock(int secondsPerBlock)
secondsPerBlock - the block time.TestBlockchain withBatchFile(java.lang.String batchFile)
The batch file must be located in the resources directory.
batchFile - the batch file name.TestBlockchain withCheckpoint(java.lang.String checkpointFile)
The checkpoint file must be located in the resources directory.
If both a batch and a checkpoint file are added, the checkpoint is first applied.
checkpointFile - the checkpoint file name.TestBlockchain withConfigFile(java.lang.String configFile)
The file must be located in the resources directory.
configFile - the config file name.java.lang.String getNodeUrl()
java.lang.String resume()
throws java.lang.Exception
java.lang.Exception - if an error occurred when trying to resume the blockchain.java.lang.String halt()
throws java.lang.Exception
java.lang.Exception - if an error occurred when trying to halt the blockchain.java.lang.String createAccount()
throws java.lang.Exception
java.lang.Exception - if an error occurred when trying to create an account.java.lang.String enableOracle()
throws java.lang.Exception
java.lang.Exception - if an error occurred when trying to enable the oracle service.java.lang.String fastForward(int n)
throws java.lang.Exception
n blocks. I.e., mints n empty blocks.n - the number of blocks to mint.java.lang.Exception - if an error occurred when trying to fast-forward the blockchain.java.lang.String fastForward(int seconds,
int n)
throws java.lang.Exception
n blocks with the last block being seconds in the future.seconds - the time delta in seconds from now.n - the number of blocks to mint.java.lang.Exception - if an error occurred when minting the blocks.java.lang.String execCommand(java.lang.String... commandParts)
throws java.lang.Exception
commandParts - the command separated into its parts.java.lang.Exception - if an error occurred when trying to execute the command on the blockchain.void start()
void stop()
TestBlockchain.GenesisAccount getGenesisAccount() throws java.lang.Exception
This is for test blockchains that provide control over the genesis account. The genesis account owns all NEO and GAS tokens starting from the first block.
java.lang.Exception - if an error occurred when trying to fetch the genesis account.java.lang.String getAccount(java.lang.String address)
throws java.lang.Exception
This is not meant to be used for multi-sig accounts.
address - the account's address.java.lang.Exception - if an error occurred when trying to fetch the account.