Block Inclusion
Block inclusion is the process through which transactions from the mempool are selected, ordered, and packaged into a block by a validator. This block is then proposed to the network and, upon consensus, is finalized as part of the blockchain. Understanding block inclusion is crucial for developers and node operators as it determines the finalization and ordering of transactions on Celestium.
1. Block Production Mechanism
Celestium uses the CelesBFT consensus algorithm with a Proof of Authority + AI (PoAi) mechanism to produce blocks. Block production follows a rotating leader model:
In each round (every 1 second), a validator is designated as the leader.
The leader is responsible for selecting pending transactions from the mempool and constructing a block.
Validators vote on the proposed block.
If two-thirds (2/3) of the validators agree, the block is finalized and added to the blockchain.
This approach guarantees 1-second finality, meaning that once a block is finalized, it is irreversible unless a Byzantine fault occurs.
2. Transaction Selection for Block Inclusion
When a validator assembles a block, it follows these principles:
a. Gas Price Priority (Priority Gas Auction - PGA):
Transactions with higher gas fees (maxFeePerGas) are prioritized.
The validator aims to maximize transaction fees collected as block rewards.
b. Available Balance Validation:
The available balance of the account is checked in real-time.
Transactions that would exceed an account's available balance (considering other pending transactions) are skipped.
c. Gas Limit Considerations:
Each block has a block gas limit.
The sum of the gas limits of included transactions cannot exceed the block gas limit.
3. Transaction Cost Calculation
When evaluating transactions, the maximum potential cost is calculated as:
The validator verifies that the account’s available balance can cover this amount before including the transaction.
4. Block Propagation
Once a block is assembled:
The leader broadcasts the block proposal to other validators.
Validators validate the block:
Check transaction validity.
Verify the block signature.
Confirm that the transactions do not exceed gas limits.
Validators vote on the block.
If 2/3 of the validators agree, a Quorum Certificate (QC) is formed.
The block is finalized and propagated to the network.
Finalization is achieved in a single slot (1 second), ensuring near-instant certainty.
5. Impact of Block Inclusion on Transactions
After a transaction is included in a block:
It becomes part of the blockchain’s history.
It is considered final and cannot be reversed without network failure.
The transaction’s outcome (success or failure) is determined during execution.
Users can retrieve the transaction status using:
This will return the block number, status, and logs associated with the transaction.
6. Block Gas Limit
The block gas limit restricts the amount of computational work that can be performed in a single block. It ensures that block production and propagation remain fast, maintaining Celestium’s high throughput.
Example:
Block Gas Limit:
30,000,000
Transaction 1 Gas Limit:
500,000
Transaction 2 Gas Limit:
2,000,000
The validator can include both transactions as long as their total gas limit does not exceed the block limit.
7. Rejected or Delayed Transactions
Transactions may remain in the mempool or be rejected if:
The transaction fee is too low.
The transaction requires more gas than the block gas limit allows.
The account lacks sufficient funds after other transactions are included.
The transaction depends on a nonce sequence that is not yet met.
Rejected transactions can be replaced by resubmitting with a higher gas price.
8. Summary of Block Inclusion Flow
Step
Description
Transaction Selection
Validator selects high-fee, valid transactions from the mempool.
Block Assembly
Transactions are bundled into a block, subject to gas and balance limits.
Block Proposal
The leader proposes the block to other validators.
Voting & QC Formation
Validators vote; 2/3 approval finalizes the block.
Block Finalization
The block is added to the blockchain; transactions are executed.
9. Key Benefits in Celestium
1-Second Finality: Transactions are final within a single slot.
Gas Auction Efficiency: Ensures optimal fee selection.
Balance Validation: Reduces failed transactions in blocks.
High Throughput: Block gas limits are optimized for performance.
10. Related RPC Endpoints
Method
Description
eth_getBlockByNumber
Retrieve block details by number.
eth_getTransactionReceipt
Get transaction status and logs.
Understanding block inclusion helps developers and users optimize transaction fees and timing, ensuring transactions are processed efficiently in Celestium’s high-performance environment.
Last updated