Blockchain in Payments
Working principles, network types, consensus mechanisms, DeFi protocols, stablecoins, and CBDCs — a technical guide to blockchain technology and its integration with modern payment infrastructure.
Decentralised Finance (DeFi)
DeFi is the set of financial protocols built on smart contracts that replicate — and sometimes improve upon — traditional financial services without trusted intermediaries. No accounts, no credit checks, no business hours. Code executes identically for every participant.
DeFi Protocol Categories
Decentralised Exchange (DEX) / AMM
Swap tokens without an order book. An Automated Market Maker pools liquidity in a smart contract; price is set algorithmically (x · y = k for Uniswap v2). Anyone can provide liquidity and earn trading fees. Enables instant stablecoin-to-stablecoin or cross-chain FX swaps.
Lending & Borrowing Protocol
Supply assets to earn variable interest or borrow against collateral — no bank account or credit score required. Over-collateralised loans protect lenders: borrow $70 of USDC by locking $100 of ETH. Undercollateralised flash loans allow arbitrage within a single transaction block.
Stablecoin Protocols
Issue or mint stablecoins pegged to fiat currencies. Three models: Fiat-backed (USDC, USDT — centralised issuer holds reserves), Crypto-backed (DAI — over-collateralised by ETH/RWA via MakerDAO), and Algorithmic (use supply/demand mechanics — historically risky, e.g. UST collapse 2022).
Yield Aggregators
Automatically move funds across lending and AMM protocols to maximise yield. Users deposit once; the vault strategy rebalances continuously, compounding returns. ERC-4626 (Vault Standard) enables composable yield strategies.
Cross-Chain Bridges & Messaging
Move assets and messages between different blockchains. Lock-and-mint bridges lock the asset on the source chain and issue a wrapped representation on the destination. Message-passing protocols (CCIP, IBC, LayerZero) enable smart contract calls across chains.
Oracles
Smart contracts cannot access external data by themselves — they are deterministic. Oracles are trusted data bridges providing on-chain price feeds, event attestations, randomness, and payment confirmations. Critical for DeFi: a wrong oracle price enables mass liquidations.
DeFi Risk Taxonomy
Bugs in protocol code are permanent and can be exploited immediately. Audits and formal verification reduce but do not eliminate risk. Bug bounties (Immunefi) incentivise responsible disclosure.
A manipulated price feed can trigger incorrect liquidations or enable flash loan attacks. Flash loan + price manipulation was the attack vector in many large DeFi exploits (Mango Markets $114M).
AMM pools can be thin for less-traded pairs. In a market crash, deep pools drain quickly — leading to slippage, failed liquidations, and cascading under-collateralisation.
Cross-chain bridges hold enormous TVL in a single smart contract. Ronin Bridge ($625M), Wormhole ($320M), Nomad ($190M) were exploited via code bugs or compromised validator keys.
Token-based governance is susceptible to vote buying and majority takeovers. A flash loan can temporarily grant majority voting power to an attacker (Beanstalk $182M governance attack).
DeFi protocols serving US or EU users may be subject to MiCA, securities regulations, or OFAC sanctions. Tornado Cash sanctions (2022) demonstrated that smart contract addresses can be sanctioned by OFAC.
DeFi Primitives in Payment Applications
Smart contract locks payment; oracle or multi-sig attestation releases it on delivery confirmation. Eliminates escrow agent fees and dispute timelines. Used in trade finance, freelancer marketplaces, and real estate.
Superfluid and Sablier stream USDC or other ERC-20 tokens per-second. Salary paid every second instead of monthly. Content subscriptions billed per-minute of consumption. Enabled by ERC-4337 for gasless user experience.
Curve Finance's stableswap invariant enables near-zero-slippage swaps between stablecoins (USDC ↔ USDT ↔ DAI). Payment gateways use AMMs to convert between currencies in the settlement path without a bank FX desk.
Tokenised central bank money issued on a permissioned layer can interact with DeFi protocols via bridges and wrappers. Project Mariana (BIS/SNB/BdF/MAS) tested wCBDC swaps using AMM protocols — combining BFT-secured issuance with open DeFi liquidity.
Treasury bills, money market funds, and corporate bonds are tokenised on-chain (Ondo USDY, BlackRock BUIDL). Corporate treasuries earn on-chain yield on idle stablecoin balances. Tokenised T-bills settle in minutes vs. T+1 traditional clearing.
Smart contract wallets replace EOAs (private key accounts). Enable: gasless transactions (paymaster covers gas), social recovery (replace lost key via guardians), batch payments (approve + transfer in one tx), session keys for subscriptions. Critical for mainstream payment UX.