Local Execution
Local execution refers to the process by which a node processes and executes transactions from a finalized block to determine the post-state of the blockchain. This is a critical step in ensuring that all nodes in the network arrive at the same state after a block has been added to the chain.
1. Execution Trigger
Once a block is finalized through the CelesBFT consensus mechanism, the block and its transactions are considered immutable and part of the blockchain's history. After finalization:
Each node begins executing the transactions contained in the block.
Execution is performed optimistically and in parallel for efficiency.
The final state is merged sequentially to ensure deterministic results across all nodes.
2. Execution Environment
Local execution is carried out within the EVM-compatible runtime environment of Celestium. This allows for compatibility with Ethereum smart contracts, including contracts written in Solidity.
Key elements of the execution environment:
Gas Accounting: Each transaction consumes gas based on the complexity of its operations.
Opcode Compatibility: The same gas costs per opcode as Ethereum are used.
Parallel Execution: Transactions are executed concurrently where possible.
State Merger: Final state changes are applied sequentially to maintain consistency.
3. Transaction Processing Flow
Each transaction undergoes the following steps during local execution:
Step
Description
Signature Verification
Validate the sender's signature.
Nonce Validation
Ensure the transaction nonce is correct.
Balance Check
Verify the sender has sufficient balance.
Gas Estimation
Calculate gas cost based on transaction complexity.
EVM Execution
Execute the transaction logic within the EVM.
State Update
Apply changes to account balances and storage.
Receipt Generation
Record transaction outcome and gas usage.
4. Parallel and Optimistic Execution
Celestium employs optimistic execution and parallel transaction execution to maximize throughput:
Transactions are optimistically executed in parallel, assuming that their state accesses do not conflict.
State access tracking detects conflicts. If a conflict is found, the affected transaction is re-executed.
Final state changes are merged sequentially in the order of transactions in the block.
This approach allows Celestium to maintain Ethereum-like execution semantics while achieving high throughput.
5. Final State Commit
After all transactions in a block are executed:
The final state is committed to CelesDb.
A state root hash is computed and stored as part of the block.
This hash allows light clients and other nodes to verify the state with Merkle proofs.
6. Querying the Local Execution Result
Users can query the result of transaction execution via RPC:
The receipt includes:
status
:1
for success,0
for failure.blockNumber
: The block containing the transaction.gasUsed
: Amount of gas consumed.logs
: Logs emitted by the smart contract.
7. Key Benefits of Local Execution in Celestium
Benefit
Description
Deterministic Execution
All nodes arrive at the same state after executing the block.
Parallel Processing
Reduces block processing time.
Fast Outcome Availability
Full nodes know transaction outcomes within 1 second.
EVM Compatibility
Supports existing Ethereum tools and contracts.
8. RPC Endpoints Related to Execution
Method
Description
eth_getTransactionReceipt
Get transaction execution result.
eth_getBlockByNumber
Fetch block details, including state root hash.
9. Example Use Case
After submitting a transaction, a user may want to verify its success:
This final step ensures users can confirm that their transactions have been successfully executed and included in the blockchain state.
Local execution is a fundamental part of Celestium’s transaction lifecycle, ensuring that every node independently verifies and applies transactions consistently. By combining parallel execution, optimistic techniques, and EVM compatibility, Celestium delivers high performance while preserving the reliability and determinism expected from blockchain systems.
Last updated