CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
🌙☀️
Log inStart free
Home/Templates/Blockchain & Web3

⛓️ Blockchain & Web3 · Database ERD

Crypto Wallet and Holdings Schema

Tables for a crypto portfolio app: users, wallets on different chains, tokens, balances and transaction history.

More Blockchain & Web3 templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • One user can link wallets on many chains
  • Balances are stored per wallet and token
  • Each transaction records its chain hash for lookup

Prompt used

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.

Mermaid code
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
  }

Inside this diagram

An entity relationship diagram with 6 tables, 25 columns and 7 relationships.

Tables and their columns

  • APP_USER: id (PK), email
  • WALLET: id (PK), user_id (FK), chain_ref (FK), address
  • CHAIN: id (PK), name, chain_id
  • TOKEN: id (PK), chain_ref (FK), symbol, contract_address, decimals
  • BALANCE: id (PK), wallet_id (FK), token_id (FK), amount
  • CHAIN_TX: id (PK), wallet_id (FK), token_id (FK), tx_hash, amount, direction, block_time

Relationships

  • APP_USER owns WALLET: each APP_USER has zero or more WALLET, each WALLET belongs to exactly one APP_USER
  • CHAIN hosts WALLET: each CHAIN has zero or more WALLET, each WALLET belongs to exactly one CHAIN
  • CHAIN issues TOKEN: each CHAIN has zero or more TOKEN, each TOKEN belongs to exactly one CHAIN
  • WALLET holds BALANCE: each WALLET has zero or more BALANCE, each BALANCE belongs to exactly one WALLET
  • TOKEN held as BALANCE: each TOKEN has zero or more BALANCE, each BALANCE belongs to exactly one TOKEN
  • WALLET records CHAIN_TX: each WALLET has zero or more CHAIN_TX, each CHAIN_TX belongs to exactly one WALLET
  • TOKEN moves CHAIN_TX: each TOKEN has zero or more CHAIN_TX, each CHAIN_TX belongs to exactly one TOKEN

Make your own diagram like this

Describe your own system in plain English and the AI ER diagram generator draws it in seconds, in the same style as this template.

Related templates

C4 ArchitectureProBlockchain & Web3

Crypto Exchange Architecture

The main parts of a centralised crypto exchange: a matching engine, wallets split between hot and cold storage, deposits and withdrawals, and compliance checks.

SequenceBlockchain & Web3

Crypto Withdrawal Sequence

How an exchange processes a crypto withdrawal safely: balance hold, 2FA, risk and address screening, signing, broadcast and confirmations.

C4 ArchitectureProBlockchain & Web3

NFT Marketplace

How an NFT marketplace works: listings signed off-chain, metadata on IPFS, and sales settled by a marketplace smart contract.

FlowchartBlockchain & Web3

Smart Contract Upgrade Process

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.

State MachineBlockchain & Web3

Blockchain Transaction States

The states a blockchain transaction goes through from signing to final confirmation, including replacement and dropped transactions.

NetworkBlockchain & Web3

Hot and Cold Wallet Custody

How a custodian separates internet-connected hot wallets from offline cold storage, with signing hardware and an air-gapped transfer process.