BTC…ETH…ETH gas…Fear & Greed…Market data · not advice

Academy School · Chapter 9 of 14

DEX & Onchain Analysis

How to read onchain activity and assess token behavior on decentralized venues.

10 minute lesson4 required questionsFull score to continue
Course progress0 / 14

← Academy School overview

An illustrative order book separates bids, asks and the spread. These are fictional values.

DEX vs CEX

When you trade on a centralized exchange (CEX), you first deposit coins to an address the exchange controls. From then on your balance is an entry in the exchange's private database, and its matching engine pairs your order with other customers' orders without touching a blockchain. Nothing moves onchain until you withdraw. A decentralized exchange (DEX) works the other way round: a smart contract holds the trading liquidity, your own wallet signs the swap, and the trade settles in a single onchain transaction. If it succeeds, the new tokens are in your wallet. If it fails, nothing changes except the gas you paid.

Worked example: one swap against a pool

Take a constant-product pool of the kind Uniswap v2 popularised, holding 500 ETH and 1,500,000 USDC, so the quoted price is 3,000 USDC per ETH. You sell 10 ETH. The pool keeps a 0.30 percent fee, so 9.97 ETH counts towards the swap, and the contract keeps the product of the two reserves from falling. You receive 1,500,000 x 9.97 / (500 + 9.97) = 29,325.25 USDC, an average of 2,932.53 per ETH, about 2.2 percent below the quote. Your counterparty is a formula, not a person, and a bigger order moves further along the curve. That gap is why the slippage setting matters.

QuestionCEXDEX
Who holds the coins before the trade?The exchangeYou, until the swap executes
Where is the trade recorded?The exchange's internal ledgerThe public blockchain
Main failure you are exposed toInsolvency, frozen withdrawals, platform hacksContract bugs, malicious tokens, careless approvals

The custody difference is not theoretical. FTX halted withdrawals and filed for bankruptcy on 11 November 2022, and its customers' balances became claims in a bankruptcy rather than coins they could withdraw. A DEX user avoids that failure but takes on the contract and token risks covered below.

Core idea

Before any trade, name who holds the asset at each step. On a CEX it is the exchange from deposit to withdrawal. On a DEX it is your wallet, plus every contract you have approved to move your tokens.

Wallet Tracing and Activity

Every transaction on a public chain records a sender, a recipient, an amount, a time and the contract calls it triggered. Wallet tracing means following those records between addresses to reveal behaviour patterns and fund flows: where money came from, where it went, how often and in what sizes.

Reading a token transfer correctly

A common beginner error on Ethereum: in a USDC transfer, the transaction's "to" field is the USDC token contract, not the person being paid. The real recipient sits in the event log the contract emits, a Transfer event listing sender, recipient and amount. That amount is stored as a raw integer. USDC uses 6 decimals, so a raw value of 2500000000 means 2,500 USDC, while a token with 18 decimals needs 18 places removed. Read the log and the decimals before writing down any number.

How analysts link addresses

  • Common inputs. The Bitcoin whitepaper itself notes that a transaction spending several inputs reveals they had the same owner. Analysts group addresses this way, although collaborative transactions such as CoinJoin are built to break the assumption.
  • Deposit addresses. Many exchanges sweep each customer's deposit address into a shared hot wallet, so addresses that feed it can be linked to that exchange.
  • Timing and size. Identical amounts sent at regular intervals usually point to automation, such as a bot or a payroll script.

In August 2016 a hacker took 119,754 BTC from Bitfinex. Investigators followed the coins through years of transactions, and in February 2022 the US Department of Justice announced the seizure of more than 94,000 of them, then valued at about $3.6 billion. Tracing identified the trail, but the seizure itself depended on a search warrant that found the private keys. The tracing and recovery entry explains why most victims do not get that outcome.

Core idea

Write every tracing conclusion as an inference with its method named, for example "same owner, by common inputs". An explorer label is someone's claim, and one wrong link can attach a stranger's funds to your story.

Token Scam Patterns

You inspect a token contract to detect scam and permission risks that the website and the chart do not show. A token is a program, and whoever controls its admin functions can often change the rules after you buy.

  • Honeypot. Buys work and sells fail. The contract blocks transfers into the trading pool for everyone except allowed addresses, so your balance shows a value you cannot realise.
  • Adjustable fees. An owner function can raise the sell tax at any time. At 99 percent, selling tokens worth $1,000 returns $10.
  • Hidden minting. An owner who can mint can create new supply and sell it into the pool, diluting every holder.
  • Liquidity removal. If the deployer holds the pool's liquidity tokens and they are not locked, the deployer can withdraw the pool's real assets and leave holders with no exit. This is the classic rug pull.
  • Approval abuse. ERC-20 tokens let you approve a spender to move your tokens. Many sites request the maximum possible allowance (2 to the power 256, minus 1). If that spender is malicious or later compromised, it can take your whole balance of that token at any time until you reset the approval to zero. See the token approval and wallet drainer entry.

A dated example: the SQUID token borrowed the name of a Netflix series it had no link to and rose steeply in late October 2021 while buyers reported that they could not sell. On 1 November 2021 its price collapsed to almost nothing as the anonymous team pulled more than $3 million out of the liquidity pool. The rising chart and the media attention were not evidence of anything. The sell restriction in the code was the evidence, and it was visible before the collapse.

Core idea

List what the owner can still do (mint, pause, blacklist, change fees, upgrade, remove liquidity) and who holds that power. A verified, readable contract with live owner powers still asks you to trust that owner.

Research Discipline

Good onchain research is repeatable and checklist-based: the same steps, in the same order, every time, so the result does not depend on your mood or on how exciting the chart looks. Write down the answer to each step, including "could not verify".

  1. Confirm the contract address and chain from the issuer's own documentation. Names and tickers can be copied for free.
  2. Read the owner powers from the previous section, and note whether control sits with one address, a multisig or nobody.
  3. Measure usable liquidity: the pool's reserves of the quote asset, not the market capitalisation. Calculate what a sale of your size would return.
  4. Check holder concentration correctly, as in the example below.
  5. Record every claim you could not check as unproven.

Worked example: holder concentration

A token has a supply of 1,000,000,000. The explorer's top holder list shows the liquidity pool with 400 million, a burn address with 100 million, then five wallets with 30 million each. Read naively, those five hold 150 million, or 15 percent of supply. But the pool's tokens are the market itself, and burned tokens can never move, so only 500 million are in private hands. The five wallets control 150 / 500 = 30 percent of the tradable supply. If funding records show all five were filled from one address, treat them as a single holder with 30 percent.

Then test the opposite error. A shared funding source can also be an exchange hot wallet paying many unrelated customers, which is why step 5 matters. The onchain analysis and DEX trading guide adds an evidence log for separating observations from inferences.

Core idea

A conclusion is only as strong as its weakest unverified step. If the owner powers, the liquidity or the holder links cannot be confirmed, the honest result is "unknown", and unknown is a reason to walk away rather than to guess.

Further reading

On Ledgers Academy

Primary sources