Phase 51.0.0-phaseC2Architecture Defined

RTWO Ledger & State Engine

Storage-Backed Persistence — Hydration From Explicit Writes Only

Source: Ledger & State EngineSource: Real Storage — Not ConnectedSource: Real Database — Not Configured

Ledger Engine Status

Source: Ledger & State Engine

Engine StatusArchitecture DefinedNot Connected to Real Storage
Ledger StateWaiting for Real Ledger DataSource: Real Storage — Not Connected
State RootWaiting for Real Ledger DataSource: Real Storage — Not Connected
Mainnet StatusNot LiveReady for P2P Network Phase

Storage Abstraction Layer

The Ledger Engine depends only on storage interfaces — no concrete backend is coupled

Storage Provider

Default null provider. No storage backend is configured. Register a real StorageProvider implementation to enable persistence.

Not ConfiguredSource: Storage Abstraction Layer
LedgerRepositoryinterface

Persists and retrieves RTWOLedgerState records by block height.

saveLedgerState()getLatestLedgerState()getLedgerStateAtBlock()pruneLedgerStatesBefore()
Not ConfiguredSource: Storage Abstraction Layer
StateRepositoryinterface

Persists and retrieves RTWOStateTransition records.

saveTransition()getTransitionById()getTransitionsByBlock()updateTransitionStatus()pruneTransitionsBefore()
Not ConfiguredSource: Storage Abstraction Layer
StateStorageRepositoryinterface

Persists RTWOAccountState entries and RTWOStorageNode (MPT) nodes.

saveAccountState()getAccountByAddress()getAllAccounts()saveStorageNode()getStorageNodeByHash()getRootNode()
Not ConfiguredSource: Storage Abstraction Layer
SnapshotRepositoryinterface

Persists and retrieves RTWOStateSnapshot records for archival.

saveSnapshot()getSnapshotById()getLatestSnapshot()getSnapshotsByBlock()updateSnapshotStatus()
Not ConfiguredSource: Storage Abstraction Layer
RecoveryRepositoryinterface

Persists and retrieves RTWOLedgerRecoveryPoint records for disaster recovery.

saveRecoveryPoint()getRecoveryPointById()getLatestRecoveryPoint()getRecoveryPointsByBlock()updateRecoveryPointStatus()
Not ConfiguredSource: Storage Abstraction Layer

Future Storage Backends

RocksDBLevelDBPostgreSQLDistributed StorageCloud Storage

The Ledger Engine depends only on interfaces. Any backend above can be registered via StorageProviderRegistry.register() without modifying engine logic.

State Architecture — Domain Models

6 strongly typed domain models defining the RTWO ledger and state layer

RTWOLedgerStateR3
10 fields

Top-level ledger state tracking state root, block height, supply figures, and engine status.

Click to expand fields
RTWOStateTransitionR4
9 fields

Records a single state transition from one state root to another, triggered by a transaction.

Click to expand fields
RTWOAccountStateR4
9 fields

Individual account state entry in the state tree with balance, nonce, and storage root.

Click to expand fields
RTWOStorageNodeR4
7 fields

A node in the Merkle Patricia Trie storage tree representing a key-value pair.

Click to expand fields
RTWOStateSnapshotR7
7 fields

A point-in-time snapshot of the full ledger state for recovery and archival.

Click to expand fields
RTWOLedgerRecoveryPointR7
7 fields

A recovery point linking a block height to a verified snapshot for disaster recovery.

Click to expand fields

Account State Structure

Source: Real Storage — Not Connected

Account Fields

addressLedgerAddressUnique blockchain address
balanceLedgerBalance | nullWaiting for Real Ledger Data
nonceLedgerNonceReplay protection counter
storageRootLedgerHash | nullRoot of account storage trie
codeHashLedgerHash | nullnull for EOA accounts
accountTypeAccountTypeEOA / Contract / Validator / Treasury / System
statusAccountStatusActive / Inactive / Frozen / Pending
lastUpdatedBlockLedgerBlockHeightBlock of last state change
updatedAtLedgerTimestampTimestamp of last update

Account Types

externally_owned

Externally Owned Account

Standard user wallet address

contract

Contract Account

Smart contract with code hash

validator

Validator Account

Consensus validator with stake

treasury

Treasury Account

Protocol treasury holdings

system

System Account

Internal protocol system account

Waiting for Real Ledger Data

Source: Real Storage — Not Connected

State Transition Lifecycle

7-stage lifecycle from request to commit or revert

Requested
Validating
Applying
Applied
Committedterminal
Revertedterminal
Failedterminal
Requested

A state transition has been requested by the protocol engine or consensus layer.

Validating

The transition is being validated against current state root and account balances.

Requires real storage
Applying

Validated transition is being applied to the account state tree.

Requires real storage
Applied

Transition has been applied to the in-memory state. Awaiting commit.

Requires real storage
Committed

Transition is permanently committed to the ledger storage and state root updated.

Requires real storage
Reverted

Transition was rolled back due to block rejection or consensus failure.

Requires real storage
Failed

Transition failed due to invalid state, insufficient balance, or storage error.

Requires real storage
No active state transitions — Waiting for Real Ledger DataSource: Real Storage — Not Connected

Snapshot Lifecycle

6-stage lifecycle from pending to archived or failed

Pending
Creating
Created
Verified
Archivedterminal
Failedterminal
Pending

Snapshot has been scheduled and is waiting for the ledger to reach a stable state.

Creating

Snapshot is being created by serializing the current state tree to storage.

Created

Snapshot has been written to storage and is awaiting integrity verification.

Verified

Snapshot integrity has been verified against the state root hash.

Archived

Snapshot has been archived for long-term storage and recovery purposes.

Failed

Snapshot creation or verification failed due to storage error or hash mismatch.

No snapshots created — Ledger Structure ReadySource: Real Storage — Not Connected

State Root Pipeline

7-step process from transaction execution to ledger commit

1

Transaction Execution

Transactions are executed and account state changes are computed.

Source: Blockchain Protocol Engine
2

Account State Update

Affected account balances, nonces, and storage roots are updated in memory.

Source: Ledger & State Engine
3

Storage Node Write

Updated account entries are written as leaf nodes in the Merkle Patricia Trie.

Source: Real Storage — Not Connected
4

Trie Recomputation

Branch and extension nodes are recomputed bottom-up from modified leaves.

Source: Real Storage — Not Connected
5

Root Hash Derivation

The new state root hash is derived from the updated trie root node.

Source: Real Storage — Not Connected
6

Consensus Verification

The new state root is submitted to the Consensus Engine for block finality.

Source: Consensus Engine
7

Ledger Commit

After finality, the state root is committed to the ledger and storage is persisted.

Source: Real Storage — Not Connected

Storage Tree — Merkle Patricia Trie

Source: Real Storage — Not Connected

Node Types

root

Root Node

Top-level trie root — hash is the state root

branch

Branch Node

16-child branch node for path routing

extension

Extension Node

Compressed path segment for efficiency

leaf

Leaf Node

Terminal node holding account state value

RTWOStorageNode Fields

nodeHashLedgerHash
parentHashLedgerHash | null
keystring | null
valueHashLedgerHash | null
depthnumber
nodeTypeStorageNodeType
statusStorageNodeStatus

Not Connected to Real Storage

Source: Real Storage — Not Connected

Ledger Recovery Structure

Snapshot and recovery point architecture for disaster recovery

RTWOStateSnapshot

snapshotIdUnique snapshot identifier
blockNumberBlock at snapshot time
stateRootState root captured
accountCountAccounts in snapshot
snapshotHashIntegrity hash
createdAtCreation timestamp
statusSnapshot lifecycle status
No snapshots — Ledger Structure ReadySource: Real Storage — Not Connected

RTWOLedgerRecoveryPoint

recoveryPointIdUnique recovery point ID
blockNumberTarget block for recovery
stateRootState root at recovery point
snapshotIdLinked snapshot reference
recoveryHashCryptographic integrity hash
createdAtCreation timestamp
statusActive / Used / Expired / Failed
No recovery points — Ledger Structure ReadySource: Real Storage — Not Connected

Ledger Service Registry

10 typed service interfaces — all placeholder implementations

ServiceLayerIntegrationStatus
Ledger State ManagementR3R3 Core OrchestratorInterface Ready
Account State ManagementR4R4 Blockchain Protocol EngineInterface Ready
State Transition ExecutionR4R4 Blockchain Protocol EngineInterface Ready
State Root CalculationR4R4 Blockchain Protocol EngineInterface Ready
Storage Tree ManagementR4R4 Blockchain Protocol EngineInterface Ready
Snapshot CreationR7R7 Enterprise ServicesInterface Ready
Recovery Point ManagementR7R7 Enterprise ServicesInterface Ready
Ledger ValidationR6R6 Security & AutomationInterface Ready
State Proof GenerationR4R4 Blockchain Protocol EngineInterface Ready
Ledger Event PublishingR3R3 Core OrchestratorInterface Ready

Integration Status

Connection status with Core Engine, Blockchain Protocol Engine, and Consensus Engine

R3 Core Orchestrator

Ledger state management and event publishing integrated

Source: Core Engine
Architecture Ready

R4 Blockchain Protocol Engine

State transitions, account state, and state root pipeline integrated

Source: Blockchain Protocol Engine
Architecture Ready

Phase 4 Consensus Engine

State root submitted after block finality — architecture connected

Source: Consensus Engine
Architecture Ready

R6 Security & Automation

Ledger validation service integrated

Source: Core Engine
Architecture Ready

R7 Enterprise Services

Snapshot and recovery point services integrated

Source: Core Engine
Architecture Ready

Real Ledger Storage

Requires real database — not configured

Source: Real Storage — Not Connected
Not Connected

P2P Network

Required for Phase 6 — not yet started

Source: Real Network — Not Connected
Pending

Phase 5 Acceptance Checklist

All items must be complete before proceeding to Phase 6 (P2P Networking)

ledger-state-engine module exists

Created in Phase 5

Complete

All six domain models implemented

RTWOLedgerState, RTWOStateTransition, RTWOAccountState, RTWOStorageNode, RTWOStateSnapshot, RTWOLedgerRecoveryPoint

Complete

Service interfaces defined

10 typed service interfaces with placeholder implementations

Complete

State transition lifecycle implemented

Requested → Validating → Applying → Applied → Committed → Reverted → Failed

Complete

Snapshot lifecycle implemented

Pending → Creating → Created → Verified → Archived → Failed

Complete

Ledger & State Dashboard exists

Phase 5 dashboard with acceptance checklist

Complete

Core Engine integration complete

Integrated with R3, R4, R6, R7 execution layers

Complete

Consensus Engine integration complete

Phase 4 Consensus Engine connected via orchestrator

Complete

No fake ledger data shown

Truthful Data Policy enforced throughout

Complete

Storage provider connected to Ledger Engine

Operational RocksDB/in-memory storage bridged via StorageProviderRegistry

Complete

Persistent ledger hydration and recovery

Phase C.2 — bootstrap from storage on initialize; no fabricated genesis data

Complete

Ready for P2P Network Phase

Ledger architecture complete — awaiting Phase 6

Pending
11 of 12 items completeReady for P2P Network Phase

Truthful Data Policy — Phase 5

No fake accounts created
No fake balances shown
No fake total supply shown
No fake state roots generated
No fake snapshots created
No fake ledger history shown
No fake transactions shown
RTWO Mainnet is not live
Not connected to real ledger storage
Not connected to mainnet