---
name: wallet-analyzer
description: Summarise an EVM or TRON wallet — native balance, stablecoin and major token holdings, recent transfers and counterparties — using only public RPCs and explorers. Use when the user shares a wallet address and asks what it holds, what it has been doing, or whether it looks risky.
---

# Wallet analyzer

Produce a factual, sourced snapshot of a wallet. Do not speculate about the owner's identity.

## 1. Identify the chain

- `0x` + 40 hex → EVM. The same address exists on every EVM chain; check the chains the user cares about (default: Ethereum, BNB Chain, Base, Arbitrum, Polygon).
- `T` + 33 base58 chars → TRON.

## 2. Balances

EVM, per chain:

- Native: `eth_getBalance(address, "latest")`, divide by 1e18.
- Tokens: `eth_call` to `balanceOf(address)` — selector `0x70a08231` followed by the address left-padded to 32 bytes. Check at least USDT, USDC and the chain's wrapped native token. Divide by the token's decimals.

TRON:

- `POST https://api.trongrid.io/wallet/getaccount` with `{"address":"T…","visible":true}` → `balance` in SUN (÷ 1e6 for TRX).
- TRC-20 holdings: `GET https://api.trongrid.io/v1/accounts/{address}` → `trc20` array.

## 3. Recent activity

- TRON: `GET https://api.trongrid.io/v1/accounts/{address}/transactions/trc20?limit=50`.
- EVM: `eth_getLogs` for the Transfer topic `0xddf252ad…` with the address in `topics[1]` (outgoing) or `topics[2]` (incoming), over a recent block range (public RPCs often limit ranges to a few thousand blocks — page backwards). If an explorer API key is available (Etherscan-family `tokentx`), prefer it.

Aggregate: total in / out per token, top counterparties by volume, first and last seen activity, and any contract interactions.

## 4. Risk notes (only if asked)

Flag, with evidence: interactions with known mixers or sanctioned addresses if the user provides a list; approvals to unknown contracts (`Approval` events with large allowances); dust or address-poisoning transfers (tiny amounts from look-alike addresses). Label these as observations, not conclusions.

## Output

A short summary paragraph, then tables for balances and top counterparties, then notable transactions with hashes. Always state the block / time the snapshot was taken.
