Blockchain Architecture

Chapter 4
Transactions, Ledgers and State Management

Diploma in Blockchain
Blockchain Architecture   •   Diploma

Transactions, Ledgers and State Management

Introduction

A blockchain is not merely a list of records. It is a distributed state-management system in which independent nodes agree on which transactions are valid, in what order they occurred, and how those transactions transform a shared state. Transactions may transfer value, invoke smart contracts, register data, or change permissions. The ledger records the accepted history, while the state represents the current result of that history.

A useful abstraction is:

St+1 = Γ(St, Tt)

Here, St is the state before processing a transaction or transaction batch, Tt is the accepted transaction or ordered batch, Γ is the state-transition function, and St+1 is the resulting state. The function is deterministic under the same protocol rules and inputs. This chapter follows the complete transaction lifecycle: creation, propagation, validation, ordering, execution, finality, and state storage.

Learning Objectives

By the end of this chapter, students should be able to:

  1. Explain the structure and purpose of blockchain transactions.
  2. Trace a transaction from creation through confirmation and state update.
  3. Distinguish transaction validation, ordering, execution, and finality.
  4. Describe blocks, block headers, mempools, fees, timestamps, forks, and confirmations.
  5. Compare account-based and UTXO-based ledger models.
  6. Explain how replicated state is stored and verified.
  7. Identify operational, governance, security, and regulatory issues in transaction processing.

1. Transactions as State-Transition Requests

A transaction is a digitally signed instruction requesting that a blockchain system change its state. In a cryptocurrency, the request may transfer units from one owner to another. In a smart-contract platform, it may call a function, submit data, or deploy code. A transaction does not automatically become true merely because it was created; it must satisfy protocol rules and be accepted through the network’s consensus process.

A transaction normally contains:

  • a sender identity or authorization reference;
  • a recipient, contract address, or output specification;
  • an amount or payload;
  • a sequence number, nonce, or input reference;
  • a fee or fee-rate instruction;
  • a digital signature;
  • execution limits, such as gas or computational units;
  • protocol-version or expiry information where applicable.

The exact fields differ by blockchain. Bitcoin transactions use referenced unspent transaction outputs (UTXOs), whereas Ethereum-style transactions identify an account, nonce, gas limit, fee parameters, recipient, value, and data field.

Digital signatures and authorization

A private key is used to create a signature over a transaction message. Network nodes use the corresponding public key or address information to verify that the transaction was authorized. A signature provides authentication and integrity, but it does not prove that the transaction is economically sensible or that sufficient funds exist. Those conditions are checked separately.

A signature scheme is secure only under stated cryptographic assumptions. Private-key compromise, poor key storage, malware, social engineering, or defective signing software can result in valid but unauthorized transactions. Since many public blockchains do not provide a central reversal mechanism, transaction authorization is a major operational responsibility.

2. The Transaction Lifecycle

The lifecycle can be understood as a sequence of logically distinct stages:

  1. Construction: A wallet or application assembles transaction fields.
  2. Signing: The authorized party signs the transaction.
  3. Local validation: The originating wallet checks basic syntax and policy.
  4. Broadcast: The transaction is transmitted to peer nodes.
  5. Admission to a mempool: Nodes independently validate it and temporarily store it.
  6. Ordering: A block producer selects transactions and places them in a proposed block.
  7. Block validation: Other nodes verify the block and every included transaction.
  8. Consensus and finality: The network accepts the block according to its consensus rules.
  9. Execution: Transactions are applied in the agreed order.
  10. State update: Balances, UTXOs, contract storage, and indexes are updated.
  11. Persistence and confirmation: The accepted history and resulting state are stored and exposed to applications.

These stages should not be treated as identical. A transaction can be valid but not yet included in a block. It can be included in a block that later becomes part of a temporary fork. It can be executed locally but not finalized by the network. Professional blockchain analysis therefore distinguishes validity, inclusion, confirmation, and finality.

3. Validation Before Inclusion

Validation is the process of determining whether a transaction satisfies protocol and policy rules. Typical checks include:

  • correct encoding and transaction size;
  • valid digital signature;
  • correct nonce or sequence number;
  • sufficient balance or valid UTXO references;
  • absence of double spending;
  • acceptable fee and resource limit;
  • valid smart-contract call data;
  • compliance with replay-protection and chain-identification rules;
  • non-expired time or sequence constraints.

A node may reject a transaction for local policy reasons even when it is technically valid. For example, a node may refuse transactions below a minimum fee-rate or above a local size threshold. Consensus rules determine what the network must reject; relay policy determines what a particular node is willing to forward.

UTXO and account validation

In a UTXO model, a transaction consumes existing outputs and creates new outputs. An output can normally be spent only once. If the inputs have total value Vin and outputs have total value Vout, the transaction fee is:

F = Vin − Vout

F is the fee, and all values must use the same unit. The equation assumes that every input and output value is accounted for and that no additional issuance occurs inside the transaction.

In an account model, the protocol checks the sender’s balance, authorization, and nonce. A simplified balance condition is:

Bsender ≥ V + F

where Bsender is the spendable balance, V is the transferred value, and F is the fee. Smart-contract execution may require a larger resource reservation than the final fee consumed.

The nonce prevents unintended replay or ambiguous ordering of transactions from the same account. If an account has nonce 12, a transaction with nonce 14 may be held until nonce 13 is processed, depending on the protocol and node implementation.

4. Mempools and Transaction Fees

A mempool, or memory pool, is a node’s temporary collection of valid but unconfirmed transactions. There is no single universal mempool: different nodes may hold different transactions because of network latency, fee policies, capacity limits, and replacement rules.

Mempool status is therefore not a guarantee of inclusion. A transaction may remain pending, be evicted, be replaced by a higher-fee transaction, or become invalid because a conflicting transaction is confirmed first.

Fees serve several functions:

  • compensating block producers or validators;
  • allocating scarce block space or execution capacity;
  • discouraging spam and denial-of-service activity;
  • pricing computational or storage resources.

A simple transaction fee-rate relationship is:

F = r × q

where F is the fee, r is the fee rate, and q is the transaction’s measured resource quantity, such as bytes, virtual bytes, gas units, or execution units. The formula applies only when the protocol defines a linear fee schedule. Some systems use multiple resource dimensions or nonlinear pricing.

For example, if a transaction occupies 250 virtual bytes and the selected fee rate is 20 units per virtual byte, then F = 20 × 250 = 5,000 units. The transaction may still wait if demand rises and other transactions offer higher fee rates.

Ethereum-style systems commonly separate a base fee from a tip. Conceptually, the user’s total payment may be represented as:

Peffective = Pbase + Ptip

The exact rules, caps, and treatment of unused limits depend on the protocol. Students must consult the relevant specification rather than applying this simplified relationship universally.

5. Blocks and Ordering

A block is a protocol-defined container holding transactions and metadata. A typical block includes:

  • a reference to the previous block;
  • a transaction commitment, such as a Merkle root;
  • a timestamp or time-related field;
  • consensus-specific fields, such as a proof-of-work target or validator signature;
  • a state commitment or receipt commitment where supported;
  • the ordered transaction list.

The previous-block reference creates a hash-linked history. If a previous block changes, its hash changes, invalidating the descendant linkage unless the chain is recomputed or re-agreed. This provides tamper evidence, not absolute immutability.

Transaction ordering

Ordering determines the state-transition result when transactions interact. Suppose two transactions attempt to spend the same UTXO. Only one can be accepted. In an account system, two transactions with sequential nonces must be processed in nonce order. Smart-contract transactions can also produce different outcomes depending on order.

Ordering is selected by the relevant consensus process. In proof-of-work systems, miners propose blocks and the accepted chain is selected according to the protocol’s chain-selection rule. In proof-of-stake systems, validators propose and attest to blocks, usually under a fork-choice and finality mechanism. In permissioned systems, an ordering service may establish a sequence before peers validate and commit transactions.

Ordering creates a governance and market-design issue known as maximal extractable value (MEV). A block producer may benefit by reordering, inserting, or excluding transactions. Possible effects include front-running, back-running, liquidation competition, and unfair access. Protocols and applications may mitigate these risks through encrypted transactions, batch auctions, private order flow, or fair-ordering mechanisms, but no universal solution exists.

6. Timestamps and Temporal Reasoning

A block timestamp is metadata supplied under protocol rules. It is not necessarily a perfectly accurate physical clock reading. Depending on the blockchain, the timestamp may be constrained by predecessor time, validator time, network time, or an allowed tolerance.

Applications should not use a blockchain timestamp as a high-precision external time source unless the protocol explicitly guarantees that property. Timestamp manipulation can affect auctions, interest calculations, expirations, randomness, and oracle-dependent logic. Robust smart contracts use suitable time windows and avoid making security-critical decisions from a single timestamp.

A timestamp can support ordering and expiry checks, but it does not by itself establish consensus finality. A transaction’s temporal metadata and its position in a finalized ledger are separate concepts.

7. Execution, Receipts and State Updates

After a block is accepted, each validating node executes its transactions according to the protocol’s deterministic rules. Execution may:

  • debit and credit balances;
  • consume and create UTXOs;
  • update contract storage;
  • emit logs or events;
  • consume computational resources;
  • generate success or failure status.

A failed smart-contract call may still be included and may still consume a fee, depending on the platform. Failure of one transaction does not necessarily invalidate the entire block. The protocol specifies whether execution is atomic at the transaction level, block level, or another boundary.

A deterministic execution model requires identical results for identical inputs. Non-deterministic sources such as local wall-clock values, uncontrolled external APIs, or random local variables must be restricted or mediated by consensus rules and oracles.

State and history

The history is the sequence of accepted blocks and transactions. The state is the current data needed to determine valid future transitions. A node may reconstruct state by replaying history, maintain a state database for efficient access, or use snapshots and checkpoints to reduce startup time.

State can include:

  • account balances and nonces;
  • contract code and storage;
  • UTXO sets;
  • validator deposits and status;
  • governance records;
  • application-specific data.

A state commitment, often represented by a root hash, allows nodes and users to verify that a claimed state corresponds to a particular set of data. Merkle trees and related authenticated data structures permit proofs about membership or non-membership without transmitting the entire database.

8. Ledger Storage and Data Structures

Blockchain storage commonly has several layers:

LayerTypical contentsMain purpose
Block storeHeaders, transactions, block metadataPreserve canonical or candidate history
State databaseBalances, UTXOs, contract storageSupport current-state queries and execution
IndexesAddress, transaction, event, and timestamp indexesImprove application retrieval
Mempool storePending transactionsSupport relay and block construction
Receipts/log storeExecution results and eventsSupport monitoring and applications

A full archival node may preserve historical states, while a pruned node may delete data that is no longer required for its operational role. Pruning reduces storage requirements but can limit historical queries. External indexers improve usability but introduce additional trust, availability, and data-consistency considerations.

A Merkle tree combines transaction hashes into a root commitment. If a leaf changes, the path to the root changes. A Merkle proof consists of the relevant leaf and sibling hashes needed to recompute the root. The security of this construction depends on the cryptographic hash function and correct tree rules, including treatment of odd numbers of leaves and duplicate structures.

9. Confirmation, Forks and Finality

A fork occurs when competing valid blocks or histories exist. Forks may be:

  • temporary or natural, caused by near-simultaneous block proposals;
  • protocol upgrades, in which rules change;
  • contentious, caused by disagreement among participants;
  • application-level, where different software interprets data differently.

In a temporary fork, one branch may later become canonical under the chain’s fork-choice rule. Transactions in the abandoned branch may return to the mempool, be included later, or become invalid because a conflicting transaction was confirmed.

A confirmation is evidence that a transaction is included in a block accepted by the node or network. Additional blocks may increase confidence in systems with probabilistic finality. Finality is stronger: it is the protocol’s guarantee, under specified assumptions, that a block or transaction will not be reverted.

Finality models include:

  • probabilistic finality: reversal becomes increasingly unlikely as more blocks build on a transaction;
  • economic finality: reversing a decision would impose substantial loss on dishonest participants;
  • deterministic or explicit finality: a protocol message or quorum makes reversal impossible under its fault assumptions.

No finality claim is unconditional. It depends on assumptions about cryptography, network synchrony, validator or miner behavior, software correctness, and governance. A merchant choosing an acceptance threshold should consider transaction value, attack incentives, settlement speed, and the cost of reversal.

10. Consensus and State Consistency

Consensus does not mean that every node stores data in the same physical format. It means that honest nodes follow compatible rules and converge on an agreed transaction history and state. Replication provides resilience, while validation prevents arbitrary data from becoming authoritative.

A node typically performs two related but distinct tasks:

  1. Consensus validation: Is this block acceptable under protocol rules and the agreed history?
  2. State execution: What state results when its transactions are applied in order?

A block can be structurally well formed but invalid because a transaction spends unavailable funds, exceeds a resource limit, or produces a state root inconsistent with execution. Conversely, a transaction can be individually valid but excluded because of capacity, ordering, fee, or policy decisions.

11. Applied Case: A Supply-Chain Payment with a Smart Contract

The following is an illustrative case.

Background

A logistics company uses a permissioned blockchain to release payment to a carrier when a shipment reaches a verified warehouse. An IoT device reports arrival, and an authorized oracle submits the report to a smart contract.

Problem

The company must prevent duplicate payment, ensure that only authorized parties can submit delivery evidence, and provide an auditable settlement record. It must also manage delayed or conflicting sensor reports.

Analysis

The payment transaction includes the carrier account, shipment identifier, delivery status, oracle signature, nonce, and fee or resource allocation. Validators check the signature, authorization role, nonce, shipment status, and whether the shipment has already been settled. The transaction enters the mempool and is ordered with other transactions.

When executed, the contract verifies the oracle report and changes the shipment state from IN_TRANSIT to DELIVERED. A second payment request for the same shipment fails because the contract’s state no longer permits settlement. The contract emits an event containing the shipment identifier and payment reference.

Approach and outcome

The network uses a known validator set and explicit finality. Once the transaction reaches the required commitment threshold, the company treats payment as final. The ledger preserves the transaction, execution result, and event, while the state database stores the shipment’s current status. The organization retains off-chain sensor data because the blockchain records the oracle’s attestation, not the physical truth of the delivery itself.

Learning points

The case demonstrates that blockchain finality does not guarantee truthful input data. It guarantees, under protocol assumptions, that an accepted statement is consistently recorded. Oracle governance, access control, audit procedures, and data-retention policies remain essential. It also illustrates why state-machine design should make duplicate actions impossible or harmless.

12. Challenges, Governance and Best Practices

Technical challenges

Important challenges include transaction congestion, state growth, storage costs, peer-to-peer propagation delays, denial-of-service attacks, smart-contract bugs, reorganization risk, key compromise, and inconsistent software versions. High transaction demand can increase fees and waiting times. Large or rapidly changing state can make node operation expensive and reduce decentralization.

Governance and regulation

Transaction records may contain personal data, commercial information, or identifiers. Public ledgers can conflict with data-minimization and deletion requirements if sensitive information is written permanently. A prudent design stores hashes, references, or proofs on-chain and keeps personal data in controlled off-chain systems, while recognizing that even a hash may be personal data if it can be linked to an identifiable person.

Organizations should define who may submit transactions, who operates validators, how upgrades are approved, how disputes are handled, and what legal status a ledger record has. Auditability must be balanced with confidentiality. Permissioned systems may use channels, private data collections, encryption, or access-controlled state, but these mechanisms do not eliminate governance obligations.

Professional best practices

  • Validate and simulate transactions before broadcast.
  • Protect private keys with hardware-backed or carefully governed custody.
  • Use explicit chain identifiers and replay protection.
  • Treat mempool presence as provisional, not settled.
  • Define confirmation and finality policies by transaction risk.
  • Monitor reorgs, failed transactions, nonce gaps, and fee conditions.
  • Keep node software, protocol parameters, and indexers synchronized.
  • Test smart contracts for authorization, reentrancy, arithmetic, and state-transition errors.
  • Minimize sensitive on-chain data.
  • Maintain backups, recovery procedures, and incident-response plans.
  • Document assumptions about oracles, timestamps, validator behavior, and governance.

Contemporary Developments

Current blockchain engineering increasingly separates execution, ordering, settlement, and data availability. Layer-two systems may execute transactions away from a base chain and submit commitments or proofs for settlement. Stateless-client research seeks to reduce the data burden required to verify state. Verkle-style structures, zero-knowledge proofs, rollups, parallel execution, and modular architectures aim to improve scalability while preserving verifiability.

These developments do not remove the central principles of this chapter. Every system still needs a defined transaction format, validation rules, ordering mechanism, execution model, state representation, and finality claim. Engineers must evaluate not only throughput but also proof costs, operator requirements, data availability, upgrade risk, and the assumptions transferred between layers.

Chapter Summary

Transactions are signed requests to transform blockchain state. Their lifecycle includes construction, authorization, propagation, mempool admission, ordering, block validation, execution, finality, and state persistence. Validation confirms signatures, balances or UTXOs, nonces, resource limits, and protocol compliance; it does not by itself guarantee inclusion or finality.

Blocks provide ordered, hash-linked containers of transactions and metadata. Mempools hold provisional transactions, while fees allocate scarce resources and discourage abuse. Timestamps support protocol logic but are not inherently precise or trustworthy clocks. Execution applies a deterministic state-transition function, producing updated balances, UTXOs, contract storage, receipts, and events.

Forks arise when competing histories or rules exist. Confirmations indicate inclusion, whereas finality expresses the protocol’s confidence or guarantee against reversal. Ledger storage generally separates historical blocks, current state, indexes, receipts, and pending transactions. Governance, key management, oracle integrity, privacy, regulation, and operational monitoring are as important as cryptographic design.

Key Terms

Transaction: A signed request to change blockchain state.

State-transition function: The deterministic rule mapping a previous state and accepted transaction to a new state.

Digital signature: A cryptographic proof of authorization and message integrity.

Nonce: A sequence value used to order transactions and prevent replay.

UTXO: An unspent transaction output available to be consumed by a later transaction.

Account model: A ledger model that records balances and account-related state directly.

Mempool: Temporary storage for valid but unconfirmed transactions.

Transaction fee: Payment associated with consuming blockchain resources.

Fee rate: Fee charged per unit of measured resource.

Block: An ordered container of transactions and consensus metadata.

Block header: Metadata identifying and committing to a block and its context.

Merkle root: A hash commitment to a collection of leaves, such as transactions.

Execution: Application of ordered transactions to the current state.

Receipt: A record of execution outcome, resource use, or emitted events.

Confirmation: Evidence that a transaction is included in an accepted block.

Finality: A protocol guarantee or confidence that an accepted record will not be reversed.

Fork: A divergence between competing valid histories or protocol rules.

State database: Storage containing current balances, UTXOs, contracts, or other active data.

Oracle: A mechanism that supplies external information to a blockchain.

MEV: Value obtained by influencing transaction inclusion, ordering, or execution.

Review Questions

Short Answer Questions

  1. What is the difference between a valid transaction and a finalized transaction?
  2. What purpose does a mempool serve?
  3. Why are nonces useful in account-based blockchains?
  4. Distinguish blockchain history from blockchain state.
  5. Why should timestamps not automatically be treated as precise trusted time sources?

Long Answer Questions

  1. Explain the complete transaction lifecycle from construction to state update.
  2. Compare UTXO and account-based ledger models, including how each validates spending.
  3. Explain how blocks, hash links, transaction commitments, and state commitments support verification.
  4. Discuss confirmations, forks, probabilistic finality, and deterministic finality.
  5. Analyse the governance and privacy risks of storing business records on a blockchain.

Analytical / Application Questions

  1. A transaction is correctly signed and has sufficient funds but remains in the mempool for two hours. Identify at least four technical or policy reasons this may occur and recommend monitoring actions.
  2. Two transactions attempt to update the same smart-contract record. Explain how ordering and deterministic execution determine the final state, and identify possible MEV risks.
  3. Design a transaction and finality policy for a high-value supply-chain payment. Specify validation checks, confirmation requirements, oracle controls, storage choices, and recovery procedures.

Multiple Choice Questions with Answers

Question 1

Which sequence best represents the blockchain transaction lifecycle?

A. Execution, signing, construction, mempool admission, finality

B. Construction, signing, validation, propagation, ordering, execution, finality

C. Finality, construction, propagation, signing, execution

D. Mining, deletion, signing, execution, construction

Correct Answer: B. Construction, signing, validation, propagation, ordering, execution, finality

Question 2

What is the primary purpose of a nonce in an account-based blockchain?

A. To encrypt the transaction payload

B. To determine the block timestamp

C. To provide transaction sequencing and replay protection

D. To calculate the Merkle root

Correct Answer: C. To provide transaction sequencing and replay protection

Question 3

A UTXO transaction has inputs worth 12 units and outputs worth 11.4 units. Assuming no other issuance or adjustment, what is the fee?

A. 0.06 units

B. 0.6 units

C. 1.4 units

D. 23.4 units

Correct Answer: B. 0.6 units

Question 4

Which statement about a mempool is correct?

A. It is the permanent canonical ledger

B. All nodes necessarily have identical mempools

C. It stores transactions that are valid but not yet confirmed

D. It contains only finalized transactions

Correct Answer: C. It stores transactions that are valid but not yet confirmed

Question 5

What does finality most directly describe?

A. The speed at which a wallet creates a signature

B. The guarantee or confidence that an accepted record will not be reversed

C. The number of transactions in a mempool

D. The physical location of a validator

Correct Answer: B. The guarantee or confidence that an accepted record will not be reversed

Question 6

If a transaction uses 300 measured resource units at a fee rate of 4 tokens per unit, what is the fee under a linear fee schedule?

A. 75 tokens

B. 304 tokens

C. 1,200 tokens

D. 1,204 tokens

Correct Answer: C. 1,200 tokens

Question 7

Which statement best distinguishes execution from validation?

A. Validation applies state changes, while execution checks signatures only

B. Validation checks rule compliance, while execution applies accepted transactions to state

C. They are always identical operations

D. Execution occurs only before a transaction is signed

Correct Answer: B. Validation checks rule compliance, while execution applies accepted transactions to state

Question 8

Why can a blockchain timestamp be unsuitable as a high-precision clock?

A. Timestamps are always encrypted

B. Protocol participants may have bounded flexibility in setting timestamps

C. Timestamps are never stored in blocks

D. A timestamp automatically proves physical location

Correct Answer: B. Protocol participants may have bounded flexibility in setting timestamps

Question 9

What commonly happens to a transaction in an abandoned temporary fork?

A. It must always be permanently destroyed

B. It may return to the mempool or be reconsidered, subject to conflicts

C. It becomes a validator key

D. It changes the chain’s cryptographic algorithm

Correct Answer: B. It may return to the mempool or be reconsidered, subject to conflicts

Question 10

What is the main function of a Merkle root in a block?

A. To store a private key

B. To commit compactly to a collection of transactions

C. To replace the consensus mechanism

D. To guarantee that oracle data is truthful

Correct Answer: B. To commit compactly to a collection of transactions

Blockchain Architecture
Chapter 4 of 14