<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# API Reference — Analyzing Cryptocurrency Forensics

## Blockstream Esplora API (Bitcoin)

```bash
# Address info
curl "https://blockstream.info/api/address/ADDRESS"

# Address transactions
curl "https://blockstream.info/api/address/ADDRESS/txs"

# Transaction details
curl "https://blockstream.info/api/tx/TXID"

# UTXO set for address
curl "https://blockstream.info/api/address/ADDRESS/utxo"

# Block at height
curl "https://blockstream.info/api/block-height/800000"
```

## Etherscan API (Ethereum)

```bash
# Balance
curl "https://api.etherscan.io/api?module=account&action=balance&address=ADDR&apikey=KEY"

# Transaction list
curl "https://api.etherscan.io/api?module=account&action=txlist&address=ADDR&apikey=KEY"

# ERC-20 transfers
curl "https://api.etherscan.io/api?module=account&action=tokentx&address=ADDR&apikey=KEY"

# Internal transactions
curl "https://api.etherscan.io/api?module=account&action=txlistinternal&address=ADDR&apikey=KEY"

# Contract ABI
curl "https://api.etherscan.io/api?module=contract&action=getabi&address=ADDR&apikey=KEY"
```

## Web3.py (Ethereum)

```python
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/KEY'))

w3.eth.get_balance('0xADDRESS')
w3.eth.get_transaction_count('0xADDRESS')
w3.eth.get_transaction('0xTXHASH')
w3.eth.get_transaction_receipt('0xTXHASH')
w3.eth.get_block('latest')
```

## python-bitcoinlib

```python
from bitcoin.rpc import RawProxy
p = RawProxy()
p.getblockcount()
p.getrawtransaction('TXID', True)
p.getblock('BLOCKHASH')
```

## NetworkX — Graph Analysis

```python
import networkx as nx
g = nx.DiGraph()
g.add_edge('addr1', 'addr2', value=50000, txid='abc')
nx.write_gexf(g, 'tx_graph.gexf')          # For Gephi
nx.drawing.nx_agraph.write_dot(g, 'tx.dot') # For Graphviz
```

## Known Service Addresses

Maintain a lookup database of known exchange/service addresses:
- Blockchain.info tags API
- OXT.me entity database
- WalletExplorer.com clusters
- Crystal, Chainalysis (commercial)
