Accounts & Transactions

Accounts and transactions form the foundation of activity on Celestium. They govern how users interact with the network, deploy smart contracts, and transfer value.


1. Accounts in Celestium

Celestium follows the Ethereum account model, meaning it supports two types of accounts:

Externally-Owned Accounts (EOAs)

  • Controlled by private keys.

  • Used by users to initiate transactions.

  • Can send and receive tokens.

Contract Accounts

  • Controlled by smart contract code.

  • Cannot initiate transactions independently.

  • Execute logic when triggered by an EOA or another contract.

Address Format

  • 20-byte hexadecimal addresses.

  • Derived from the public key using ECDSA (Elliptic Curve Digital Signature Algorithm).

  • Example: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e

Account State

Each account has the following state properties:

Field
Description

nonce

Number of transactions sent (EOAs) or created (contracts).

balance

Amount of native tokens (CLT) held by the account.

codeHash

Hash of the smart contract code (empty for EOAs).

storageRoot

Merkle Patricia Trie root hash representing contract storage.


2. Transactions in Celestium

Transactions are signed messages that trigger state changes on the Celestium blockchain. They are compatible with Ethereum's transaction structure and comply with EIP-2718 and EIP-2930.

Transaction Fields

Field
Description

nonce

Sequential number to prevent replay attacks.

gasPrice / maxFeePerGas

Amount the sender is willing to pay per gas unit.

gasLimit

Maximum gas units the transaction can consume.

to

Recipient address (or empty for contract creation).

value

Amount of CLT tokens to transfer.

data

Input data (e.g., smart contract call).

v, r, s

ECDSA signature fields.

Transaction Types

Type
Description

Legacy Transactions

Pre-EIP-1559 transactions using gasPrice.

EIP-1559 Transactions

Use maxFeePerGas and maxPriorityFeePerGas fields.

EIP-2930 Transactions

Include access lists to optimize gas usage.

Gas and Fees

  • Gas represents computational effort.

  • Each opcode has a gas cost.

  • Transaction fee is calculated as:

    javaSalinEditTransaction Fee = Gas Used * Effective Gas Price

Signed Transactions

Transactions must be signed using the sender's private key. This generates the v, r, s fields in the transaction.

Example: Signing and Sending a Transaction (Web3.js)

const Web3 = require('web3');
const web3 = new Web3('https://rpc-private-testnet.celestium.network');

async function sendTransaction() {
  const account = web3.eth.accounts.privateKeyToAccount('0xYOUR_PRIVATE_KEY');
  const tx = {
    from: account.address,
    to: '0xRecipientAddress',
    value: web3.utils.toWei('1', 'ether'),
    gas: 21000,
    maxFeePerGas: web3.utils.toWei('5', 'gwei'),
    maxPriorityFeePerGas: web3.utils.toWei('2', 'gwei'),
  };

  const signedTx = await account.signTransaction(tx);
  const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
  console.log('Transaction receipt:', receipt);
}

sendTransaction();

3. Native Token (CLT)

  • The native token on Celestium is CLT.

  • Used to pay for transaction fees (gas).

  • Can be transferred between accounts.

4. Wrapped CLT (WCLT)

  • ERC-20 compliant representation of CLT.

  • Used in smart contracts requiring ERC-20 compatibility.


5. Nonce Management

Nonces ensure that each transaction is processed in order and prevents double-spending. Transactions with duplicate or out-of-order nonces will fail or be delayed.

Best Practices:

  • Always retrieve the current nonce before sending a transaction:

    const nonce = await web3.eth.getTransactionCount(account.address);

6. Access Lists (Optional)

Introduced in EIP-2930, access lists reduce gas costs by pre-declaring state slots and accounts a transaction will access.

Access List Example:

const tx = {
  from: account.address,
  to: '0xContractAddress',
  data: '0x...',
  gas: 50000,
  accessList: [
    {
      address: '0xStorageContractAddress',
      storageKeys: [
        '0x0000000000000000000000000000000000000000000000000000000000000000',
      ],
    },
  ],
};

7. Summary

  • EOAs are user-controlled; Contract Accounts are code-controlled.

  • Transactions modify state and transfer value.

  • Gas is a unit of computational cost, paid in CLT.

  • Access lists and EIP-1559 transactions improve gas efficiency.

Celestium’s Ethereum compatibility allows developers to leverage familiar tooling, making the transition seamless for existing blockchain developers.

Last updated