feat(onchain): replace paid Arkham lookup with a free multi-source aggregator#159
Merged
Merged
Conversation
…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
added a commit
that referenced
this pull request
Jun 17, 2026
fix(onchain): wire BLOCKSCOUT_API_KEY (lost in the #159 merge)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Arkham costs ~$1K / 10k requests. This removes the paid dependency and replaces it with a free, provenance-tagged attribution aggregator.
How
onchain.lookupnow callsservices/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 asrag.search).confidence)MISTTRACK_API_KEY)riskScore/riskLevel; skipped if no keyReturn shape stays backward-compatible (
entityName,entityType,label,isContract,unattributed) so the agent tool + dashboard keep working, and addsriskScore,riskLevel,tags[], andsources[](provenance — which source said what). Attribution stays a claim: only our DB carries aconfidence.Removed
services/arkham.ts+arkham.test.tsdeleted.ARKHAM_API_KEYno longer read — delete it from the droplet.env(no rotation needed since the account is being cancelled).Verified live (no key)
UniswapV2Router02(contract)scamsniffer, conf 75) with Blockscout corroborating insourcesunattributed, no throwNew
onchain-lookup.test.tscovers merge precedence + DB-wins + graceful-empty. Gatewaytsc+ full api suite (69 files) green. No migration (reuseswallets).Next (separate PRs)
🤖 Generated with Claude Code