Crypto exchanges and wallets form the infrastructure layer that enables buying, selling, storing, and transferring digital assets. Understanding their mechanics, security models, and tradeoffs is essential before interacting with cryptocurrency markets.
Account Creation: KYC (Know Your Customer) verification—you prove your identity with government ID, address proof.
Deposit: You send fiat (bank transfer, credit card) or crypto (blockchain transfer) to the exchange's omnibus wallet.
Internal Ledger: The exchange credits your account. Your balance now exists in their off-chain database, not on-chain.
Trading: You place orders. The exchange matches you with counterparties instantly because it's all internal accounting—no blockchain transactions during trades.
Withdrawal: You request to send funds out. The exchange broadcasts an on-chain transaction from their wallet to your personal wallet.
Why this model?
Speed: Off-chain matching = millisecond execution, not waiting for blockchain block confirmations (10 min for Bitcoin, 12 sec for Ethereum).
Complexity: Advanced order types (limit, stop-loss, margin, futures) are easier to implement in traditional software than in smart contracts.
Liquidity: Centralized order books aggregate buyers/sellers, providing better prices for large trades.
Tradeoffs:
Counterparty risk: Exchange bankruptcy (FTX 2022), hacks (Mt. Gox 2014), or fraud means you lose funds.
Custody: "Not your keys, not your coins"—you're trusting the exchange's security andolvency.
Censorship: Exchange can freeze your account, block withdrawals (government order, AML flags, terms-of-service violation).
DEXs like Uniswap use Automated Market Makers (AMMs) instead of order books:
Liquidity Pools: Users deposit pairs of tokens (e.g., ETH and USDC) into a smart contract. The pool now has reserves RETH and RUSDC.
Constant Product Formula: The AM maintains RETH×RUSDC=k (constant).
Swap Execution: You want to buy ETH with USDC. You send USDC to the pool; it calculates how much ETH to send you such that k stays constant (minus a small fee).
Price Discovery: Price = ratio of reserves. As people buy ETH, RETH decreases and RUSDC increases, so price of ETH rises.
Deriving the swap formula:
Suppose the pool has Rx of token X and Ry of token Y, with k=Rx⋅Ry. You send Δx of token X. How much Δy of token Y do you get?
After the swap:
(Rx+Δx)(Ry−Δy)=k=RxRy
Expand:
RxRy−RxΔy+ΔxRy−ΔxΔy=RxRyCancel RxRy and solve for Δy:
ΔxRy−RxΔy−ΔxΔy=0Δy(Rx+Δx)=ΔxRyΔy=Rx+ΔxΔx⋅Ry
Why this form? As Δx increases, denominator grows, so Δy grows slower (you get worse price for larger trades = slippage). This is the price impact of your trade.
Including a fee ϕ (e.g., 0.3%), the actual formula becomes:
Δy=Rx+Δx(1−ϕ)Δx(1−ϕ)⋅Ry
Why AMs?
No order book: Smart contracts can't efficiently maintain sorted order lists on-chain (too gas-expensive). Constant product is a simple formula executable in one transaction.
Permissionless: Anyone can create a pool or add liquidity; no company gatekeping.
Always available: As long as the blockchain runs and the pool has liquidity, you can trade 24/7 with no downtime.
Tradeoffs:
Slipage: Large trades get progressively worse prices. On a CEX, a big order might be filled at a narrow price range; on a DEX, you're moving the pool curve.
Gas fees: Every swap is an on-chain transaction. Ethereum gas can cost $5–$50+ during congestion.
Impermanent loss: If you provide liquidity and prices diverge, you may end up with less value than just holding the tokens.
Smart contract risk: Bugs or exploits in the DEX code can drain funds.
[!example] DEX Swap Calculation
Scenario: Uniswap ETH/USDC pool has RETH=1000 ETH, RUSDC=2,000,000 USDC. Current price: $2,000/ETH. You want to swap 10,000 USDC for ETH. Fee = 0.3%.
Step 1: Calculate ETH received (no fee first, for clarity):
ΔyETH=RUSDC+ΔxUSDCΔxUSDC⋅RETH=2,000,000+10,00010,000⋅1000=2,010,00010,000,000≈4.975 ETHWhy divide by (RUSDC+Δx)? We're adding USDC to the pool, so denominator grows, reducing ETH output.
Step 2: Include 0.3% fee:
Δxeffective=10,000×0.997=9,970ΔyETH=2,000+9,9709,970⋅1000≈4.963 ETH
Your wallet displays a 12-word or 24-word seed phrase (e.g., "witch collapse practice feed shame open despair creek road again ice least..."). This phrase is your private key, encoded as words for easier backup.
Derivation process (BIP39 standard):
Seed phrase → 512-bit seed (via PBKDF2 hashing)
Seed → Master private key (via HMAC-SHA512)
Master key → Child keys for different accounts/addresses (hierarchical deterministic derivation)
Why? One phrase can generate infinite addresses for Bitcoin, Ethereum, etc., in a deterministic sequence. Backup once, recover everything.
Security principles:
Never share seed phrase: Anyone with it can recreate your wallet and steal all funds. No legitimate service will ever ask for it.
Offline backup: Write on paper/metal, store in safe or bank deposit box. Never type into computer unless recovering.
Multi-sig wallets: Require m of n keys to sign transactions (e.g., 2-of-3). Protects against single key compromise. Used by institutions.
In most jurisdictions (US, UK, India, EU), cryptocurrency is property (not currency) for tax purposes:
Capital gains tax: Selling crypto (even for another crypto) = taxable event. If you bought BTC at 20k,soldat40k, you owe tax on $20k gain.
Income tax: Receiving crypto (mining rewards, staking, airdrops, salary) = ordinary income at fair market value.
Record-keeping burden: You must track cost basis and date for every transaction. Exchanges provide CSV exports; walets don't (you need third-party tools like Koinly, CoinTracker).
Common mistake: Trading between cryptos (BTC → ETH) "doesn't count" as a sale. Wrong—it triggers capital gains on the BTC appreciation.
Imagine you have special video game coins (cryptocurrency). To buy or sell these coins, you need two things:
An exchange (like a store where people trade game coins). Some stores are run by a company (centralized)—you give them your coins to hold, and they let you trade super fast on their computers. Other stores are more like a vending machine (decentralized)—you use your own wallet to trade directly with other people through automatic rules in a smart program. No company boss can close your account because there is no company!
A wallet (like a backpack for your coins, but digital). Your wallet has a secret password (private key) that proves the coins are yours. If you write the password on paper and hide it somewhere safe, that's a "cold wallet" (like burying treasure). If you keep it on your phone so you can spend coins anytime, that's a "hot wallet" (easy to use, but if someone hacks your phone, they can steal the password and take your coins).
The important rule: If you keep your coins in the company's store, they're holding your password for you. That's easier, but if the store gets robed or goes bankrupt, you lose your coins. If you use the vending-machine-style exchange and keep your password in your own backpack, you're in control, but you also have to be super careful not to lose your password—there's no "forgot password" button because no one else knows it!
What are the two main types of crypto exchanges and their key tradeoff? :: Centralized exchanges (CEX) like Coinbase offer speed, liquidity, and convenience but require trusting the exchange with custody (counterparty risk). Decentralized exchanges (DEX) like Uniswap offer non-custodial trading and censorship resistance but have higher slippage, gas fees, and require users to manage their own keys.
What is the difference between a private key, public key, and address in crypto walets?
The private key is a secret number that signs transactions and proves ownership. The public key is mathematically derived from the private key using elliptic curve cryptography and is used to verify signatures. The address is a shortened hash of the public key (e.g., 0x123..) that serves as your receiving address. Only the private key can spend funds; losing it means irreversible loss of access.
How does the constant product formula work in AM-based DEXs?
In an AMM like Uniswap, liquidity pools maintain k = R_x × R_y (constant). When you swap Δx of token X for token Y, the formula Δy = (Δx × R_y) / (R_x + Δx) determines how much Y you receive. As you buy more of one token, its reserve decreases, making each additional unit more expensive (causing slippage).
Why is "not your keys, not your coins" important in crypto?
When you hold crypto on a centralized exchange, the exchange controls the private keys, not you. You have an IOU, not actual ownership on the blockchain. If the exchange is hacked (Mt. Gox), goes bankrupt (FTX), or freezes your account, you can lose access to your funds. True ownership means possessing the private key that can sign transactions from the address holding your coins.
What is slippage and why does it occur on DEXs?
Slippage is the difference between expected price and executed price. On AM-based DEXs, your trade changes the pool's reserve ratio (from k = R_x × R_y). Large trades remove more of one token, increasing its price progressively. Example: buying ETH when pool has 1000 ETH might get you the first bit at 2000,butthelastbitat2020, averaging $2010 (0.5% slippage).
What is the purpose of a seed phrase and how should it be secured?
A seed phrase (12 or 24 words) encodes your master private key using BIP39 standard. It can deterministically generate all your wallet addresses. Security: write it on paper/metal, never digitally (no photos, cloud storage, email). Store offline in a safe or bank deposit box. Never share with anyone—possession of the seed phrase = full control of all funds.
What triggers capital gains tax in cryptocurrency?
Selling crypto for fiat, trading crypto for another crypto, or using crypto to buy goods/services are all taxable events in most jurisdictions (treating crypto as property, not currency). Each event requires calculating capital gain/loss: sale price minus cost basis. Holding doesn't trigger tax; disposing does. Trading BTC for ETH = selling BTC at current value (taxable).
What is the difference between custodial and non-custodial wallets?
Custodial wallets (exchange accounts) = third party holds your private keys, you trust them. Easy to use, can recover account with email/phone, but vulnerable to exchange hacks and bankruptcy. Non-custodial wallets (MetaMask, hardware wallets) = you hold your private keys, responsible for security and backups. No counterparty risk, but lose keys = lose funds permanently.
Why do centralized exchanges require KYC?
KYC (Know Your Customer) is legally required in most jurisdictions to comply with AML (Anti-Money Laundering) regulations. Exchanges need banking partnerships for fiat on/off ramps; banks demand AML compliance. Exchanges must verify identity, monitor for suspicious activity, and report to financial regulators. Operating without KYC risks criminal charges and loss of banking access.
What is impermanent loss in liquidity provision?
When you provide liquidity to an AMM pool (e.g., deposit equal value of ETH and USDC), you earn trading fees but face impermanent loss if prices diverge. If ETH doubles, the pool rebalances (you end up with less ETH, more USDC than if you'd just held). The loss is "impermanent" because it disappears if prices return to original ratio. Only realized when you withdraw liquidity.
Dekho, crypto exchange aur wallet ko samajhna aise hai jaise banking system ko samajhna. Exchange ek combined stock brokerage plus currency exchange booth ki tarah hai jahan tum apna fiat money (jaise rupees ya dollars) crypto mein badalte ho, ya ek crypto ko doosre se swap karte ho. Wallet ek safe-deposit box jaisa hai, lekin isme actual coins store nahi hote - isme tumhare cryptographic keys store hote hain jo prove karte hain ki blockchain par recorded coins tumhare hain. Yahan sabse important baat yeh hai ki jo private key hold karta hai, wahi asli owner hai.
Ab why it matters - traditional banking se yeh bilkul alag hai. Agar tum apna bank password bhool jao, toh manager reset kar dega. Lekin crypto mein agar tumne apni private key kho di, toh koi bhi tumhe help nahi kar sakta - paisa gaya toh gaya. Agar kisi ne key chura li, toh koi credit card company transaction reverse nahi karegi. Isiliye "not your keys, not your coins" wala funda itna famous hai. Exchanges do type ke hote hain - CEX (centralized, jaise Coinbase/Binance) jahan company tumhare funds custody karti hai, aur DEX (decentralized, jaise Uniswap) jahan tum khud apni keys ke saath control rakhte ho.
Ek aur practical baat - CEX itne fast kyun hote hain? Kyunki jab tum trade karte ho, sab kuch unke internal off-chain database mein hota hai, blockchain par nahi. Isse execution milliseconds mein ho jaata hai, warna Bitcoin ke block confirmation ke liye 10 minutes wait karna padta. Lekin iska tradeoff yeh hai ki counterparty risk aa jaata hai - agar exchange bankrupt ho jaye (jaise FTX 2022 mein hua) ya hack ho jaye (Mt. Gox 2014), toh tumhara paisa doob sakta hai. Isliye hot wallet (internet-connected, convenient) aur cold wallet (offline, secure) ka balance samajhna zaroori hai - active trading ke liye thoda amount hot mein rakho, aur bada holding cold storage mein safe rakho.