Skip to content

feat(onchain): replace paid Arkham lookup with a free multi-source aggregator#159

Merged
rinjanianalytics merged 1 commit into
masterfrom
feat/free-onchain-lookup-aggregator
Jun 17, 2026
Merged

feat(onchain): replace paid Arkham lookup with a free multi-source aggregator#159
rinjanianalytics merged 1 commit into
masterfrom
feat/free-onchain-lookup-aggregator

Conversation

@rinjanianalytics

Copy link
Copy Markdown
Owner

Why

Arkham costs ~$1K / 10k requests. This removes the paid dependency and replaces it with a free, provenance-tagged attribution aggregator.

How

onchain.lookup now calls services/onchainLookup.ts, which fans out to several sources in parallel and merges by explicit precedence. It never throws — a source that errors simply doesn't contribute (same graceful-degradation pattern as rag.search).

Tier Source Cost Gives
0 our wallets DB free OFAC sanctioned / ScamSniffer scam / curated labels (+ numeric confidence)
1 MistTrack (SlowMist) optional BYO-key (MISTTRACK_API_KEY) entity label + AML riskScore/riskLevel; skipped if no key
2 DefiLlama free REST 7.6k protocols → name + category
3 Blockscout free REST (open-source explorer) contract name, is-contract, token info, public tags

Return shape stays backward-compatible (entityName, entityType, label, isContract, unattributed) so the agent tool + dashboard keep working, and adds riskScore, riskLevel, tags[], and sources[] (provenance — which source said what). Attribution stays a claim: only our DB carries a confidence.

Removed

  • services/arkham.ts + arkham.test.ts deleted.
  • ARKHAM_API_KEY no longer read — delete it from the droplet .env (no rotation needed since the account is being cancelled).

Verified live (no key)

  • Uniswap router → Blockscout UniswapV2Router02 (contract)
  • a DB scam address → DB-first wins (scamsniffer, conf 75) with Blockscout corroborating in sources
  • random EOA → unattributed, no throw

New onchain-lookup.test.ts covers merge precedence + DB-wins + graceful-empty. Gateway tsc + full api suite (69 files) green. No migration (reuses wallets).

Next (separate PRs)

  • DefiLlama ingest feed (bulk protocol labels → wallets, so most lookups resolve DB-first).
  • Dashboard: rename "Arkham lookup" → "On-chain lookup" + show multi-source provenance/risk.

🤖 Generated with Claude Code

…gregator

Arkham costs ~$1K/10k requests. Replace the single paid adapter with a free,
provenance-tagged attribution aggregator that fans out in parallel and merges
by explicit precedence (never throws — failed sources just don't contribute):

  tier 0  our wallets DB    — OFAC sanctioned / ScamSniffer scam / curated
  tier 1  MistTrack         — OPTIONAL BYO-key (MISTTRACK_API_KEY): entity
                              label + AML risk (score/level); off → skipped
  tier 2  DefiLlama         — 7.6k protocols → name + category (free REST)
  tier 3  Blockscout        — open-source explorer: contract name, is-contract,
                              token info, public tags (REST v2, no key)

`onchain.lookup` agent tool now calls services/onchainLookup.ts. Return shape
stays backward-compatible (entityName/entityType/label/isContract/unattributed)
and adds riskScore/riskLevel/tags/sources[]. Deleted services/arkham.ts +
arkham.test.ts; ARKHAM_API_KEY no longer read (remove it from prod .env).

Verified live (no key): Uniswap router → Blockscout "UniswapV2Router02";
a DB scam address → DB-first wins (scamsniffer, conf 75) with Blockscout
corroborating; random EOA → unattributed, no throw. New onchain-lookup.test.ts
covers merge precedence + DB-wins + graceful-empty. gateway tsc + full api
suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rinjanianalytics rinjanianalytics merged commit 7caedbc into master Jun 17, 2026
5 checks passed
rinjanianalytics added a commit that referenced this pull request Jun 17, 2026
fix(onchain): wire BLOCKSCOUT_API_KEY (lost in the #159 merge)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant