Struct ethcore::client::Client
[−]
[src]
pub struct Client { /* fields omitted */ }
Blockchain database client backed by a persistent database. Owns and manages a blockchain and a block queue.
Call import_block()
to import a block asynchronously; flush_queue()
flushes the queue.
Methods
impl Client
[src]
impl Client
pub fn new(
config: ClientConfig,
spec: &Spec,
db: Arc<KeyValueDB>,
miner: Arc<Miner>,
message_channel: IoChannel<ClientIoMessage>
) -> Result<Arc<Client>, Error>
[src]
pub fn new(
config: ClientConfig,
spec: &Spec,
db: Arc<KeyValueDB>,
miner: Arc<Miner>,
message_channel: IoChannel<ClientIoMessage>
) -> Result<Arc<Client>, Error>
Create a new client with given parameters. The database is assumed to have been initialized with the correct columns.
pub fn keep_alive(&self)
[src]
pub fn keep_alive(&self)
Wakes up client if it's a sleep.
pub fn add_notify(&self, target: Arc<ChainNotify>)
[src]
pub fn add_notify(&self, target: Arc<ChainNotify>)
Adds an actor to be notified on certain events
pub fn set_exit_handler<F>(&self, f: F) where
F: Fn(String) + 'static + Send,
[src]
pub fn set_exit_handler<F>(&self, f: F) where
F: Fn(String) + 'static + Send,
Set a closure to call when the client wants to be restarted.
The parameter passed to the callback is the name of the new chain spec to use after the restart.
pub fn engine(&self) -> &EthEngine
[src]
pub fn engine(&self) -> &EthEngine
Returns engine reference.
pub fn on_user_defaults_change<F>(&self, f: F) where
F: 'static + FnMut(Option<Mode>) + Send,
[src]
pub fn on_user_defaults_change<F>(&self, f: F) where
F: 'static + FnMut(Option<Mode>) + Send,
Register an action to be done if a mode/spec_name change happens.
pub fn flush_queue(&self)
[src]
pub fn flush_queue(&self)
Flush the block import queue.
pub fn latest_env_info(&self) -> EnvInfo
[src]
pub fn latest_env_info(&self) -> EnvInfo
The env info as of the best block.
pub fn env_info(&self, id: BlockId) -> Option<EnvInfo>
[src]
pub fn env_info(&self, id: BlockId) -> Option<EnvInfo>
The env info as of a given block.
returns None
if the block unknown.
pub fn import_verified_blocks(&self) -> usize
[src]
pub fn import_verified_blocks(&self) -> usize
This is triggered by a message coming from a block queue when the block is ready for insertion
pub fn set_io_channel(&self, io_channel: IoChannel<ClientIoMessage>)
[src]
pub fn set_io_channel(&self, io_channel: IoChannel<ClientIoMessage>)
Replace io channel. Useful for testing.
pub fn latest_state(&self) -> State<StateDB>
[src]
pub fn latest_state(&self) -> State<StateDB>
Get a copy of the best block's state.
pub fn state_at(&self, id: BlockId) -> Option<State<StateDB>>
[src]
pub fn state_at(&self, id: BlockId) -> Option<State<StateDB>>
Attempt to get a copy of a specific block's final state.
This will not fail if given BlockId::Latest. Otherwise, this can fail (but may not) if the DB prunes state or the block is unknown.
pub fn state_at_beginning(&self, id: BlockId) -> Option<State<StateDB>>
[src]
pub fn state_at_beginning(&self, id: BlockId) -> Option<State<StateDB>>
Attempt to get a copy of a specific block's beginning state.
This will not fail if given BlockId::Latest. Otherwise, this can fail (but may not) if the DB prunes state.
ⓘImportant traits for Box<R>pub fn state(&self) -> Box<StateInfo>
[src]
pub fn state(&self) -> Box<StateInfo>
Get a copy of the best block's state.
pub fn blockchain_cache_info(&self) -> BlockChainCacheSize
[src]
pub fn blockchain_cache_info(&self) -> BlockChainCacheSize
Get info on the cache.
pub fn report(&self) -> ClientReport
[src]
pub fn report(&self) -> ClientReport
Get the report.
pub fn tick(&self, prevent_sleep: bool)
[src]
pub fn tick(&self, prevent_sleep: bool)
Tick the client.
pub fn take_snapshot<W: SnapshotWriter + Send>(
&self,
writer: W,
at: BlockId,
p: &Progress
) -> Result<(), EthcoreError>
[src]
pub fn take_snapshot<W: SnapshotWriter + Send>(
&self,
writer: W,
at: BlockId,
p: &Progress
) -> Result<(), EthcoreError>
Take a snapshot at the given block. If the ID given is "latest", this will default to 1000 blocks behind.
pub fn pruning_history(&self) -> u64
[src]
pub fn pruning_history(&self) -> u64
Ask the client what the history parameter is.
Trait Implementations
impl DatabaseRestore for Client
[src]
impl DatabaseRestore for Client
fn restore_db(&self, new_db: &str) -> Result<(), EthcoreError>
[src]
fn restore_db(&self, new_db: &str) -> Result<(), EthcoreError>
Restart the client with a new backend
impl Nonce for Client
[src]
impl Nonce for Client
fn nonce(&self, address: &Address, id: BlockId) -> Option<U256>
[src]
fn nonce(&self, address: &Address, id: BlockId) -> Option<U256>
Attempt to get address nonce at given block. May not fail on BlockId::Latest. Read more
fn latest_nonce(&self, address: &Address) -> U256
[src]
fn latest_nonce(&self, address: &Address) -> U256
Get address nonce at the latest block's state.
impl Balance for Client
[src]
impl Balance for Client
fn balance(&self, address: &Address, state: StateOrBlock) -> Option<U256>
[src]
fn balance(&self, address: &Address, state: StateOrBlock) -> Option<U256>
Get address balance at the given block's state. Read more
fn latest_balance(&self, address: &Address) -> U256
[src]
fn latest_balance(&self, address: &Address) -> U256
Get address balance at the latest block's state.
impl AccountData for Client
[src]
impl AccountData for Client
impl ChainInfo for Client
[src]
impl ChainInfo for Client
fn chain_info(&self) -> BlockChainInfo
[src]
fn chain_info(&self) -> BlockChainInfo
Get blockchain information.
impl BlockInfo for Client
[src]
impl BlockInfo for Client
fn block_header(&self, id: BlockId) -> Option<Header>
[src]
fn block_header(&self, id: BlockId) -> Option<Header>
Get raw block header data by block id.
fn best_block_header(&self) -> Header
[src]
fn best_block_header(&self) -> Header
Get the best block header.
fn block(&self, id: BlockId) -> Option<Block>
[src]
fn block(&self, id: BlockId) -> Option<Block>
Get raw block data by block header hash.
fn code_hash(&self, address: &Address, id: BlockId) -> Option<H256>
[src]
fn code_hash(&self, address: &Address, id: BlockId) -> Option<H256>
Get address code hash at given block's state.
impl TransactionInfo for Client
[src]
impl TransactionInfo for Client
fn transaction_block(&self, id: TransactionId) -> Option<H256>
[src]
fn transaction_block(&self, id: TransactionId) -> Option<H256>
Get the hash of block that contains the transaction, if any.
impl BlockChainTrait for Client
[src]
impl BlockChainTrait for Client
impl RegistryInfo for Client
[src]
impl RegistryInfo for Client
fn registry_address(&self, name: String, block: BlockId) -> Option<Address>
[src]
fn registry_address(&self, name: String, block: BlockId) -> Option<Address>
Get the address of a particular blockchain service, if available.
impl CallContract for Client
[src]
impl CallContract for Client
fn call_contract(
&self,
block_id: BlockId,
address: Address,
data: Bytes
) -> Result<Bytes, String>
[src]
fn call_contract(
&self,
block_id: BlockId,
address: Address,
data: Bytes
) -> Result<Bytes, String>
Like call
, but with various defaults. Designed to be used for calling contracts.
impl ImportBlock for Client
[src]
impl ImportBlock for Client
fn import_block(&self, bytes: Bytes) -> Result<H256, BlockImportError>
[src]
fn import_block(&self, bytes: Bytes) -> Result<H256, BlockImportError>
Import a block into the blockchain.
impl StateClient for Client
[src]
impl StateClient for Client
type State = State<StateDB>
Type representing chain state
fn latest_state(&self) -> Self::State
[src]
fn latest_state(&self) -> Self::State
Get a copy of the best block's state.
fn state_at(&self, id: BlockId) -> Option<Self::State>
[src]
fn state_at(&self, id: BlockId) -> Option<Self::State>
Attempt to get a copy of a specific block's final state. Read more
impl Call for Client
[src]
impl Call for Client
type State = State<StateDB>
Type representing chain state
fn call(
&self,
transaction: &SignedTransaction,
analytics: CallAnalytics,
state: &mut Self::State,
header: &Header
) -> Result<Executed, CallError>
[src]
fn call(
&self,
transaction: &SignedTransaction,
analytics: CallAnalytics,
state: &mut Self::State,
header: &Header
) -> Result<Executed, CallError>
Makes a non-persistent transaction call.
fn call_many(
&self,
transactions: &[(SignedTransaction, CallAnalytics)],
state: &mut Self::State,
header: &Header
) -> Result<Vec<Executed>, CallError>
[src]
fn call_many(
&self,
transactions: &[(SignedTransaction, CallAnalytics)],
state: &mut Self::State,
header: &Header
) -> Result<Vec<Executed>, CallError>
Makes multiple non-persistent but dependent transaction calls. Returns a vector of successes or a failure if any of the transaction fails. Read more
fn estimate_gas(
&self,
t: &SignedTransaction,
state: &Self::State,
header: &Header
) -> Result<U256, CallError>
[src]
fn estimate_gas(
&self,
t: &SignedTransaction,
state: &Self::State,
header: &Header
) -> Result<U256, CallError>
Estimates how much gas will be necessary for a call.
impl EngineInfo for Client
[src]
impl EngineInfo for Client
impl BlockChainClient for Client
[src]
impl BlockChainClient for Client
fn replay(
&self,
id: TransactionId,
analytics: CallAnalytics
) -> Result<Executed, CallError>
[src]
fn replay(
&self,
id: TransactionId,
analytics: CallAnalytics
) -> Result<Executed, CallError>
Replays a given transaction for inspection.
fn replay_block_transactions(
&self,
block: BlockId,
analytics: CallAnalytics
) -> Result<Box<Iterator<Item = Executed>>, CallError>
[src]
fn replay_block_transactions(
&self,
block: BlockId,
analytics: CallAnalytics
) -> Result<Box<Iterator<Item = Executed>>, CallError>
Replays all the transactions in a given block for inspection.
fn mode(&self) -> Mode
[src]
fn mode(&self) -> Mode
Get the mode.
fn disable(&self)
[src]
fn disable(&self)
Disable the client from importing blocks. This cannot be undone in this session and indicates that a subsystem has reason to believe this executable incapable of syncing the chain. Read more
fn set_mode(&self, new_mode: Mode)
[src]
fn set_mode(&self, new_mode: Mode)
Set the mode.
fn spec_name(&self) -> String
[src]
fn spec_name(&self) -> String
Get the chain spec name.
fn set_spec_name(&self, new_spec_name: String)
[src]
fn set_spec_name(&self, new_spec_name: String)
Set the chain via a spec name.
fn block_number(&self, id: BlockId) -> Option<BlockNumber>
[src]
fn block_number(&self, id: BlockId) -> Option<BlockNumber>
Look up the block number for the given block ID.
fn block_body(&self, id: BlockId) -> Option<Body>
[src]
fn block_body(&self, id: BlockId) -> Option<Body>
Get raw block body data by block id. Block body is an RLP list of two items: uncles and transactions. Read more
fn block_status(&self, id: BlockId) -> BlockStatus
[src]
fn block_status(&self, id: BlockId) -> BlockStatus
Get block status by block header hash.
fn block_total_difficulty(&self, id: BlockId) -> Option<U256>
[src]
fn block_total_difficulty(&self, id: BlockId) -> Option<U256>
Get block total difficulty.
fn storage_root(&self, address: &Address, id: BlockId) -> Option<H256>
[src]
fn storage_root(&self, address: &Address, id: BlockId) -> Option<H256>
Attempt to get address storage root at given block. May not fail on BlockId::Latest. Read more
fn block_hash(&self, id: BlockId) -> Option<H256>
[src]
fn block_hash(&self, id: BlockId) -> Option<H256>
Get block hash.
fn code(&self, address: &Address, state: StateOrBlock) -> Option<Option<Bytes>>
[src]
fn code(&self, address: &Address, state: StateOrBlock) -> Option<Option<Bytes>>
Get address code at given block's state.
fn storage_at(
&self,
address: &Address,
position: &H256,
state: StateOrBlock
) -> Option<H256>
[src]
fn storage_at(
&self,
address: &Address,
position: &H256,
state: StateOrBlock
) -> Option<H256>
Get address code hash at given block's state. Get value of the storage at given position at the given block's state. Read more
fn list_accounts(
&self,
id: BlockId,
after: Option<&Address>,
count: u64
) -> Option<Vec<Address>>
[src]
fn list_accounts(
&self,
id: BlockId,
after: Option<&Address>,
count: u64
) -> Option<Vec<Address>>
Get a list of all accounts in the block id
, if fat DB is in operation, otherwise None
. If after
is set the list starts with the following item. Read more
fn list_storage(
&self,
id: BlockId,
account: &Address,
after: Option<&H256>,
count: u64
) -> Option<Vec<H256>>
[src]
fn list_storage(
&self,
id: BlockId,
account: &Address,
after: Option<&H256>,
count: u64
) -> Option<Vec<H256>>
Get a list of all storage keys in the block id
, if fat DB is in operation, otherwise None
. If after
is set the list starts with the following item. Read more
fn transaction(&self, id: TransactionId) -> Option<LocalizedTransaction>
[src]
fn transaction(&self, id: TransactionId) -> Option<LocalizedTransaction>
Get transaction with given hash.
fn uncle(&self, id: UncleId) -> Option<Header>
[src]
fn uncle(&self, id: UncleId) -> Option<Header>
Get uncle with given id.
fn transaction_receipt(&self, id: TransactionId) -> Option<LocalizedReceipt>
[src]
fn transaction_receipt(&self, id: TransactionId) -> Option<LocalizedReceipt>
Get transaction receipt with given hash.
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute>
[src]
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute>
Get a tree route between from
and to
. See BlockChain::tree_route
. Read more
fn find_uncles(&self, hash: &H256) -> Option<Vec<H256>>
[src]
fn find_uncles(&self, hash: &H256) -> Option<Vec<H256>>
Get all possible uncle hashes for a block.
fn state_data(&self, hash: &H256) -> Option<Bytes>
[src]
fn state_data(&self, hash: &H256) -> Option<Bytes>
Get latest state node
fn block_receipts(&self, hash: &H256) -> Option<Bytes>
[src]
fn block_receipts(&self, hash: &H256) -> Option<Bytes>
Get raw block receipts data by block header hash.
fn queue_info(&self) -> BlockQueueInfo
[src]
fn queue_info(&self) -> BlockQueueInfo
Get block queue information.
fn clear_queue(&self)
[src]
fn clear_queue(&self)
Clear block queue and abort all import activity.
fn additional_params(&self) -> BTreeMap<String, String>
[src]
fn additional_params(&self) -> BTreeMap<String, String>
Get the registrar address, if it exists.
fn logs(&self, filter: Filter) -> Vec<LocalizedLogEntry>
[src]
fn logs(&self, filter: Filter) -> Vec<LocalizedLogEntry>
Returns logs matching given filter.
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>>
[src]
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>>
Returns traces matching given filter.
fn trace(&self, trace: TraceId) -> Option<LocalizedTrace>
[src]
fn trace(&self, trace: TraceId) -> Option<LocalizedTrace>
Returns trace with given id.
fn transaction_traces(
&self,
transaction: TransactionId
) -> Option<Vec<LocalizedTrace>>
[src]
fn transaction_traces(
&self,
transaction: TransactionId
) -> Option<Vec<LocalizedTrace>>
Returns traces created by transaction.
fn block_traces(&self, block: BlockId) -> Option<Vec<LocalizedTrace>>
[src]
fn block_traces(&self, block: BlockId) -> Option<Vec<LocalizedTrace>>
Returns traces created by transaction from block.
fn last_hashes(&self) -> LastHashes
[src]
fn last_hashes(&self) -> LastHashes
Get last hashes starting from best block.
fn ready_transactions(&self, max_len: usize) -> Vec<Arc<VerifiedTransaction>>
[src]
fn ready_transactions(&self, max_len: usize) -> Vec<Arc<VerifiedTransaction>>
List all transactions that are allowed into the next block.
fn signing_chain_id(&self) -> Option<u64>
[src]
fn signing_chain_id(&self) -> Option<u64>
Get the preferred chain ID to sign on
fn block_extra_info(&self, id: BlockId) -> Option<BTreeMap<String, String>>
[src]
fn block_extra_info(&self, id: BlockId) -> Option<BTreeMap<String, String>>
Returns engine-related extra info for BlockId
.
fn uncle_extra_info(&self, id: UncleId) -> Option<BTreeMap<String, String>>
[src]
fn uncle_extra_info(&self, id: UncleId) -> Option<BTreeMap<String, String>>
Returns engine-related extra info for UncleId
.
fn pruning_info(&self) -> PruningInfo
[src]
fn pruning_info(&self) -> PruningInfo
Returns information about pruning/data availability.
fn transact_contract(&self, address: Address, data: Bytes) -> Result<(), Error>
[src]
fn transact_contract(&self, address: Address, data: Bytes) -> Result<(), Error>
Schedule state-altering transaction to be executed on the next pending block.
fn registrar_address(&self) -> Option<Address>
[src]
fn registrar_address(&self) -> Option<Address>
Get the address of the registry itself.
fn eip86_transition(&self) -> u64
[src]
fn eip86_transition(&self) -> u64
Get the EIP-86 transition block number.
fn latest_code(&self, address: &Address) -> Option<Bytes>
[src]
fn latest_code(&self, address: &Address) -> Option<Bytes>
Get address code at the latest block's state.
fn latest_storage_at(&self, address: &Address, position: &H256) -> H256
[src]
fn latest_storage_at(&self, address: &Address, position: &H256) -> H256
Get value of the storage at given position at the latest block's state.
fn gas_price_corpus(&self, sample_size: usize) -> Corpus<U256>
[src]
fn gas_price_corpus(&self, sample_size: usize) -> Corpus<U256>
Sorted list of transaction gas prices from at least last sample_size blocks.
impl IoClient for Client
[src]
impl IoClient for Client
fn queue_transactions(&self, transactions: Vec<Bytes>, peer_id: usize)
[src]
fn queue_transactions(&self, transactions: Vec<Bytes>, peer_id: usize)
Queue transactions for importing.
fn queue_ancient_block(
&self,
block_bytes: Bytes,
receipts_bytes: Bytes
) -> Result<H256, BlockImportError>
[src]
fn queue_ancient_block(
&self,
block_bytes: Bytes,
receipts_bytes: Bytes
) -> Result<H256, BlockImportError>
Queue block import with transaction receipts. Does no sealing and transaction validation.
fn queue_consensus_message(&self, message: Bytes)
[src]
fn queue_consensus_message(&self, message: Bytes)
Queue conensus engine message.
impl ReopenBlock for Client
[src]
impl ReopenBlock for Client
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock
[src]
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock
Reopens an OpenBlock and updates uncles.
impl PrepareOpenBlock for Client
[src]
impl PrepareOpenBlock for Client
fn prepare_open_block(
&self,
author: Address,
gas_range_target: (U256, U256),
extra_data: Bytes
) -> OpenBlock
[src]
fn prepare_open_block(
&self,
author: Address,
gas_range_target: (U256, U256),
extra_data: Bytes
) -> OpenBlock
Returns OpenBlock prepared for closing.
impl BlockProducer for Client
[src]
impl BlockProducer for Client
impl ScheduleInfo for Client
[src]
impl ScheduleInfo for Client
fn latest_schedule(&self) -> Schedule
[src]
fn latest_schedule(&self) -> Schedule
Returns latest schedule.
impl ImportSealedBlock for Client
[src]
impl ImportSealedBlock for Client
fn import_sealed_block(&self, block: SealedBlock) -> ImportResult
[src]
fn import_sealed_block(&self, block: SealedBlock) -> ImportResult
Import sealed block. Skips all verifications.
impl BroadcastProposalBlock for Client
[src]
impl BroadcastProposalBlock for Client
fn broadcast_proposal_block(&self, block: SealedBlock)
[src]
fn broadcast_proposal_block(&self, block: SealedBlock)
Broadcast a block proposal.
impl SealedBlockImporter for Client
[src]
impl SealedBlockImporter for Client
impl TransactionVerifierClient for Client
[src]
impl TransactionVerifierClient for Client
impl BlockChainClient for Client
[src]
impl BlockChainClient for Client
impl EngineClient for Client
[src]
impl EngineClient for Client
fn update_sealing(&self)
[src]
fn update_sealing(&self)
Make a new block and seal it.
fn submit_seal(&self, block_hash: H256, seal: Vec<Bytes>)
[src]
fn submit_seal(&self, block_hash: H256, seal: Vec<Bytes>)
Submit a seal for a block in the mining queue.
fn broadcast_consensus_message(&self, message: Bytes)
[src]
fn broadcast_consensus_message(&self, message: Bytes)
Broadcast a consensus message to the network.
fn epoch_transition_for(&self, parent_hash: H256) -> Option<EpochTransition>
[src]
fn epoch_transition_for(&self, parent_hash: H256) -> Option<EpochTransition>
Get the transition to the epoch the given parent hash is part of or transitions to. This will give the epoch that any children of this parent belong to. Read more
fn as_full_client(&self) -> Option<&BlockChainClient>
[src]
fn as_full_client(&self) -> Option<&BlockChainClient>
Attempt to cast the engine client to a full client.
fn block_number(&self, id: BlockId) -> Option<BlockNumber>
[src]
fn block_number(&self, id: BlockId) -> Option<BlockNumber>
Get a block number by ID.
fn block_header(&self, id: BlockId) -> Option<Header>
[src]
fn block_header(&self, id: BlockId) -> Option<Header>
Get raw block header data by block id.
impl ProvingBlockChainClient for Client
[src]
impl ProvingBlockChainClient for Client
fn prove_storage(
&self,
key1: H256,
key2: H256,
id: BlockId
) -> Option<(Vec<Bytes>, H256)>
[src]
fn prove_storage(
&self,
key1: H256,
key2: H256,
id: BlockId
) -> Option<(Vec<Bytes>, H256)>
Prove account storage at a specific block id. Read more
fn prove_account(
&self,
key1: H256,
id: BlockId
) -> Option<(Vec<Bytes>, BasicAccount)>
[src]
fn prove_account(
&self,
key1: H256,
id: BlockId
) -> Option<(Vec<Bytes>, BasicAccount)>
Prove account existence at a specific block id. The key is the keccak hash of the account's address. Returns a vector of raw trie nodes (in order from the root) proving the query. Read more
fn prove_transaction(
&self,
transaction: SignedTransaction,
id: BlockId
) -> Option<(Bytes, Vec<DBValue>)>
[src]
fn prove_transaction(
&self,
transaction: SignedTransaction,
id: BlockId
) -> Option<(Bytes, Vec<DBValue>)>
Prove execution of a transaction at the given block. Returns the output of the call and a vector of database items necessary to reproduce it. Read more
fn epoch_signal(&self, hash: H256) -> Option<Vec<u8>>
[src]
fn epoch_signal(&self, hash: H256) -> Option<Vec<u8>>
Get an epoch change signal by block hash.
impl Drop for Client
[src]
impl Drop for Client