Architecture
A Madara blockchain consists of the following components:
- An orchestrator
- A sequencer
- Starknet OS (SNOS)
- A prover
- A settlement layer
Note that some components are left out, for now, for simplicity.
Transaction flow
When a user issues a transaction it goes through the components in the following way:
- The transaction is received by the sequencer
- The sequencer executes the transaction and generates a state diff (depicting what state changes the transaction causes in the blockchain)
- The sequencer waits until enough transactions have been received to assemble a block
- Meanwhile, the Orchestrator polls the sequencer for new, unprocessed blocks
- Once a new, unprocessed block is available, a request is sent to SNOS to process the block number
- SNOS queries the sequencer for block data (transactions, state diff, old state root, new state root), based on the block number
- The sequencer returns block data for the SNOS
- The SNOS generates and sends validity proof input for the orchestrator
- The orchestrator forwards the validity proof inputs to the prover
- The prover generates a validity proof and forwards this to the settlement layer verifier contract
- The orchestrator monitors the verifier contract for block verification
- Once the block has been verified, the orchestrator requests the settlement layer's core contracts to update the network state
- The sequencer monitors the core contracts for a new, updated state and updates its own state accordingly