Why
A quick evaluation of a common build-vs-buy tradeoff in crypto tooling — instead of indexing chain data yourself (event logs, balance changes) to answer "what does this wallet hold," a hosted indexing API like Moralis answers it in one call.
How it works
Planned: a small server route calling Moralis's Wallet API (net-worth and token-balance endpoints) with a server-held API key, rendering a simple portfolio snapshot for any address a visitor enters — read-only, no wallet connection needed. Not yet built.
Related code
"""Moralis Wallet API: fetch a mock wallet snapshot (token balances) and
compute a simple portfolio summary using mock prices, instead of indexing
chain data yourself.
"""
def mock_moralis_get_wallet_tokens(address):
# Simulates what Moralis's Wallet API would return for token balances.
return {
"address": address,
"tokens": [
{"symbol": "ETH", "balance": 1.85},
{"symbol": "USDC", "balance": 2500.0},
{"symbol": "LINK", "balance": 120.0},
],
}
MOCK_PRICES_USD = {"ETH": 3200.0, "USDC": 1.0, "LINK": 14.5}
def summarize_portfolio(snapshot, prices):
rows = []
total = 0.0
for token in snapshot["tokens"]:
price = prices.get(token["symbol"], 0.0)
value = token["balance"] * price
total += value
rows.append((token["symbol"], token["balance"], price, value))
return rows, total
address = "0xA1b2C3d4E5f6789012345678901234567890AbCd"
snapshot = mock_moralis_get_wallet_tokens(address)
print(f"wallet snapshot for {snapshot['address']}:")
rows, total = summarize_portfolio(snapshot, MOCK_PRICES_USD)
for symbol, balance, price, value in rows:
print(f" {symbol:5s} balance={balance:>10.4f} price=${price:>8.2f} value=${value:>10.2f}")
print(f"\ntotal portfolio value: ${total:,.2f}")
docs/code/pocs/moralis-wallet-api.py
Where it lands in Jayverse
- Wallet: default to a hosted indexing API for portfolio/net-worth display, not a self-built indexer. Use Moralis or an equivalent for balance and net-worth first, and only build a custom indexer once a concrete gap forces it.
- Devnet: confirm the chosen indexing API actually supports Anvil devnet (chainId 313370) before depending on it. If it doesn't, that unsupported-chain gap is exactly the case that justifies building the custom indexer instead.
Key expressions
| Expression | 뜻 · 쓰이는 자리 |
|---|---|
| build-vs-buy tradeoff | 직접 구축할지 외부 서비스를 살지의 선택 문제 · 개발 전략을 논할 때. "a common build-vs-buy tradeoff in crypto tooling" |
| in one call | 한 번의 호출로 · API가 복잡한 조회를 단순화할 때. "a hosted indexing API... answers it in one call" |
| hosted (service) | (외부에서) 호스팅되는, 운영해주는 · 직접 운영하지 않고 맡기는 서비스를 말할 때. "a hosted indexing API like Moralis" |
| render (verb) | (화면을) 렌더링하다, 그려주다 · 데이터를 화면에 표시할 때. "rendering a simple portfolio snapshot" |
| server-held | 서버가 보관하는 · 민감한 키를 클라이언트가 아닌 서버가 쥘 때. "a server-held API key" |
| Moralis | 모랄리스 · 지갑 잔액·순자산을 API 한 번으로 조회해주는 호스팅형 인덱싱 서비스. "Moralis's Wallet API (net-worth and token-balance endpoints)" |