
⛓️ Blockchain & Web3 · Database ERD
Tables for a crypto portfolio app: users, wallets on different chains, tokens, balances and transaction history.
Drawing diagram…
Database for a portfolio tracker: users own wallets; each wallet is on a chain; tokens belong to a chain; balances link wallet and token with an amount; transactions belong to a wallet and record hash, token, amount, direction and block time.
erDiagram
APP_USER ||--o{ WALLET : owns
CHAIN ||--o{ WALLET : "hosts"
CHAIN ||--o{ TOKEN : "issues"
WALLET ||--o{ BALANCE : holds
TOKEN ||--o{ BALANCE : "held as"
WALLET ||--o{ CHAIN_TX : records
TOKEN ||--o{ CHAIN_TX : moves
APP_USER {
int id PK
string email
}
CHAIN {
int id PK
string name
int chain_id
}
WALLET {
int id PK
int user_id FK
int chain_ref FK
string address
}
TOKEN {
int id PK
int chain_ref FK
string symbol
string contract_address
int decimals
}
BALANCE {
int id PK
int wallet_id FK
int token_id FK
decimal amount
}
CHAIN_TX {
int id PK
int wallet_id FK
int token_id FK
string tx_hash
decimal amount
string direction
datetime block_time
}The main parts of a centralised crypto exchange: a matching engine, wallets split between hot and cold storage, deposits and withdrawals, and compliance checks.
How an exchange processes a crypto withdrawal safely: balance hold, 2FA, risk and address screening, signing, broadcast and confirmations.
How an NFT marketplace works: listings signed off-chain, metadata on IPFS, and sales settled by a marketplace smart contract.
How a team safely upgrades a smart contract behind a proxy: audit, testnet rehearsal, multi-signature approval and a timelock before the change goes live.
The states a blockchain transaction goes through from signing to final confirmation, including replacement and dropped transactions.
How a custodian separates internet-connected hot wallets from offline cold storage, with signing hardware and an air-gapped transfer process.