Skip to content

Latest commit

 

History

History
248 lines (139 loc) · 5.34 KB

BlockBuilder.md

File metadata and controls

248 lines (139 loc) · 5.34 KB

@ethereumjs/vm / BlockBuilder

Class: BlockBuilder

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new BlockBuilder(vm, opts)

Parameters

Name Type
vm VM
opts BuildBlockOpts

Defined in

vm/src/buildBlock.ts:76

Properties

blobGasUsed

blobGasUsed: bigint = BIGINT_0

The cumulative blob gas used by the blobs in a block

Defined in

vm/src/buildBlock.ts:52


gasUsed

gasUsed: bigint = BIGINT_0

The cumulative gas used by the transactions added to the block.

Defined in

vm/src/buildBlock.ts:48

Accessors

minerValue

get minerValue(): bigint

Returns

bigint

Defined in

vm/src/buildBlock.ts:72


transactionReceipts

get transactionReceipts(): TxReceipt[]

Returns

TxReceipt[]

Defined in

vm/src/buildBlock.ts:68

Methods

addTransaction

addTransaction(tx, __namedParameters?): Promise<RunTxResult>

Run and add a transaction to the block being built. Please note that this modifies the state of the VM. Throws if the transaction's gasLimit is greater than the remaining gas in the block.

Parameters

Name Type
tx TypedTransaction
__namedParameters Object
__namedParameters.skipHardForkValidation? boolean

Returns

Promise<RunTxResult>

Defined in

vm/src/buildBlock.ts:203


build

build(sealOpts?): Promise<Block>

This method returns the finalized block. It also:

  • Assigns the reward for miner (PoW)
  • Commits the checkpoint on the StateManager
  • Sets the tip of the VM's blockchain to this block For PoW, optionally seals the block with params nonce and mixHash, which is validated along with the block number and difficulty by ethash. For PoA, please pass blockOption.cliqueSigner into the buildBlock constructor, as the signer will be awarded the txs amount spent on gas as they are added.

Parameters

Name Type
sealOpts? SealBlockOpts

Returns

Promise<Block>

Defined in

vm/src/buildBlock.ts:293


getStatus

getStatus(): BlockStatus

Returns

BlockStatus

Defined in

vm/src/buildBlock.ts:128


initState

initState(): Promise<void>

Returns

Promise<void>

Defined in

vm/src/buildBlock.ts:357


logsBloom

logsBloom(): Uint8Array

Calculates and returns the logs bloom for the block.

Returns

Uint8Array

Defined in

vm/src/buildBlock.ts:142


receiptTrie

receiptTrie(): Promise<Uint8Array>

Calculates and returns the receiptTrie for the block.

Returns

Promise<Uint8Array>

Defined in

vm/src/buildBlock.ts:154


revert

revert(): Promise<void>

Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run.

Returns

Promise<void>

Defined in

vm/src/buildBlock.ts:274


transactionsTrie

transactionsTrie(): Promise<Uint8Array>

Calculates and returns the transactionsTrie for the block.

Returns

Promise<Uint8Array>

Defined in

vm/src/buildBlock.ts:135