stacked markets

Stacked Markets

How smart contracts work in financial markets: Ethereum, Arbitrum, and on-chain trading explained

Published Jun 3, 2026 · By Stacked Markets Research Team

Contents

  1. What a smart contract actually is
  2. How Ethereum works as a settlement layer
  3. Why Ethereum mainnet can't support active trading
  4. What Arbitrum is and how it solves the problem
  5. How smart contracts power financial market trading
  6. How the stack works in practice: from your wallet to the order book
  7. What this means for you as a trader
  8. The honest trade-off
  9. Five questions worth answering before you trade on-chain
  10. FAQs

Most traders using on-chain perpetual futures have a working mental model of what they're doing: connect wallet, deposit USDC, trade perps, withdraw. The mechanics feel familiar. But the infrastructure underneath - the actual reason none of this requires a centralised intermediary - is worth understanding properly.

This isn't a beginner's guide to blockchain. It's an explanation of the specific technical stack that makes on-chain financial markets possible: smart contracts, Ethereum as a settlement layer, Arbitrum as a scaling solution, and how those pieces combine to run a perpetual futures exchange without a custodian in the middle.

What a smart contract actually is

A smart contract is code deployed to a blockchain that executes automatically when predefined conditions are met. No third party triggers it. No human approves the outcome. Once the conditions are satisfied, the code runs.

The word "smart" is slightly misleading - these contracts aren't intelligent. They're deterministic. Given the same inputs, they always produce the same outputs. What makes them useful is that the logic is public, execution is automatic, and the result is irreversible once confirmed on-chain.

In traditional finance, a derivatives contract requires a clearinghouse to verify positions, calculate settlement, and enforce payment. That clearinghouse is a trusted intermediary. Smart contracts replace that role with code. The settlement logic is written into the contract itself, visible to anyone, and executes without requiring you to trust the counterparty or the platform operator.

That last part is the point. You're not trusting a company to honour the contract. You're trusting the code - and the code is auditable.

How Ethereum works as a settlement layer

Ethereum is the dominant smart contract platform for one reason: it was the first to make general-purpose programmable contracts viable at scale, and the network effects that followed have proven durable.

At its core is the Ethereum Virtual Machine (EVM) - a sandboxed computation environment that runs on every full node in the network simultaneously. When you interact with a smart contract, you're sending a transaction that the EVM executes across thousands of nodes, each arriving at the same result. That redundancy is what makes the outcome trustworthy. No single node controls the output.

Every computation on the EVM costs gas, denominated in ETH. Gas is the pricing mechanism for computation: more complex operations cost more, which prevents any single contract from monopolising network resources. Gas fees fluctuate with network demand - and that's one of the reasons Ethereum mainnet became impractical for high-frequency use cases.

Ethereum moved from Proof of Work to Proof of Stake in September 2022, an event the network called the Merge. Under Proof of Stake, validators lock up ETH as collateral to participate in block production. Energy consumption dropped by approximately 99.95%. The economic model for validators changed. The EVM itself - and the smart contract execution model - did not.

Ethereum processes roughly 15 to 30 transactions per second on mainnet. That ceiling matters enormously for trading applications.

Why Ethereum mainnet can't support active trading

Fifteen to thirty transactions per second is not a trading infrastructure. A single active market on a centralised exchange processes thousands of order updates per second. On Ethereum mainnet at peak demand, those transactions would queue for minutes - and the fees would make small position adjustments economically irrational.

During high-activity periods in 2021 and 2022, gas fees for complex contract interactions regularly exceeded USD 50 to USD 200 per transaction. Placing a limit order, adjusting a stop, or closing a position at those costs isn't viable. The math doesn't work.

This isn't a flaw in Ethereum's design - it's a deliberate trade-off. Ethereum mainnet prioritises security and decentralisation over throughput. The assumption, which proved correct, was that scaling would happen in a separate layer built on top of Ethereum rather than by compromising the base layer's security model.

That separate layer is where Arbitrum comes in.

What Arbitrum is and how it solves the problem

Arbitrum is a Layer 2 network built on Ethereum using Optimistic Rollup technology. The architecture is worth understanding because it's what allows on-chain trading to be fast and cheap while still inheriting Ethereum's security.

Arbitrum processes transactions off-chain - on its own sequencer - and periodically posts compressed batches of those transactions back to Ethereum mainnet as calldata. Ethereum doesn't re-execute every Arbitrum transaction. It stores the data and acts as the final settlement and dispute resolution layer.

The "Optimistic" part refers to the fraud proof mechanism. Arbitrum assumes all posted transactions are valid unless challenged. Anyone can submit a fraud proof during a challenge window - typically seven days - if they believe a transaction was processed incorrectly. A successful fraud proof rolls back the invalid transaction and penalises the sequencer. That mechanism is what lets Arbitrum inherit Ethereum's security without requiring Ethereum to verify every transaction individually.

The practical result: Arbitrum handles approximately 40,000 transactions per second, with fees typically a fraction of a cent. That's the throughput profile that makes active trading viable on-chain.

By mid-2026, Arbitrum holds USD 16 to 20 billion in total value locked and commands over 40% of the Ethereum Layer 2 market by TVL. EVM compatibility - meaning any contract written for Ethereum deploys on Arbitrum without modification - combined with that liquidity base makes it the default choice for DeFi protocols that need both speed and Ethereum-level security guarantees.

How smart contracts power financial market trading

On-chain financial markets don't just use smart contracts as a payment rail. The contracts are the market. Every core function a centralised exchange performs in-house runs as on-chain code instead.

Perpetual futures contracts

A perpetual futures contract on-chain is a smart contract that tracks your position size, direction, entry price, and margin. Open a long, and the contract records it. Close it, and the contract calculates your PnL and settles the difference. No counterparty processes anything manually.

The mechanism that keeps perpetual futures tethered to spot price is the funding rate - a periodic payment between longs and shorts based on the spread between the perpetual's mark price and the index price. On a centralised exchange, the exchange calculates and distributes funding payments. On-chain, a smart contract does it automatically at each funding interval, transferring margin between positions according to the formula written into the contract.

Automated liquidation engines

When a position's margin falls below the maintenance threshold, it needs to be closed before it goes negative and creates bad debt for the protocol. On a centralised exchange, the risk engine handles this. On-chain, a liquidation contract monitors positions continuously and executes forced closures when the threshold is breached.

There's no human decision in the loop. The contract triggers automatically. That's both the strength and the limitation: faster and more consistent than a human operator, but with no discretion. If price moves fast enough that the liquidation engine can't close the position before it goes negative, the protocol absorbs the loss through an insurance fund or socialised loss mechanism.

AMMs vs CLOBs

Two distinct smart contract architectures handle order matching in on-chain markets.

Automated Market Makers (AMMs) use liquidity pools and mathematical pricing formulas - most commonly the constant product formula x * y = k - to price trades without a traditional order book. Uniswap is the canonical example. AMMs work well for spot token swaps but introduce slippage and capital inefficiency that make them poorly suited to leveraged derivatives trading.

Central Limit Order Books (CLOBs) match buy and sell orders at specific prices, exactly as a traditional exchange does. Running a CLOB on Ethereum mainnet was historically impractical - every order placement, cancellation, and fill required an on-chain transaction, making gas costs prohibitive. Layer 2 networks changed that. Hyperliquid runs a fully on-chain CLOB with the throughput to support professional-grade order management.

That distinction matters more than most traders realise. An AMM-based perp and a CLOB-based perp are not the same product. The execution model, slippage profile, and liquidation mechanics differ substantially.

How the stack works in practice: from your wallet to the order book

When you trade on Stacked Markets, the flow looks like this:

  1. Bridging. You hold USDC on Arbitrum. You bridge it into Hyperliquid's margin system - a cross-chain transfer that moves your collateral from Arbitrum onto Hyperliquid's Layer 1, where it sits in your account as trading margin.
  2. Order routing. When you place a trade through the Stacked Markets interface, the order routes to Hyperliquid's on-chain CLOB. The interface is a front-end terminal - it sends your signed transaction to the protocol. Stacked Markets never holds your funds or your keys.
  3. On-chain settlement. The CLOB matches your order against the book. Position state, margin, PnL, and funding payments are all tracked and settled on-chain by Hyperliquid's smart contracts.
  4. Withdrawal. When you close positions and withdraw, funds move back through the bridge to your wallet on Arbitrum. At no point does Stacked Markets touch your collateral.

The zero-custody model isn't a marketing claim. It's a direct consequence of the architecture. There are no Stacked Markets keys to compromise, no deposit address to phish, no internal ledger that could misrepresent your balance. The on-chain state is the ground truth.

What this means for you as a trader

Verifiable execution. Every order fill, funding payment, and liquidation is recorded on-chain. You can verify your trade history independently of any platform's reporting. If the platform's interface shows something different from the on-chain state, the on-chain state is correct.

No counterparty trust required. You don't need to trust that the exchange is solvent, that it isn't rehypothecating your collateral, or that it will honour withdrawals. The smart contracts enforce the rules. The exchange operator can't override them.

Custody stays with your wallet. Your funds move on-chain when you deposit and when you withdraw. Between those points, they're held in the protocol's smart contracts - not in a company's internal ledger. That's a fundamentally different risk profile from depositing on a centralised exchange.

Execution is irreversible. This is the trade-off. A smart contract that executes incorrectly - because of a bug, an exploit, or a price oracle manipulation - cannot be reversed by a support ticket. The code runs as written. If the code has a flaw, the flaw executes too. This is why smart contract audits exist, and why they're necessary but not sufficient.

The honest trade-off

Smart contracts replace institutional trust with code trust. That's a real improvement for traders who've experienced exchange insolvency, withdrawal freezes, or opaque liquidation practices. FTX collapsed in November 2022 with a USD 8 billion hole in customer funds. That outcome is structurally impossible on a non-custodial protocol - there's no internal ledger to falsify.

But code trust has its own failure modes. The Ronin bridge exploit in March 2022 drained USD 625 million because validator key management was centralised despite the on-chain architecture. The Euler Finance exploit in March 2023 extracted USD 197 million through a flash loan attack against a smart contract vulnerability that had passed audit. On-chain doesn't mean invulnerable.

The risk profile shifts. It doesn't disappear. You trade counterparty risk and custody risk for smart contract risk and oracle risk. For most active traders, that's the better trade - but only if you understand what you're actually trusting, and why.

Five questions worth answering before you trade on-chain

  1. Do you understand where your collateral sits between deposit and withdrawal? It's in the protocol's smart contracts - not your wallet, and not the platform's custody. Know the difference.
  2. Has the protocol's smart contract code been audited, and by whom? Audits reduce risk. They don't eliminate it. Know which firms audited the contracts and when.
  3. What is the liquidation mechanism? Does the protocol use an insurance fund, socialised losses, or auto-deleveraging? Each has different implications for your position during volatile markets.
  4. What oracle does the protocol use for mark price? Oracle manipulation is a documented attack vector. Protocols using multiple independent price feeds are more resistant than those relying on a single source.
  5. What happens to your funds if the front-end goes down? If the interface disappears, can you still interact with the smart contracts directly? On a properly non-custodial protocol, the answer is yes.

Start on testnet to run through the full stack - deposit, order, withdraw - before committing mainnet capital.

stackedmarkets.com

FAQs

What is a smart contract in simple terms?

A smart contract is code deployed on a blockchain that executes automatically when predefined conditions are met. No intermediary triggers it or approves the outcome. Once the conditions are satisfied, the code runs and the result is recorded permanently on-chain.

Why is Ethereum used for financial applications?

Ethereum was the first blockchain to support general-purpose programmable contracts through the EVM. Its network effects, developer ecosystem, and security model make it the dominant platform for DeFi applications. Most on-chain financial protocols either deploy on Ethereum mainnet or on Layer 2 networks that settle to Ethereum.

What is Arbitrum and how does it differ from Ethereum?

Arbitrum is a Layer 2 network built on Ethereum using Optimistic Rollup technology. It processes transactions off-chain at much higher throughput - approximately 40,000 TPS versus Ethereum mainnet's 15 to 30 TPS - and posts compressed transaction batches back to Ethereum for settlement. Fees on Arbitrum are a fraction of mainnet costs while inheriting Ethereum's security guarantees.

How do smart contracts handle perpetual futures trading?

A perpetual futures smart contract tracks position size, direction, entry price, and margin for each trader. It calculates and settles PnL when positions are closed, distributes funding payments between longs and shorts at each funding interval, and triggers liquidations automatically when margin falls below the maintenance threshold - all without human intervention.

What is the difference between an AMM and a CLOB?

An AMM prices trades using a mathematical formula applied to a liquidity pool, without a traditional order book. A CLOB matches buy and sell orders at specific prices - the same model used by traditional exchanges. CLOBs offer tighter spreads and more precise execution for active traders but require higher throughput infrastructure to run on-chain.

Is on-chain trading safer than using a centralised exchange?

The risk profile is different, not categorically safer. On-chain trading eliminates counterparty risk and custody risk - the exchange can't misuse your funds or freeze withdrawals. But it introduces smart contract risk and oracle manipulation risk. The code executes as written, including any bugs. Understanding what you're trusting in each model is more useful than declaring one universally safer.

How does Stacked Markets fit into this stack?

Stacked Markets is a front-end trading interface that routes orders to Hyperliquid's on-chain CLOB. Your USDC bridges from Arbitrum into Hyperliquid's margin system, your orders are signed by your wallet and executed on-chain, and Stacked Markets holds neither your funds nor your keys at any point. The platform provides the interface and tooling; the on-chain protocol handles custody and settlement.

All trading involves risk.

Perpetual futures use leverage. You can lose all collateral. Stackedmarkets does not custody funds or hold your main wallet keys. We do not provide investment advice. Nothing here is an offer to buy or sell. Trade only with capital you can afford to lose. Always verify testnet vs mainnet in the product chrome.

Stacked Markets is a decentralized perpetual futures trading platform. All trading activities are conducted on-chain and are subject to blockchain network conditions and smart contract risks.

Trading perpetual futures involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. The high degree of leverage can work against you as well as for you. Before deciding to trade, you should carefully consider your investment objectives, level of experience, and risk appetite.

The information provided on this platform does not constitute investment advice, financial advice, trading advice, or any other sort of advice, and you should not treat any of the platform's content as such.

stacked markets

© 2026 Stacked Markets. All rights reserved.

How smart contracts work in financial markets (2026)