Threat Modeling: Building Secure Software

Comprehensive Guide to Application Security & Threat Analysis

← Back to Threat Modeling Guide

How Modern Crypto Actually Works Under the Hood

For security engineers, blockchains are fascinating study subjects: they are distributed systems designed from first principles to operate in adversarial environments, where no participant can be trusted and yet the network must reach consensus reliably. That design goal — Byzantine fault tolerance at internet scale — produces architectures worth understanding both for their technical elegance and for their characteristic failure modes. This article walks through five key components of the current crypto infrastructure landscape.

Layer-2 Scaling: Arbitrum's Approach

Ethereum's base layer processes transactions slowly and at high cost. The ecosystem's dominant scaling solution is a class of protocols called optimistic rollups, of which Arbitrum, an Ethereum layer-2, is the most widely deployed. The "optimistic" in optimistic rollup refers to the default assumption: transaction batches are assumed valid and posted to Ethereum without expensive proof computation. Fraud proofs — the mechanism for challenging invalid state — are only computed if a verifier disputes a batch during a challenge window. This architecture delivers dramatic throughput increases with minimal trust assumptions, inheriting Ethereum's security for finalized state. From a threat modeling perspective, the critical attack surface is the fraud proof mechanism and the bridge contracts that hold assets crossing between L2 and L1.

Alternative Architecture: Avalanche

The high-throughput Avalanche blockchain takes a fundamentally different approach from Ethereum's rollup ecosystem. Rather than treating itself as an Ethereum layer-2, Avalanche is a standalone layer-1 that achieves sub-second finality through a novel repeated random sampling consensus protocol. Nodes query small random subsets of their peers repeatedly until consensus converges — a probabilistic approach that sacrifices some theoretical guarantees for practical speed. Avalanche also supports subnets: custom blockchains with their own validator sets and rules, deployed on the Avalanche infrastructure. The security model of subnets differs substantially from the main network, and organizations building on subnet infrastructure should evaluate validator economics and validator set size as part of their threat model. Arbitrum inherits Ethereum's security guarantees; Avalanche subnets' security depends more directly on the economics of their own validator pools.

Trustless Cross-Chain Transfers: Atomic Swaps

Moving value between blockchains is inherently risky when it requires trusting a centralized bridge. The cryptographic alternative is a trustless cross-chain trade via atomic swap. Hash time-locked contracts (HTLCs) are the mechanism: both parties lock funds with a hash commitment, and release is conditioned on revealing the preimage before a timeout. Either both parties successfully complete the exchange, or the funds are returned — there is no intermediate state where one party has received value and the other hasn't. For security architects, atomic swaps represent a genuinely trustless design; their weaknesses are operational (the need for both parties to be online, the complexity of multi-hop routes) rather than cryptographic. Most bridge hacks that have resulted in hundreds of millions in losses targeted centralized or semi-centralized bridge designs rather than true atomic swap implementations.

Network Security: Validators

In proof-of-stake systems, the node that secures a proof-of-stake chain is the validator — a participant who locks capital (stake) as collateral against misbehavior and performs the work of proposing and attesting to new blocks. The slashing mechanism is the key security primitive: demonstrable protocol violations result in partial or total loss of staked capital. This economic deterrent replaces the energy expenditure that secures proof-of-work networks. For security engineers assessing a proof-of-stake blockchain, validator diversity matters enormously: a network where a small number of validators control a majority of stake is much more vulnerable to coordinated attacks than one with thousands of independent participants. Avalanche's subnet model allows for custom validator sets, which may be highly concentrated in permissioned contexts.

Stablecoin Risk: Algorithmic Designs

The riskiest corner of the crypto infrastructure deserves explicit attention in any security analysis: stablecoins pegged by code rather than cash. Unlike fully collateralized stablecoins backed by dollars in a bank, algorithmic stablecoins attempt to maintain their peg through incentive mechanisms and token supply adjustments. The catastrophic failure of TerraUSD in 2022 demonstrated the classic death spiral: as confidence erodes, redemptions accelerate, the stabilization mechanism amplifies rather than dampens the decline, and the peg collapses entirely. This failure mode shares characteristics with classic reflexive feedback loops in complex systems — the same dynamics that cause cascading failures in distributed infrastructure under correlated load. Threat modeling for DeFi applications that depend on algorithmic stablecoin liquidity must explicitly model peg failure as a catastrophic scenario, not a remote tail risk.

The five components explored here — Arbitrum's rollup design, Avalanche's consensus architecture, atomic swaps as a trustless bridge mechanism, validator economics in proof-of-stake, and algorithmic stablecoin failure modes — represent the threat surface of modern blockchain infrastructure. For security engineers used to threat modeling traditional distributed systems, the patterns are recognizable: trust boundaries, economic incentive alignment, failure mode analysis, and cascade risk. The vocabulary is different; the discipline is the same.