End-to-End System Flows
This page documents eight complete flows through the Elastos stack. Each flow names the repositories where behavior is implemented, lists concrete steps aligned with source code paths (SDKs, nodes, contracts, and apps), and states the trust model so you can reason about what must be trusted and what is cryptographically enforced.
Treat each section as a trace: start from user or miner action, follow messages and transactions across processes, and end at a durable on-chain or network state. Cross-links to deeper protocol pages (cross-chain, identity, storage) complement the narrative here.
At-a-glance: repositories by flow
┌─────────────────────────────────────────────────────────────────────────────┐
│ Flow │ Primary repositories │
├──────────────────────────┼───────────────────────────────────────────────────┤
│ 1 DID creation │ DID SDK · EID sidechain · Essentials │
│ 2 Deposit (main → ESC) │ Elastos.ELA · SPV · Arbiter · SideChain.ESC │
│ 3 Withdraw (ESC → main) │ Elastos.ELA · Arbiter · SideChain.ESC │
│ 4 Proposal lifecycle │ Main chain · Elastos DAO governance portal │
│ 5 Hive storage │ Hive Node · EID · client SDKs │
│ 6 Merged mining │ Elastos.ELA · btcpool · Bitcoin │
│ 7 Carrier messaging │ Carrier core · DHT / Kademlia │
│ 8 Essentials dApp │ Essentials · InAppBrowser · Web3 providers │
└─────────────────────────────────────────────────────────────────────────────┘
Flow 1: User creates a decentralized identity (DID)
Repositories involved: DID SDK, EID sidechain, Essentials App (wallet UI and signing).
Step-by-step (source-aligned)
- Key material: Generate a BIP-39 mnemonic, derive the seed, then HD derivation at path
m/44'/0'/0'/0/0using secp256r1 (P-256) to obtain a private/public key pair (Elastos identity curve choice for DID operations in this stack). - Address and DID string: From the public key, build the redeem script (
0x21 || pubkey || 0xAC), hash SHA256 → RIPEMD160, prepend0x67, append checksum, Base58-encode. The resulting address starts withi. The DID isdid:elastos:i<address>. - DID Document: Construct JSON-LD with
@context,id,publicKey,authentication, optionalserviceandverifiableCredentialentries; sign the document (or relevant proofs) with the private key so verifiers can bind keys to the DID. - Publish on EID: Submit an EVM transaction on the identity chain that calls the precompile at address
0x16(22 decimal) with theoperationDIDpath using thecreateoperation payload expected by the chain. - Consensus and resolution: EID reaches agreement under PBFT (practical instant finality for that layer). The DID becomes resolvable via JSON-RPC such as
did_resolveDID.
Trust model
The user controls the private key. No third party can create, modify, or deactivate that DID without key material or a deliberate user-authorized update path encoded in the DID Document and on-chain rules.
Resolvers and relying parties trust EID state for the latest document and cryptographic signatures for authenticity of claims presented off-chain.
Diagram: DID creation path
Mnemonic ──► Seed ──► HD(P-256) ──► Keypair
│
▼
Redeem script + hashes
│
▼
Base58 `i...` address
│
▼
did:elastos:i<address>
│
DID Document (signed) │
▼
EVM tx → precompile 0x16
operationDID / create
│
▼
PBFT finality on EID
│
▼
did_resolveDID (JSON-RPC)
Flow 2: Cross-chain transfer (main chain → ESC)
Repositories involved: Elastos.ELA, Elastos.ELA.SPV, Elastos.ELA.Arbiter, Elastos.ELA.SideChain.ESC.
Step-by-step
- User constructs deposit: Main-chain transaction of type
TransferCrossChainAsset(0x08), with output directed to the ESC genesis-related deposit address, and payload specifying target sidechain, recipient address, and amount. - Main-chain inclusion: The transaction is mined into a main-chain block. BPoS confirmation proceeds with validator signatures (supermajority: two-thirds plus one of the active validator set).
- Arbiter observation: The arbiter stack’s deposit listener (e.g.
DepositListener.Notify()in the arbiter codebase) observes the inclusion; relevant data is persisted (e.g.MainChainTxsin SQLite) for coordinated relay. - Relay to ESC: The on-duty arbiter path issues the sidechain-facing call:
sendrechargetransactionRPC so ESC ingests the deposit intent with proofs/context the node expects. - ESC verification and mint: ESC verifies the SPV proof (Merkle path against main-chain headers), materializes the credit as an internal EVM-side effect, and mints the corresponding ELA on ESC for the user address.
Trust model
Deposits are designed to be trust-minimized at verification time: ESC independently checks the SPV proof tying the main-chain commitment to the credited mint. You still rely on correct chain sync and honest majority for main-chain finality before the proof is stable.
User (main chain) Arbiters / SPV ESC
│ │ │
│ TransferCrossChainAsset │ │
│ ─────────────────────────────►│ DepositListener │
│ │ MainChainTxs (DB) │
│ │ │
│ │ sendrechargetx RPC ─►
│ │ │ Verify SPV
│ │ │ Mint ELA
Flow 3: Cross-chain withdrawal (ESC → main chain)
Repositories involved: Same bridge family as Flow 2; emphasis on arbiter monitor, proposal, and multi-sig paths on main chain plus ESC withdraw contract behavior.
Step-by-step
- User initiates on ESC: User sends ELA to the cross-chain withdraw contract address on ESC (burn/lock semantics per deployed contract version).
- Arbiter detection:
SideChainAccountMonitor.SyncChainData()(or equivalent polling loop) callsgetwithdrawtransactionsbyheight(and related APIs), tracking until sufficient confirmations (commonly 6 blocks on the sidechain for safety margins). - Withdrawal proposal: The on-duty arbiter constructs a withdrawal proposal on the main chain: a transaction spending UTXOs associated with the genesis/deposit pool address in line with consensus rules.
- P2P proposal propagation: The proposal is broadcast on the DPoS P2P fabric (e.g.
DistributedItemMessage-style envelopes) so peer validators evaluate the same payload. - Co-signing: Other arbiters verify the proposal and co-sign according to the configured scheme.
- Threshold submission: Collect 2/3×N+1 signatures (or Schnorr aggregation where implemented), then submit the finalized transaction to the main chain so the user receives main-chain ELA.
Trust model
Withdrawals are not verified by every full node like a pure SPV user proof in the same way as deposits on ESC; they rely on a threshold of arbiters agreeing. Two-thirds plus one of validators means up to one-third malicious validators cannot unilaterally steal funds; misbehavior requires breaching the supermajority.
Liveness and latency depend on arbiter software correctness, connectivity, and honest-majority behavior. Monitor slashing, upgrades, and incident response alongside on-chain parameters.
Flow 4: Elastos Council proposal lifecycle
Repositories involved: Elastos DAO governance portal (MongoDB, DID-authenticated sessions), Elastos.ELA main chain for Elastos Council transaction types.
Step-by-step
- Suggestion: A community member files a suggestion in the Elastos DAO governance portal; backend stores metadata (e.g. MongoDB), with DID-based authentication binding identity to actions.
- On-chain proposal: A council member crafts a
CRCProposaltransaction on the main chain: type, budget stages, recipient, draft hash, and related fields per the active consensus version. - Registered & review: Proposal enters
Registered, then a 7-day review window for council scrutiny. - Council votes: Members submit
CRCProposalReviewtransactions with Approve / Reject / Abstain (exact enum labels follow chain code). - State transitions: If approved, progression through states such as
CRAgreed, another 7-day community review, thenVoterAgreedwhen conditions are met, until the proposal is active for execution milestones. - Treasury payouts: Budget withdrawal uses
CRCProposalWithdraw(per milestone), sourcing funds from the Elastos DAO treasury allocation (notably the 30% of coinbase directed to Elastos DAO per tokenomics parameters in force).
Trust model
On-chain governance: votes and state transitions are public. Treasury movements are traceable to proposals and milestones, so auditors and community can reconcile policy with chain state.
Web (Elastos DAO) Main chain (Elastos Council)
│ │
│ Suggestion (Mongo + DID) │
│ │
│ CRCProposal tx ─────►│ Registered
│ │ 7d council review
│ │ CRCProposalReview
│ │ CRAgreed → … → active
│ │ CRCProposalWithdraw
Flow 5: Hive data storage
Repositories involved: Hive Node (service), EID (DID resolution), client SDKs / Essentials for signing.
Step-by-step
- Presentation: The app presents an App DID to the Hive Node; the node issues a challenge string/nonce.
- User authentication: The user responds with a Verifiable Presentation signed appropriately; VP expiry is typically short (e.g. 3 minutes) to limit replay.
- Token issuance: Hive resolves the user DID on EID, validates the VP, then issues a JWT with bounded lifetime (e.g. 7-day expiry) for subsequent API calls.
- Vault provisioning: Create vault:
POST /api/v2/vault/create. Backing storage uses a MongoDB database per user+app, commonly named fromMD5(user_did + app_did)(or equivalent deterministic naming in deployment configs). - Data plane: Applications perform document/collection operations and file operations backed by IPFS (or configured storage driver) for large blobs.
- Scripting (optional): Server-side scripts and conditions can gate writes/reads for automation beyond static ACLs.
Trust model
Users trust the Hive Node operator with confidentiality and availability of stored payloads. Authentication is anchored in DID; integrity of auth proofs is cryptographic, but data at rest depends on operator policy unless client-side encryption is applied by the app.
For data sovereignty, deploy a Hive Node you control and point clients at it. Trust base shifts from a third-party host to your infrastructure while keeping the same DID verification flow.
Flow 6: Merged mining (Bitcoin → ELA)
Repositories involved: Elastos.ELA node, btcpool (or pool integration), Bitcoin full node / mining stack.
Step-by-step
- Aux block polling: btcpool daemon polls
createauxblockon the ELA node to obtain work that embeds Elastos block commitments. - Coinbase embedding: The ELA block hash is embedded in the Bitcoin coinbase transaction per AuxPoW, with Chain ID
1224as the Elastos identifier in the merged-mining handshake. - Joint PoW: A Bitcoin miner finds a nonce satisfying Bitcoin difficulty; the same proof structure satisfies AuxPoW linkage rules.
- Submission to ELA: btcpool submits the AuxPoW bundle via
submitauxblockto the Elastos node. - ELA validation: Elastos checks that the Bitcoin block hash meets ELA difficulty targets, Chain ID is correct, and BPoS validators finalize the block under consensus rules.
Trust model
ELA inherits Bitcoin’s hash rate for the merged-mining portion of security assumptions. BPoS adds fast finality and governance-aligned block acceptance on top; understand both layers when reasoning about reorgs and confirmations.
btcpool Elastos.ELA Bitcoin miner
│ │ │
│ createauxblock │ │
│◄──────────────────────────│ │
│ │ │
│ embed ELA hash in BTC │ │
│ coinbase (AuxPoW, ID) │ │
│ ───────────────────────────────────────────────────► │
│ │ │ PoW solve
│ submitauxblock ───────────►│ validate + BPoS │
Flow 7: Carrier P2P message exchange
Repositories involved: Carrier core (C/C++ and bindings), DHT implementation.
Step-by-step
- Identity & routing: Generate an Ed25519 keypair; Node ID derives from the public key. Bootstrap to known DHT nodes; maintain Kademlia K-buckets with
K = 8. - Peer announcement:
ANNOUNCE_PEERto the K closest nodes for the target keyspace so others can discover reachability. - Discovery:
FIND_PEERqueries withservice_idreturn nodes that previously announced for that service. - Store / retrieve:
STORE_VALUEat the recipient’s node ID may require an anti-spam token and Ed25519-signed envelopes to reduce abuse. - NAT traversal: Active Proxy (or similar) assists NAT’d endpoints so two home users can still complete sessions.
Trust model
Carrier provides peer discovery and transport. End-to-end trust for application data requires your protocol (encryption, signing, DID-bound sessions) above Carrier. The DHT is not a trust root by itself.
Flow 8: Essentials dApp browser session
Repositories involved: Essentials mobile app, InAppBrowser, injected Web3 providers.
Step-by-step
- Navigation: User opens a dApp URL; the app instantiates InAppBrowser and checks the URL against a phishing / blocklist database.
- Provider injection: The webview injects providers:
window.ethereum,window.elastos,window.unisat,window.elamain(exact availability may vary by build and chain profile). - Account access: dApp calls
eth_requestAccounts; the user approves wallet connection in Essentials UI. - Transaction path: On
eth_sendTransaction, Essentials shows a review screen (value, data, network). - Signing: User confirms with password / biometric; Essentials signs locally and broadcasts the transaction.
- Completion: dApp receives the tx hash and polls
eth_getTransactionReceiptuntil mined.
Trust model
Users trust Essentials not to alter transaction parameters maliciously and to display accurate summaries. dApps remain untrusted; always verify domain, contract addresses, and calldata before approval.
Multiple injected namespaces exist for EVM, Elastos-specific calls, and Bitcoin-family wallets; feature-detect before assuming a single global.
Summary table
| Flow | Primary assurance | Main trust boundary |
|---|---|---|
| 1 DID | P-256 keys + EID state | User key custody |
| 2 Deposit | SPV + mint rules | Chain sync + honest majority (main) |
| 3 Withdraw | Arbiter threshold | Supermajority arbiters |
| 4 Proposal | On-chain Elastos Council + treasury | Transparent votes; council composition |
| 5 Hive | DID auth + JWT | Hive operator (unless self-hosted) |
| 6 Merged mining | AuxPoW + BPoS | Bitcoin work + Elastos consensus |
| 7 Carrier | Ed25519 + DHT routing | App-layer crypto for payloads |
| 8 Essentials | Local signing + review | User verifies prompts |
See also
- Cross-Chain Protocol: deposit and withdrawal mechanics in depth
- Identity Protocol: DID resolution and document semantics
- Storage Protocol: Hive vault and data plane
- Communication Protocol: Carrier messaging concepts
If you trace a new code path (commit hash, file, and function), extend this page with a short “Source pointers” subsection per flow so readers can jump from narrative to implementation.