Skip to main content
MAIN CHAIN

Main Chain Internals

The ELA main chain is a UTXO-based blockchain secured by Bitcoin merged mining (AuxPoW) with BPoS finality. This page covers its internal architecture — from block structure to consensus to the full transaction type catalog.

Consensus Evolution

Elastos consensus evolved through four phases:

PhaseHeight RangeMechanism
1. Pure AuxPoWGenesis to 343,400Merged mining with Bitcoin only
2. CRC-Only DPoS343,400 to 402,68012 hardcoded Council arbiters provide finality
3. Public DPoS402,680 to 1,405,000Full public validator election
4. BPoS1,405,000+Time-locked staking with logarithmic weight

AuxPoW (Merged Mining)

Every ELA block header contains an AuxPow structure proving that a Bitcoin miner committed to the ELA block hash:

  • The ELA block hash is embedded in the Bitcoin coinbase's scriptSig after magic bytes 0xfabe6d6d
  • Chain ID 1224 produces a deterministic expected index in the aux Merkle tree
  • The block hash is computed from the header without the AuxPow field (SerializeNoAux())

Block validation checks AuxPoW proof, PoW difficulty, timestamp bounds, Merkle root, and coinbase structure.

BPoS Confirmation

After BPoS activation, every block carries a Confirm — a collection of validator signatures proving BFT consensus:

  1. On-duty validator proposes a block via DPOSProposal
  2. Other validators validate and broadcast DPOSProposalVote (accept/reject)
  3. When 2/3+1 accept votes are collected, a Confirm is formed
  4. The confirmed block is final — no reorganization is possible

BFT Threshold: 2/3 supermajority of the active validator set.

PoW Fallback

If BPoS consensus stalls for 12 hours, the chain automatically reverts to pure PoW mode via a RevertToPOW transaction (type 0x41). Cross-chain transfers are blocked during PoW mode as a safety measure. Normal operation resumes via RevertToDPOS (type 0x42).

Block Structure

ComponentDescription
HeaderVersion, previous hash, Merkle root, timestamp, difficulty bits, nonce, height, AuxPow proof
BlockHeader + ordered list of transactions
DposBlockBlock + optional Confirm (validator signature collection)

The header's Height field is explicit (unlike Bitcoin, which derives height from the chain).

Transaction Lifecycle

Every transaction passes through two validation stages:

Sanity Check (stateless):

  • Valid size, serialization, type code, payload format, signature format

Context Check (stateful):

  • All referenced UTXOs exist and are unspent
  • Input values >= output values + fee
  • Fee meets minimum threshold
  • Per-type business logic rules
  • No double-spend against mempool

Complete Transaction Type Reference

Base Transactions (0x00–0x08)

CodeNamePurpose
0x00CoinBaseBlock reward distribution
0x01RegisterAssetRegister new asset type
0x02TransferAssetStandard ELA transfer
0x03RecordData recording on-chain
0x04DeployReserved (unused)
0x05SideChainPowSidechain PoW proof submission
0x06RechargeToSideChainDeposit ELA to sidechain
0x07WithdrawFromSideChainWithdraw ELA from sidechain
0x08TransferCrossChainAssetCross-chain transfer

BPoS Validator Transactions (0x09–0x15)

CodeNamePurpose
0x09RegisterProducerRegister as BPoS validator
0x0aCancelProducerCancel producer registration
0x0bUpdateProducerUpdate producer info
0x0cReturnDepositCoinRetrieve staked deposit
0x0dActivateProducerRe-activate after inactivity
0x0eIllegalProposalEvidenceReport illegal DPoS proposal
0x0fIllegalVoteEvidenceReport illegal DPoS vote
0x10IllegalBlockEvidenceReport illegal block production
0x11IllegalSidechainEvidenceReport sidechain misbehavior
0x12InactiveArbitratorsMark arbiters as inactive
0x13UpdateVersionProtocol version update
0x14NextTurnDPOSInfoAnnounce next arbiter set
0x15ProposalResultRecord proposal outcome

DAO Transactions (0x21–0x31)

CodeNamePurpose
0x21RegisterCRRegister as Council candidate
0x22UnregisterCRUnregister candidacy
0x23UpdateCRUpdate candidate info
0x24ReturnCRDepositCoinReturn Council deposit
0x25CRCProposalSubmit Council proposal
0x26CRCProposalReviewCouncil member reviews proposal
0x27CRCProposalTrackingTrack proposal progress
0x28CRCAppropriationAppropriate funds from treasury
0x29CRCProposalWithdrawWithdraw proposal funds
0x2aCRCProposalRealWithdrawExecute actual withdrawal
0x2bCRAssetsRectifyRectify CR asset UTXOs
0x2cReturnCrossChainDepositCoinReturn failed cross-chain deposits
0x31CRCouncilMemberClaimNodeCouncil member claims DPoS node

System Transitions (0x41–0x51)

CodeNamePurpose
0x41RevertToPOWSwitch to pure PoW
0x42RevertToDPOSRestore DPoS consensus
0x51ReturnSideChainDepositCoinReturn failed sidechain deposits

BPoS Staking (0x60–0x66)

CodeNamePurpose
0x60DposV2ClaimRewardClaim BPoS voter rewards
0x61DposV2ClaimRewardRealWithdrawExecute reward withdrawal
0x62ExchangeVotesConvert ELA to stake votes
0x63VotingCast BPoS votes with lock time
0x64ReturnVotesReturn staked votes
0x65VotesRealWithdrawExecute vote return
0x66RecordSponsorRecord block confirm sponsor

NFT Transactions (0x71–0x72)

CodeNamePurpose
0x71CreateNFTCreate NFT from staking position
0x72NFTDestroyFromSideChainDestroy NFT returning from sidechain

UTXO Model

ELA uses a UTXO model like Bitcoin. Each transaction consumes previous outputs (inputs) and creates new ones.

Output types:

CodeNamePurpose
0OTNoneStandard transfer
1OTVoteDPoS v1 voting
2OTMappingMapping payload
3OTCrossChainCross-chain transfer metadata
4OTWithdrawFromSideChainSidechain withdrawal metadata
5OTReturnSideChainDepositCoinFailed deposit return
6OTDposV2VoteBPoS voting with lock time
7OTStakeStaking/exchange votes

The node maintains an in-memory LRU UTXO cache (100,000 entries). Cache misses fall through to the database.

Validator Election

Composition: ~70 community-elected validators + 12 Council validators (always active). See nodes.elastos.net for current counts.

BPoS weight formula:

weight = log10((LockTime - BlockHeight) / 7200 * 10)
effectiveVotes = stakedELA * weight

Producer states: Pending -> Active -> Inactive/Canceled/Illegal -> Returned

  • Inactivity: 1,440 missed rounds (~2 days) triggers Inactive state
  • Illegal behavior: 200 ELA deducted from deposit; can re-register with a new deposit

Coinbase Distribution

Halving: Every 1,051,200 blocks (~4 years). Current reward: 0.761 ELA. See ELA Halving.

Fee Model

FeeAmountELA
Min transaction fee100 sela0.000001
Min cross-chain fee10,000 sela0.0001
Deposit return fee100 sela0.000001
Proposal withdrawal fee10,000 sela0.0001

1 ELA = 100,000,000 sela. Transactions are prioritized by fee-per-KB for block inclusion.

Source Code

The main chain node is implemented in Go: Elastos.ELA

Key packages: blockchain/ (chain, store, validation), dpos/ (consensus), pow/ (mining), cr/state/ (DAO governance), core/types/ (block/tx structures), servers/ (RPC interfaces).