crypto-aml
v0.1.0
Published
Crypto AML / KYT JavaScript SDK for the AnChain.AI Data API — wallet screening, risk scores, and OFAC sanctions checks.
Maintainers
Readme
crypto-aml
JavaScript SDK for crypto AML / KYT against the AnChain.AI Data API. Screen wallets, score blockchain risk, and run OFAC SDN checks by name, passport, or crypto address.
| | |
| -------- | --- |
| Install | npm install crypto-aml |
| API base | https://api.anchainai.com |
| Auth | x-api-key: <YOUR_KEY> |
| Runtime | Node.js ≥ 18 (native fetch) |
| Dependencies | none |
Get a free API key at data.anchainai.com.
Install
npm install crypto-aml# from this repo
cp .env.example .env # set ANCHAIN_API_KEY
npm test
npm run example:start
npm run example:screenQuick start
import { AnChainClient, screenAndDecide } from "crypto-aml";
const client = new AnChainClient(); // reads ANCHAIN_API_KEY
const result = await screenAndDecide(
client,
"eth",
"0x2f389ce8bd8ff92de3402ffce4691d17fc4f6535",
);
console.log(result.summary());
// → [BLOCK] ETH 0x2f38… | score=100 level=4 | categories=[wallet, exchange, sanction] | …
if (result.shouldBlock) {
// refuse withdrawal / deposit
}OFAC sanctions
const byName = await client.searchOfac({ name: "chen zhi", type: "individual" });
const byId = await client.searchOfac({ id: "K00395168", type: "individual" });
const byWallet = await client.screenOfacAddress(
"bc1qeth6n6ryxexvkx34wnx3nuynun4474h3j0gkhw",
);Credits
Every intel call returns credit headers on response.credits and client.lastCredits:
const label = await client.getAddressLabel("btc", "1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s");
console.log(label.credits);
// → { remaining: 969760, expiresAt: '2027-03-21T…', source: 'headers' }| Endpoint | Method | Credits |
| -------- | ------ | ------: |
| /api/intel/address/label | GET | 5 |
| /api/intel/address/score | GET | 10 |
| /api/sanctions/ofac/address | GET | 5 |
| /api/sanctions/ofac/search | POST | 10 |
KYT policy
Default screenAndDecide / decide rules:
- BLOCK if category ∈
{sanction, mixer, ransomware, terrorism, darknet market, hacker, scam, malware, blackmail} - ALLOW trusted labels (
exchange,miner,validator,defi, …) when only those (+whale/wallet) are present — disable withANCHAIN_TRUST_EXCHANGES=0 - BLOCK if score ≥
80(ANCHAIN_BLOCK_SCORE_THRESHOLD) - REVIEW if score ≥
51(ANCHAIN_REVIEW_SCORE_THRESHOLD) - ALLOW otherwise
Busy exchange hot wallets often show high exposure scores; the SDK prefers the label (and prints optional risk_vasp) unless a hard-block category is also present.
API surface
import {
AnChainClient,
AnChainError,
screenAndDecide,
decide,
parseScoreResponse,
CREDIT_COSTS,
DECISIONS,
} from "crypto-aml";| Export | Role |
| ------ | ---- |
| AnChainClient | HTTP client (getAddressLabel, getAddressScore, searchOfac, screenOfacAddress) |
| screenAndDecide(client, proto, address) | Label + score → ScreeningResult |
| decide(result) | Apply ALLOW / REVIEW / BLOCK policy |
| parseScoreResponse(proto, address, apiResponse) | Normalize nested API payload |
| CREDIT_COSTS | Documented per-call credit costs |
TypeScript types ship in src/index.d.ts.
Layout
src/
client.js # AnChainClient + credit headers
risk.js # parse + KYT policy
index.js # public exports
index.d.ts # TypeScript types
examples/
01_get_started.js
02_screen_address.js
03_raw_api_dump.js
test/Publish
npm test
npm pack --dry-run
npm publish --access publicBump with npm version patch|minor|major, then publish again. Prefer npm Trusted Publishing (OIDC) from GitHub Actions for CI releases.
License
Apache-2.0 — Copyright 2026 AnChain.AI
