# Trait ethcore::miner::MinerService [−] [src]

    pub trait MinerService: Send + Sync {
        fn status(&self) -> MinerStatus;
        fn author(&self) -> Address;
        fn set_author(&self, author: Address);
        fn set_engine_signer(&self,
                         address: Address,
                         password: String)
                         -> Result<(), SignError>;
        fn extra_data(&self) -> Bytes;
        fn set_extra_data(&self, extra_data: Bytes);
        fn minimal_gas_price(&self) -> U256;
        fn set_minimal_gas_price(&self, min_gas_price: U256);
        fn gas_floor_target(&self) -> U256;
        fn gas_ceil_target(&self) -> U256;
        fn set_gas_floor_target(&self, target: U256);
        fn set_gas_ceil_target(&self, target: U256);
        fn transactions_limit(&self) -> usize;
        fn set_transactions_limit(&self, limit: usize);
        fn set_tx_gas_limit(&self, limit: U256);
        fn import_external_transactions(&self,
                                    chain: &MiningBlockChainClient,
                                    transactions: Vec<UnverifiedTransaction>)
                                    -> Vec<Result<TransactionImportResult, Error>>;
        fn import_own_transaction(&self,
                              chain: &MiningBlockChainClient,
                              transaction: PendingTransaction)
                              -> Result<TransactionImportResult, Error>;
        fn pending_transactions_hashes(&self, best_block: BlockNumber) -> Vec<H256>;
        fn clear_and_reset(&self, chain: &MiningBlockChainClient);
        fn chain_new_blocks(&self,
                        chain: &MiningBlockChainClient,
                        imported: &[H256],
                        invalid: &[H256],
                        enacted: &[H256],
                        retracted: &[H256]);
        fn update_sealing(&self, chain: &MiningBlockChainClient);
        fn submit_seal(&self,
                   chain: &MiningBlockChainClient,
                   pow_hash: H256,
                   seal: Vec<Bytes>)
                   -> Result<(), Error>;
        fn map_sealing_work<F, T>(&self,
                              chain: &MiningBlockChainClient,
                              f: F)
                              -> Option<T> where F: FnOnce(&ClosedBlock) -> T, Self: Sized;
        fn transaction(&self,
                   best_block: BlockNumber,
                   hash: &H256)
                   -> Option<SignedTransaction>;
        fn pending_transactions(&self) -> Vec<PendingTransaction>;
        fn ready_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction>;
        fn future_transactions(&self) -> Vec<PendingTransaction>;
        fn local_transactions(&self) -> BTreeMap<H256, LocalTransactionStatus>;
        fn pending_receipts(&self, best_block: BlockNumber) -> BTreeMap<H256, Receipt>;
        fn pending_receipt(&self,
                       best_block: BlockNumber,
                       hash: &H256)
                       -> Option<RichReceipt>;
        fn last_nonce(&self, address: &Address) -> Option<U256>;
        fn is_sealing(&self) -> bool;
        fn sensible_gas_price(&self) -> U256;
        fn balance(&self, chain: &MiningBlockChainClient, address: &Address) -> U256;
        fn call(&self,
            chain: &MiningBlockChainClient,
            t: &SignedTransaction,
            analytics: CallAnalytics)
            -> Result<Executed, CallError>;
        fn storage_at(&self,
                  chain: &MiningBlockChainClient,
                  address: &Address,
                  position: &H256)
                  -> H256;
        fn nonce(&self, chain: &MiningBlockChainClient, address: &Address) -> U256;
        fn code(&self,
            chain: &MiningBlockChainClient,
            address: &Address)
            -> Option<Bytes>;

        fn sensible_gas_limit(&self) -> U256 { ... }
    }

Miner client API

## Required Methods

### `fn status(&self) -> MinerStatus`

Returns miner's status.

### `fn author(&self) -> Address`

Get the author that we will seal blocks as.

### `fn set_author(&self, author: Address)`

Set the author that we will seal blocks as.

### `fn set_engine_signer(&self,
address: Address,
password: String)
-> Result<(), SignError>`

Set info necessary to sign consensus messages.

### `fn extra_data(&self) -> Bytes`

Get the extra_data that we will seal blocks with.

### `fn set_extra_data(&self, extra_data: Bytes)`

Set the extra_data that we will seal blocks with.

### `fn minimal_gas_price(&self) -> U256`

Get current minimal gas price for transactions accepted to queue.

### `fn set_minimal_gas_price(&self, min_gas_price: U256)`

Set minimal gas price of transaction to be accepted for mining.

### `fn gas_floor_target(&self) -> U256`

Get the lower bound of the gas limit we wish to target when sealing a new block.

### `fn gas_ceil_target(&self) -> U256`

Get the upper bound of the gas limit we wish to target when sealing a new block.

### `fn set_gas_floor_target(&self, target: U256)`

Set the lower bound of gas limit we wish to target when sealing a new block.

### `fn set_gas_ceil_target(&self, target: U256)`

Set the upper bound of gas limit we wish to target when sealing a new block.

### `fn transactions_limit(&self) -> usize`

Get current transactions limit in queue.

### `fn set_transactions_limit(&self, limit: usize)`

Set maximal number of transactions kept in the queue (both current and future).

### `fn set_tx_gas_limit(&self, limit: U256)`

Set maximum amount of gas allowed for any single transaction to mine.

### `fn import_external_transactions(&self,
chain: &MiningBlockChainClient,
transactions: Vec<UnverifiedTransaction>)
-> Vec<Result<TransactionImportResult, Error>>`

Imports transactions to transaction queue.

### `fn import_own_transaction(&self,
chain: &MiningBlockChainClient,
transaction: PendingTransaction)
-> Result<TransactionImportResult, Error>`

Imports own (node owner) transaction to queue.

### `fn pending_transactions_hashes(&self, best_block: BlockNumber) -> Vec<H256>`

Returns hashes of transactions currently in pending

### `fn clear_and_reset(&self, chain: &MiningBlockChainClient)`

Removes all transactions from the queue and restart mining operation.

### `fn chain_new_blocks(&self,
chain: &MiningBlockChainClient,
imported: &[H256],
invalid: &[H256],
enacted: &[H256],
retracted: &[H256])`

Called when blocks are imported to chain, updates transactions queue.

### `fn update_sealing(&self, chain: &MiningBlockChainClient)`

New chain head event. Restart mining operation.

### `fn submit_seal(&self,
chain: &MiningBlockChainClient,
pow_hash: H256,
seal: Vec<Bytes>)
-> Result<(), Error>`

Submit `seal` as a valid solution for the header of `pow_hash`. Will check the seal, but not actually insert the block into the chain.

### `fn map_sealing_work<F, T>(&self,
chain: &MiningBlockChainClient,
f: F)
-> Option<T> where F: FnOnce(&ClosedBlock) -> T, Self: Sized`

Get the sealing work package and if `Some`, apply some transform.

### `fn transaction(&self,
best_block: BlockNumber,
hash: &H256)
-> Option<SignedTransaction>`

Query pending transactions for hash.

### `fn pending_transactions(&self) -> Vec<PendingTransaction>`

Get a list of all pending transactions in the queue.

### `fn ready_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction>`

Get a list of all transactions that can go into the given block.

### `fn future_transactions(&self) -> Vec<PendingTransaction>`

Get a list of all future transactions.

### `fn local_transactions(&self) -> BTreeMap<H256, LocalTransactionStatus>`

Get a list of local transactions with statuses.

### `fn pending_receipts(&self, best_block: BlockNumber) -> BTreeMap<H256, Receipt>`

Get a list of all pending receipts.

### `fn pending_receipt(&self,
best_block: BlockNumber,
hash: &H256)
-> Option<RichReceipt>`

Get a particular reciept.

### `fn last_nonce(&self, address: &Address) -> Option<U256>`

Returns highest transaction nonce for given address.

### `fn is_sealing(&self) -> bool`

Is it currently sealing?

### `fn sensible_gas_price(&self) -> U256`

Suggested gas price.

### `fn balance(&self, chain: &MiningBlockChainClient, address: &Address) -> U256`

Latest account balance in pending state.

### `fn call(&self,
chain: &MiningBlockChainClient,
t: &SignedTransaction,
analytics: CallAnalytics)
-> Result<Executed, CallError>`

Call into contract code using pending state.

### `fn storage_at(&self,
chain: &MiningBlockChainClient,
address: &Address,
position: &H256)
-> H256`

Get storage value in pending state.

### `fn nonce(&self, chain: &MiningBlockChainClient, address: &Address) -> U256`

Get account nonce in pending state.

### `fn code(&self,
chain: &MiningBlockChainClient,
address: &Address)
-> Option<Bytes>`

Get contract code in pending state.

## Provided Methods

### `fn sensible_gas_limit(&self) -> U256`

Suggested gas limit.

## Implementors

- `impl MinerService for Miner`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)