Transaction Submission
Submitting a transaction is the initial step in interacting with the Celestium blockchain. This process involves creating a signed transaction that reflects the user's intention, whether it is sending native tokens (CLT), interacting with a smart contract, or deploying a new contract.
Understanding the transaction submission process is essential for both developers building applications on Celestium and users seeking to conduct secure and efficient blockchain operations.
1. Preparing a Transaction
A transaction in Celestium adheres to the Ethereum transaction format, following standards such as:
EIP-2718: Typed Transaction Envelope.
EIP-2930: Optional Access Lists for Gas Optimization.
Key fields in a transaction:
Field
Description
nonce
Sequence number for the account.
to
Recipient address (or empty for contract deployment).
value
Amount of native token (CLT) to transfer.
gasLimit
Maximum gas units the transaction can consume.
gasPrice
Fee per gas unit in native token.
maxFeePerGas
Maximum fee per gas (used in EIP-1559 transactions).
maxPriorityFeePerGas
Maximum priority fee per gas for miners/validators.
data
Optional data payload (e.g., contract interaction).
signature
ECDSA signature authorizing the transaction.
The transaction is serialized using RLP (Recursive Length Prefix) encoding.
2. Gas Estimation
Before submitting, users often estimate gas consumption by calling:
This simulates transaction execution without broadcasting it, helping the user set a suitable gasLimit
and avoid out-of-gas failures.
3. Signing the Transaction
A transaction is signed using the account's private key. Wallets such as MetaMask or hardware wallets handle signing securely.
The signature covers the transaction fields, ensuring authenticity and preventing tampering.
4. Submitting the Transaction
After signing, the transaction is broadcast to the Celestium network through an RPC node:
RPC Call Example:
The node validates the transaction structure and the user's balance before propagating it to the network.
5. Validation at Submission
To prevent spam and invalid transactions, Celestium nodes check:
Sufficient Balance: Ensuring the account can cover
value + gasLimit * maxFeePerGas
.Nonce Matching: The nonce must align with the account's next expected nonce.
Signature Validity: The ECDSA signature must match the sender's address.
If any check fails, the transaction is rejected with an error message.
6. Mempool Propagation
Once validated, the transaction enters the mempool, a temporary pool of pending transactions. Validators select transactions from the mempool during block proposal, prioritizing those with higher fees.
Celestium optimizes mempool management:
Transactions are sorted by effective gas price (base fee + priority fee).
Transactions exceeding the available balance are not admitted.
Replacement Transactions: Users can speed up or cancel pending transactions by submitting a new transaction with the same nonce and higher gas fees.
7. Tracking the Transaction Status
Users can track their transaction's status via:
eth_getTransactionReceipt: Retrieves execution results (success, failure, gas used).
Block Explorer: http://testnet.celestium.network
Receipt Example:
8. Common Errors
Error
Cause
nonce too low
A transaction with a higher nonce has already been sent.
out of gas
Gas limit was insufficient to cover computation.
insufficient funds
Balance is too low for the transaction’s value and fees.
invalid signature
Signature does not match the transaction data.
9. Example Using Web3.js
Here is an example of submitting a transaction using Web3.js in Node.js:
10. Summary of Transaction Submission Flow
Create Transaction: Specify
to
,value
,gasLimit
,data
, and fee fields.Estimate Gas (Optional): Simulate execution to set an optimal gas limit.
Sign Transaction: Use a wallet or library to sign.
Submit Transaction: Call
eth_sendRawTransaction
via RPC.Validate: Node checks balance, nonce, and signature.
Propagate: Transaction enters the mempool.
Inclusion: Validator includes the transaction in a block.
Query Status: Retrieve execution results via RPC or block explorer.
Related RPC Endpoints
Method
Description
eth_estimateGas
Estimate gas usage for a transaction.
eth_sendTransaction
Send an unsigned transaction (requires unlocked account).
eth_sendRawTransaction
Submit a signed transaction.
eth_getTransactionReceipt
Retrieve transaction result after execution.
Final Notes
Understanding the transaction lifecycle ensures that developers can efficiently interact with Celestium, prevent common submission issues, and optimize fee spending. Proper handling of nonce, gas estimation, and mempool behavior is crucial for seamless on-chain operations.
Last updated