Block
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:296
A Block represents the data associated with a full block on Ethereum.
Extended by
Section titled “Extended by”Implements
Section titled “Implements”BlockParams
Iterable
<string
>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Block(block, provider): Block;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:401
Create a new Block object.
This should generally not be necessary as the unless implementing a low-level library.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
block | BlockParams |
provider | Provider |
Returns
Section titled “Returns”Block
Properties
Section titled “Properties”baseFeePerGas
Section titled “baseFeePerGas”readonly baseFeePerGas: null | bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:394
The base fee per gas that all transactions in this block were charged.
This adjusts after each block, depending on how congested the network is.
Implementation of
Section titled “Implementation of”blobGasUsed
Section titled “blobGasUsed”readonly blobGasUsed: null | bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:367
The total amount of blob gas consumed by the transactions within the block. See [[link-eip-4844]].
Implementation of
Section titled “Implementation of”difficulty
Section titled “difficulty”readonly difficulty: bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:345
The difficulty target.
On legacy networks, this is the proof-of-work target required for a block to meet the protocol rules to be included.
On modern networks, this is a random number arrived at using randao. @TODO: Find links?
Implementation of
Section titled “Implementation of”excessBlobGas
Section titled “excessBlobGas”readonly excessBlobGas: null | bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:372
The running total of blob gas consumed in excess of the target, prior to the block. See [[link-eip-4844]].
Implementation of
Section titled “Implementation of”extraData
Section titled “extraData”readonly extraData: string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:386
Any extra data the validator wished to include.
Implementation of
Section titled “Implementation of”gasLimit
Section titled “gasLimit”readonly gasLimit: bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:349
The total gas limit for this block.
Implementation of
Section titled “Implementation of”gasUsed
Section titled “gasUsed”readonly gasUsed: bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:353
The total gas used in this block.
Implementation of
Section titled “Implementation of”readonly hash: null | string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:314
The block hash.
This hash includes all properties, so can be safely used to identify an exact set of block properties.
Implementation of
Section titled “Implementation of”readonly miner: string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:377
The miner coinbase address, wihch receives any subsidies for including this block.
Implementation of
Section titled “Implementation of”readonly nonce: string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:335
The nonce.
On legacy networks, this is the random number inserted which permitted the difficulty target to be reached.
Implementation of
Section titled “Implementation of”number
Section titled “number”readonly number: number;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:307
The block number, sometimes called the block height. This is a sequential number that is one higher than the parent block.
Implementation of
Section titled “Implementation of”parentBeaconBlockRoot
Section titled “parentBeaconBlockRoot”parentBeaconBlockRoot: null | string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:328
The hash tree root of the parent beacon block for the given execution block. See [[link-eip-4788]].
Implementation of
Section titled “Implementation of”BlockParams
.parentBeaconBlockRoot
parentHash
Section titled “parentHash”readonly parentHash: string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:323
The block hash of the parent block.
Implementation of
Section titled “Implementation of”prevRandao
Section titled “prevRandao”readonly prevRandao: null | string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:382
The latest RANDAO mix of the post beacon state of the previous block.
Implementation of
Section titled “Implementation of”provider
Section titled “provider”readonly provider: Provider;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:302
The provider connected to the block used to fetch additional details if necessary.
receiptsRoot
Section titled “receiptsRoot”readonly receiptsRoot: null | string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:362
The hash of the transaction receipts trie.
Implementation of
Section titled “Implementation of”stateRoot
Section titled “stateRoot”readonly stateRoot: null | string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:358
The root hash for the global state after applying changes in this block.
Implementation of
Section titled “Implementation of”timestamp
Section titled “timestamp”readonly timestamp: number;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:319
The timestamp for this block, which is the number of seconds since epoch that this block was included.
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get date(): | null | Date;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:428
The [[link-js-date]] this block was included at.
Returns
Section titled “Returns”| null
| Date
length
Section titled “length”Get Signature
Section titled “Get Signature”get length(): number;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:424
The number of transactions in this block.
Returns
Section titled “Returns”number
prefetchedTransactions
Section titled “prefetchedTransactions”Get Signature
Section titled “Get Signature”get prefetchedTransactions(): TransactionResponse[];
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:415
Returns the complete transactions, in the order they were executed within the block.
This is only available for blocks which prefetched
transactions, by passing true
to %%prefetchTxs%%
into [[Provider-getBlock]].
Returns
Section titled “Returns”transactions
Section titled “transactions”Get Signature
Section titled “Get Signature”get transactions(): readonly string[];
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:406
Returns the list of transaction hashes, in the order they were executed within the block.
Returns
Section titled “Returns”readonly string
[]
The list of transactions in the block.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”iterator: Iterator<string>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:420
Returns
Section titled “Returns”Iterator
<string
>
Implementation of
Section titled “Implementation of”getPrefetchedTransaction()
Section titled “getPrefetchedTransaction()”getPrefetchedTransaction(indexOrHash): TransactionResponse;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:439
If a Block was fetched with a request to include the transactions this will allow synchronous access to those transactions.
If the transactions were not prefetched, this will throw.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
indexOrHash | string | number |
Returns
Section titled “Returns”getTransaction()
Section titled “getTransaction()”getTransaction(indexOrHash): Promise<TransactionResponse>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:432
Get the transaction at %%indexe%% within this block.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
indexOrHash | string | number |
Returns
Section titled “Returns”isLondon()
Section titled “isLondon()”isLondon(): this is Block & { baseFeePerGas: bigint };
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:448
Returns true if this block is an [[link-eip-2930]] block.
Returns
Section titled “Returns”this is Block & { baseFeePerGas: bigint }
isMined()
Section titled “isMined()”isMined(): this is MinedBlock;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:444
Returns true if this block been mined. This provides a type guard for all properties on a [[MinedBlock]].
Returns
Section titled “Returns”this is MinedBlock
orphanedEvent()
Section titled “orphanedEvent()”orphanedEvent(): OrphanFilter;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:454
@_ignore:
Returns
Section titled “Returns”toJSON()
Section titled “toJSON()”toJSON(): any;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/provider.d.ts:419
Returns a JSON-friendly value.
Returns
Section titled “Returns”any