crypttrace 0.36.0__tar.gz → 0.38.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {crypttrace-0.36.0/src/crypttrace.egg-info → crypttrace-0.38.0}/PKG-INFO +14 -3
  2. {crypttrace-0.36.0 → crypttrace-0.38.0}/README.md +13 -2
  3. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/__init__.py +1 -1
  4. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/case.py +40 -9
  5. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/chains.py +3 -1
  6. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/cli.py +19 -0
  7. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/etherscan.py +8 -0
  8. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/tron.py +15 -2
  9. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/trace.py +3 -3
  10. crypttrace-0.38.0/src/crypttrace/transaction.py +79 -0
  11. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/web/index.html +90 -22
  12. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/webapp.py +31 -1
  13. {crypttrace-0.36.0 → crypttrace-0.38.0/src/crypttrace.egg-info}/PKG-INFO +14 -3
  14. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/SOURCES.txt +1 -0
  15. {crypttrace-0.36.0 → crypttrace-0.38.0}/LICENSE +0 -0
  16. {crypttrace-0.36.0 → crypttrace-0.38.0}/pyproject.toml +0 -0
  17. {crypttrace-0.36.0 → crypttrace-0.38.0}/setup.cfg +0 -0
  18. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/addresses.py +0 -0
  19. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/analysis.py +0 -0
  20. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/assess.py +0 -0
  21. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/assets.py +0 -0
  22. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/bridges.py +0 -0
  23. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/config.py +0 -0
  24. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/drain.py +0 -0
  25. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/evidence.py +0 -0
  26. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/export.py +0 -0
  27. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/__init__.py +0 -0
  28. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/bitcoin.py +0 -0
  29. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/http.py +0 -0
  30. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/solana.py +0 -0
  31. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/ton.py +0 -0
  32. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/freeze.py +0 -0
  33. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/funder.py +0 -0
  34. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/gascluster.py +0 -0
  35. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/investigate.py +0 -0
  36. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/__init__.py +0 -0
  37. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/audit.py +0 -0
  38. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/bulk.py +0 -0
  39. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/known.json +0 -0
  40. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/labels.py +0 -0
  41. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/names.py +0 -0
  42. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/partial.json +0 -0
  43. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/tonapi.py +0 -0
  44. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/labels/tronscan.py +0 -0
  45. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/offramp.py +0 -0
  46. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/pdf.py +0 -0
  47. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/poisoning.py +0 -0
  48. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/prices.py +0 -0
  49. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/render.py +0 -0
  50. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/report.py +0 -0
  51. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/spam.py +0 -0
  52. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/store.py +0 -0
  53. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/verify.py +0 -0
  54. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace/watch.py +0 -0
  55. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/dependency_links.txt +0 -0
  56. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/entry_points.txt +0 -0
  57. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/requires.txt +0 -0
  58. {crypttrace-0.36.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypttrace
3
- Version: 0.36.0
3
+ Version: 0.38.0
4
4
  Summary: OSINT toolkit for crypto investigations: trace stolen funds across Ethereum, Bitcoin, Tron, Solana and TON
5
5
  Author: bobslayerX
6
6
  License-Expression: MIT
@@ -121,6 +121,15 @@ address (about a minute); with your own endpoint (a free Helius or QuickNode
121
121
  key) it reads up to **1,000**, in parallel. `CRYPTTRACE_SOLANA_MAX_TXS` sets
122
122
  the number either way.
123
123
 
124
+ ## Look up a transfer by transaction hash
125
+
126
+ Run `crypttrace tx HASH --chain eth` or `crypttrace tx HASH --chain tron`.
127
+ Ethereum lookup uses an Etherscan key and shows the transaction's native ETH
128
+ value and transfer events for the ERC-20 contracts in the asset registry.
129
+ Tron lookup shows USDT from solidified receipts. The **Transaction lookup** tab
130
+ also opens a flow graph from a recipient for the same asset. The graph includes
131
+ available transfers strictly after the transaction's UTC timestamp.
132
+
124
133
  ## Supported chains
125
134
 
126
135
  | Chain | `--chain` | Data source | Model |
@@ -388,8 +397,10 @@ It reads up to 200 recent native and 200 recent token transfer rows per wallet,
388
397
  provider limits. Each match shows the distinct senders, individual amounts and assets, UTC
389
398
  times, explorer links and any known recipient label. A shared exchange wallet can receive
390
399
  unrelated deposits. On UTXO networks, input shares are estimates and outputs can be change.
391
- In the web app, open **Common recipients**, choose a saved case and network, and click
392
- **Find common recipients**.
400
+ In the web app, open **Common recipients** and select **New case…**. Choose a network,
401
+ name the case and paste at least two wallet addresses, one per line. **Create case and
402
+ find recipients** saves the case to the local case library and searches it immediately.
403
+ You can reopen the case in the same tab or with `crypttrace case show NAME`.
393
404
 
394
405
  ### Watch & alerts — catching the cash-out
395
406
 
@@ -84,6 +84,15 @@ address (about a minute); with your own endpoint (a free Helius or QuickNode
84
84
  key) it reads up to **1,000**, in parallel. `CRYPTTRACE_SOLANA_MAX_TXS` sets
85
85
  the number either way.
86
86
 
87
+ ## Look up a transfer by transaction hash
88
+
89
+ Run `crypttrace tx HASH --chain eth` or `crypttrace tx HASH --chain tron`.
90
+ Ethereum lookup uses an Etherscan key and shows the transaction's native ETH
91
+ value and transfer events for the ERC-20 contracts in the asset registry.
92
+ Tron lookup shows USDT from solidified receipts. The **Transaction lookup** tab
93
+ also opens a flow graph from a recipient for the same asset. The graph includes
94
+ available transfers strictly after the transaction's UTC timestamp.
95
+
87
96
  ## Supported chains
88
97
 
89
98
  | Chain | `--chain` | Data source | Model |
@@ -351,8 +360,10 @@ It reads up to 200 recent native and 200 recent token transfer rows per wallet,
351
360
  provider limits. Each match shows the distinct senders, individual amounts and assets, UTC
352
361
  times, explorer links and any known recipient label. A shared exchange wallet can receive
353
362
  unrelated deposits. On UTXO networks, input shares are estimates and outputs can be change.
354
- In the web app, open **Common recipients**, choose a saved case and network, and click
355
- **Find common recipients**.
363
+ In the web app, open **Common recipients** and select **New case…**. Choose a network,
364
+ name the case and paste at least two wallet addresses, one per line. **Create case and
365
+ find recipients** saves the case to the local case library and searches it immediately.
366
+ You can reopen the case in the same tab or with `crypttrace case show NAME`.
356
367
 
357
368
  ### Watch & alerts — catching the cash-out
358
369
 
@@ -1,2 +1,2 @@
1
1
  """crypttrace — OSINT crypto investigation CLI."""
2
- __version__ = "0.36.0"
2
+ __version__ = "0.38.0"
@@ -47,15 +47,24 @@ def _now() -> int:
47
47
  return int(time.time())
48
48
 
49
49
 
50
- def new(name: str, note: str = "") -> Path:
50
+ def new(name: str, note: str = "", *, entries: Optional[List[dict]] = None) -> Path:
51
51
  p = path_for(name)
52
- if p.exists():
53
- raise CaseError(f"case already exists: {p}")
54
52
  case = {"crypttrace_case": FORMAT, "name": p.stem, "created": _now(), "updated": _now(),
55
- "addresses": [], "notes": []}
53
+ "addresses": entries or [], "notes": []}
56
54
  if note:
57
55
  case["notes"].append({"at": _now(), "text": note})
58
- save(case, p)
56
+ data = json.dumps(case, indent=2, ensure_ascii=False)
57
+ p.parent.mkdir(parents=True, exist_ok=True)
58
+ try:
59
+ stream = p.open("x", encoding="utf-8")
60
+ except FileExistsError:
61
+ raise CaseError(f"case already exists: {p.name}")
62
+ try:
63
+ with stream:
64
+ stream.write(data)
65
+ except OSError:
66
+ p.unlink(missing_ok=True)
67
+ raise
59
68
  return p
60
69
 
61
70
 
@@ -96,23 +105,45 @@ def all_cases() -> List[dict]:
96
105
  return out
97
106
 
98
107
 
99
- def add(name: str, address: str, chain: str, role: str = "other", note: str = "") -> dict:
108
+ def _address_entry(address: str, chain: str, role: str, note: str) -> dict:
100
109
  chains.check(chain)
101
110
  if role not in ROLES:
102
111
  raise CaseError(f"role must be one of: {', '.join(ROLES)}")
103
112
  ok, why = addresses.validate(address, chain)
104
113
  if not ok:
105
114
  raise CaseError(f"not a valid {chain} address: {why}")
106
- case = load(name)
107
115
  key = chains.norm_addr(address, chain)
116
+ return {"address": key, "chain": chain, "role": role, "note": note, "added": _now(), "snapshot": None}
117
+
118
+
119
+ def new_from_wallets(name: str, chain: str, wallets: List[str]) -> Path:
120
+ """Create one named library case after validating all pasted wallets."""
121
+ if (not re.fullmatch(r"[\w-][\w.-]{0,63}", name) or name.endswith(".")
122
+ or name.lower().endswith(".json") or Path(name + ".json").is_reserved()):
123
+ raise CaseError("Use a case name of up to 64 letters, digits, dots, underscores or hyphens, without a file extension or path.")
124
+ chains.check(chain)
125
+ entries = {}
126
+ for i, wallet in enumerate(wallets, 1):
127
+ try:
128
+ entry = _address_entry(wallet.strip(), chain, "other", "")
129
+ except CaseError as e:
130
+ raise CaseError(f"Address {i}: {e}") from e
131
+ entries[entry["address"]] = entry
132
+ if len(entries) < 2:
133
+ raise CaseError("Enter at least two distinct wallet addresses.")
134
+ return new(str(CASES_DIR / (name + ".json")), entries=list(entries.values()))
135
+
136
+
137
+ def add(name: str, address: str, chain: str, role: str = "other", note: str = "") -> dict:
138
+ entry = _address_entry(address, chain, role, note)
139
+ case = load(name)
108
140
  for a in case["addresses"]:
109
- if a["chain"] == chain and a["address"] == key:
141
+ if a["chain"] == chain and a["address"] == entry["address"]:
110
142
  a["role"] = role # adding it again updates it
111
143
  if note:
112
144
  a["note"] = note
113
145
  save(case)
114
146
  return a
115
- entry = {"address": key, "chain": chain, "role": role, "note": note, "added": _now(), "snapshot": None}
116
147
  case["addresses"].append(entry)
117
148
  save(case)
118
149
  return entry
@@ -283,7 +283,7 @@ def _oldest(address: str, chain: str, limit: int, fresh: bool) -> List[Dict]:
283
283
 
284
284
 
285
285
  def flows(address: str, chain: str, top: int, direction: str = "out",
286
- limit: int = 1000, asset: Optional[dict] = None):
286
+ limit: int = 1000, asset: Optional[dict] = None, after: int = 0):
287
287
  """Aggregated value per counterparty: [(other, total, tx_count)].
288
288
 
289
289
  direction='out' — where this address SENT funds (follow the money forward).
@@ -293,6 +293,8 @@ def flows(address: str, chain: str, top: int, direction: str = "out",
293
293
  near, far = ("from", "to") if direction == "out" else ("to", "from")
294
294
  agg: Dict[str, list] = {}
295
295
  for r in transfers(address, chain, limit, asset=asset):
296
+ if after and (r.get("timestamp") or 0) <= after:
297
+ continue
296
298
  if r.get(near) != me:
297
299
  continue
298
300
  other = r.get(far)
@@ -214,6 +214,25 @@ def evidence(
214
214
  "report.[/dim]")
215
215
 
216
216
 
217
+ @app.command()
218
+ def tx(txid: str = typer.Argument(..., help="Transaction hash"),
219
+ chain: str = typer.Option("eth", "--chain", "-c", help="eth or tron")):
220
+ """Look up ETH and listed ERC-20 transfers on Ethereum, or USDT on Tron."""
221
+ from crypttrace import transaction
222
+ try:
223
+ result = transaction.lookup(txid, chain)
224
+ except (ValueError, chains_mod.ChainError) as e:
225
+ console.print(str(e), style="red", markup=False)
226
+ raise typer.Exit(1)
227
+ timestamp = result["timestamp"]
228
+ when = f" · {render._ts(str(timestamp))} UTC" if timestamp else ""
229
+ console.print(f"{result['status']}{when}\n{result['url']}", markup=False)
230
+ if result["status"] == "confirmed" and not result["transfers"]:
231
+ console.print("No supported transfers in this transaction.")
232
+ for row in result["transfers"]:
233
+ console.print(f"{row['amount']} {row['symbol']} {row['from']} → {row['to']}", markup=False)
234
+
235
+
217
236
  @app.command()
218
237
  def trace(
219
238
  address: str = typer.Argument(..., help="Starting address (0x…)"),
@@ -113,6 +113,14 @@ def _call(chain: str, params: Dict[str, str], cache_age: int = 3600, _tries: int
113
113
  return data
114
114
 
115
115
 
116
+ def proxy(action: str, **params):
117
+ """Read an Ethereum JSON-RPC result through Etherscan."""
118
+ data = _call("eth", {"module": "proxy", "action": action, **params}, cache_age=15)
119
+ if "error" in data or "result" not in data:
120
+ raise EtherscanError("Etherscan could not read the transaction or block.")
121
+ return data["result"]
122
+
123
+
116
124
  def get_balance(address: str, chain: str = "eth") -> float:
117
125
  data = _call(chain, {"module": "account", "action": "balance",
118
126
  "address": address, "tag": "latest"})
@@ -52,7 +52,7 @@ def hex_to_base58(h: str) -> str:
52
52
  return "1" * pad + s
53
53
 
54
54
 
55
- def _get(path: str, params: dict = None, timeout: int = 30):
55
+ def _request(path: str, params: dict = None, timeout: int = 30, **options):
56
56
  """Cached, throttled GET. Set TRONGRID_API_KEY for a higher rate limit."""
57
57
  import os
58
58
  from crypttrace.fetchers import http
@@ -62,18 +62,31 @@ def _get(path: str, params: dict = None, timeout: int = 30):
62
62
  headers["TRON-PRO-API-KEY"] = key
63
63
  try:
64
64
  data = http.request_json(f"{BASE}{path}", params or {},
65
- timeout=timeout, headers=headers or None)
65
+ timeout=timeout, headers=headers or None, **options)
66
66
  except http.RateLimited as e:
67
67
  raise TronError(str(e))
68
68
  except requests.RequestException as e:
69
69
  raise TronError(f"TronGrid request failed: {e}")
70
70
  except ValueError as e:
71
71
  raise TronError(f"bad response from TronGrid: {e}")
72
+ return data
73
+
74
+
75
+ def _get(path: str, params: dict = None, timeout: int = 30):
76
+ data = _request(path, params, timeout)
72
77
  if isinstance(data, dict) and "__status__" in data:
73
78
  return {"data": []}
74
79
  return data
75
80
 
76
81
 
82
+ def transaction_info(txid: str) -> dict:
83
+ path = "/walletsolidity/gettransactioninfobyid"
84
+ data = _request(path, body={"value": txid}, cache_key=f"{BASE}{path}/{txid}", ttl=15)
85
+ if not isinstance(data, dict) or any(key in data for key in ("Error", "code", "__status__")):
86
+ raise TronError("TronGrid could not read the transaction receipt.")
87
+ return data
88
+
89
+
77
90
  def balance(address: str) -> float:
78
91
  d = _get(f"/v1/accounts/{address}")
79
92
  data = d.get("data") or []
@@ -124,7 +124,7 @@ def build_tree(address, chain, depth, branching, asset=None, direction="out"):
124
124
  return tree
125
125
 
126
126
 
127
- def build_graph(address, chain, depth, branching, asset=None, direction="out"):
127
+ def build_graph(address, chain, depth, branching, asset=None, direction="out", after=0):
128
128
  """Return {nodes, edges, symbol} for graph visualization (web UI).
129
129
 
130
130
  direction 'out' follows where funds went; 'in' traces where they came from.
@@ -173,7 +173,7 @@ def build_graph(address, chain, depth, branching, asset=None, direction="out"):
173
173
  if not is_root and labels.type_of(addr) in ("exchange", "mixer", "sanctioned", "bridge", "dex"):
174
174
  nodes[key]["terminal"] = True
175
175
  return
176
- outs = _outflows(addr, chain, branching, asset, direction)
176
+ outs = _c.flows(addr, chain, branching, direction, asset=asset, after=after)
177
177
  labels.enrich([to for to, _, _ in outs], chain)
178
178
  for to, val, cnt in outs:
179
179
  _node(to, hop + 1)
@@ -181,7 +181,7 @@ def build_graph(address, chain, depth, branching, asset=None, direction="out"):
181
181
  src, dst = (key, _norm(to)) if direction == "out" else (_norm(to), key)
182
182
  edge = {"from": src, "to": dst, "value": round(val, 4), "tx": cnt,
183
183
  "usd": prices.usd(val, price)}
184
- if direction == "out" and labels.type_of(to) == "exchange":
184
+ if not after and direction == "out" and labels.type_of(to) == "exchange":
185
185
  from crypttrace import chains as _ch
186
186
  memos = [m["memo"] for m in _ch.exchange_deposits(addr, chain, asset=asset, only_to=to)]
187
187
  if memos:
@@ -0,0 +1,79 @@
1
+ """Look up transfers recorded in a transaction receipt."""
2
+ import re
3
+
4
+ from crypttrace import assets, chains
5
+ from crypttrace.fetchers import etherscan, tron
6
+
7
+ _TRANSFER = "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
8
+ _ETH_DECIMALS = {"usdt": 6, "usdc": 6, "wbtc": 8, "dai": 18, "busd": 18, "weth": 18}
9
+
10
+
11
+ def _amount(raw, decimals):
12
+ whole, fraction = divmod(raw, 10 ** decimals)
13
+ return f"{whole}.{fraction:0{decimals}d}".rstrip("0").rstrip(".")
14
+
15
+
16
+ def _transfer_logs(logs, chain):
17
+ registry = assets.tokens_for(chain)
18
+ tokens = {registry[key]["contract"]: (key, decimals)
19
+ for key, decimals in (_ETH_DECIMALS if chain == "eth" else {"usdt": 6}).items()}
20
+ address = (lambda value: "0x" + value) if chain == "eth" else tron.hex_to_base58
21
+ for log in logs:
22
+ contract = log["address"].lower() if chain == "eth" else tron.hex_to_base58(log["address"])
23
+ if contract not in tokens or log.get("removed"):
24
+ continue
25
+ topics = [topic.lower().removeprefix("0x") for topic in log["topics"]]
26
+ data = log["data"].lower().removeprefix("0x")
27
+ if (len(topics) != 3 or topics[0] != _TRANSFER
28
+ or not all(re.fullmatch(r"0{24}[0-9a-f]{40}", topic) for topic in topics[1:])
29
+ or not re.fullmatch(r"[0-9a-f]{64}", data)):
30
+ continue
31
+ key, decimals = tokens[contract]
32
+ yield {"from": address(topics[1][-40:]), "to": address(topics[2][-40:]),
33
+ "amount": _amount(int(data, 16), decimals), "symbol": registry[key]["symbol"], "asset": key}
34
+
35
+
36
+ def lookup(txid: str, chain: str) -> dict:
37
+ txid = txid.strip().lower().removeprefix("0x")
38
+ if not re.fullmatch(r"[0-9a-f]{64}", txid):
39
+ raise ValueError("Enter a transaction hash with 64 hexadecimal characters.")
40
+ if chain not in ("eth", "tron"):
41
+ raise ValueError("Transaction lookup supports Ethereum and Tron.")
42
+ txhash = "0x" + txid if chain == "eth" else txid
43
+ report = {"hash": txhash, "chain": chain, "url": chains.tx_url(txhash, chain),
44
+ "status": "unavailable", "timestamp": None, "transfers": []}
45
+ try:
46
+ if chain == "tron":
47
+ info = tron.transaction_info(txhash)
48
+ if not info:
49
+ return report
50
+ report["timestamp"] = info["blockTimeStamp"] // 1000
51
+ result = info.get("receipt", {}).get("result")
52
+ report["status"] = ("failed" if info.get("result") == "FAILED" or
53
+ result not in (None, "SUCCESS") else "confirmed")
54
+ if result == "SUCCESS" and report["status"] == "confirmed":
55
+ report["transfers"] = list(_transfer_logs(info.get("log", []), chain))
56
+ return report
57
+
58
+ tx = etherscan.proxy("eth_getTransactionByHash", txhash=txhash)
59
+ if tx is None:
60
+ return report
61
+ receipt = etherscan.proxy("eth_getTransactionReceipt", txhash=txhash)
62
+ if receipt is None:
63
+ report["status"] = "pending"
64
+ return report
65
+ block = etherscan.proxy("eth_getBlockByNumber", tag=receipt["blockNumber"], boolean="false")
66
+ report["timestamp"] = int(block["timestamp"], 16)
67
+ status = receipt.get("status")
68
+ report["status"] = {"0x1": "confirmed", "0x0": "failed"}.get(status, "status unavailable")
69
+ if status == "0x1":
70
+ value = int(tx["value"], 16)
71
+ if value and tx.get("to"):
72
+ report["transfers"].append({"from": tx["from"], "to": tx["to"],
73
+ "amount": _amount(value, 18), "symbol": "ETH", "asset": "native"})
74
+ report["transfers"].extend(_transfer_logs(receipt.get("logs", []), chain))
75
+ except (etherscan.EtherscanError, tron.TronError) as e:
76
+ raise chains.ChainError(str(e)) from e
77
+ except (KeyError, TypeError, ValueError, AttributeError) as e:
78
+ raise chains.ChainError("Unexpected transaction data from the network provider.") from e
79
+ return report
@@ -44,7 +44,7 @@
44
44
  header .tag{color:var(--dim);font-size:13px}
45
45
 
46
46
  .bar{position:relative;z-index:2;display:flex;gap:10px;flex-wrap:wrap;align-items:center;padding:14px 22px}
47
- input,select,button{
47
+ input,select,button,textarea{
48
48
  color:var(--text);font-size:14px;border-radius:12px;padding:10px 13px;
49
49
  background:var(--glass-2);border:1px solid var(--stroke);
50
50
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
@@ -68,6 +68,9 @@
68
68
  .main{flex:1 1 auto;display:flex;flex-direction:column;min-width:0;min-height:0}
69
69
  .tabs{flex:0 0 auto;display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
70
70
  #common-results{overflow-wrap:anywhere}
71
+ #new-case-fields{margin:12px 0}
72
+ #new-case-fields label{display:block;margin:8px 0}
73
+ #case-wallets{display:block;width:min(100%,65ch);box-sizing:border-box;resize:vertical}
71
74
  .tab{font-size:13px;font-weight:600;padding:8px 15px;border-radius:12px;cursor:pointer;
72
75
  background:var(--glass-2);border:1px solid var(--stroke);color:var(--dim);
73
76
  backdrop-filter:blur(12px);transition:.25s cubic-bezier(.22,1,.36,1)}
@@ -255,6 +258,7 @@
255
258
  <button class="tab" data-view="poison">Poisoning</button>
256
259
  <button class="tab" data-view="check">Was I drained?</button>
257
260
  <button class="tab" data-view="common">Common recipients</button>
261
+ <button class="tab" data-view="transaction">Transaction lookup</button>
258
262
  </div>
259
263
  <div class="stage">
260
264
  <div class="loader" id="loader"></div>
@@ -266,11 +270,23 @@
266
270
  <div class="view" id="v-victims"></div>
267
271
  <div class="view" id="v-poison"></div>
268
272
  <div class="view" id="v-check"></div>
273
+ <div class="view" id="v-transaction">
274
+ <form id="transaction-form">
275
+ <label>Network <select id="transaction-chain"><option value="eth">Ethereum</option><option value="tron">Tron (USDT)</option></select></label>
276
+ <label>Transaction hash <input id="transaction-hash" required spellcheck="false" maxlength="66"></label>
277
+ <button>Look up transaction</button>
278
+ </form>
279
+ <div id="transaction-results" aria-live="polite"></div>
280
+ </div>
269
281
  <div class="view" id="v-common">
270
282
  <form id="common-form">
271
- <label>Case <select id="common-case" required></select></label>
283
+ <label>Case <select id="common-case"><option value="">New case…</option></select></label>
272
284
  <label>Network <select id="common-chain"></select></label>
273
- <button>Find common recipients</button>
285
+ <div id="new-case-fields">
286
+ <label>Case name <input id="case-name" maxlength="64" required></label>
287
+ <label>Wallet addresses (one per line)<textarea id="case-wallets" rows="4" required spellcheck="false"></textarea></label>
288
+ </div>
289
+ <button id="common-submit">Create case and find recipients</button>
274
290
  </form>
275
291
  <div id="common-results" aria-live="polite"></div>
276
292
  <p class="muted">Searches up to 200 recent native and 200 token transfers per wallet. Shared exchange addresses may receive unrelated deposits.</p>
@@ -348,8 +364,8 @@ function setStatus(t,err,busy){
348
364
  }
349
365
  function loader(p){ $('#loader').style.width=p+'%'; if(p>=100) setTimeout(()=>$('#loader').style.width='0',500); }
350
366
 
351
- async function api(path){
352
- const r=await fetch(path);
367
+ async function api(path,options){
368
+ const r=await fetch(path,options);
353
369
  const raw=await r.text();
354
370
  let j;
355
371
  try{ j=JSON.parse(raw); }
@@ -497,12 +513,15 @@ async function inspect(addr){
497
513
  }catch(e){ $('#side').innerHTML=card('Error',`<div class="err">${esc(e.message)}</div>`); }
498
514
  }
499
515
 
500
- async function run(){
516
+ let traceAfter=0;
517
+ async function run(after=0){
501
518
  const a=$('#addr').value.trim();
502
519
  if(!a){ setStatus('enter an address',true); return; }
503
520
  // the page's own address becomes a link to this investigation
504
521
  const link=new URLSearchParams({address:a,chain:chain(),asset:$('#asset').value,
505
522
  direction:$('#direction').value,depth:$('#depth').value});
523
+ traceAfter=after;
524
+ if(after) link.set('after',after);
506
525
  history.replaceState(null,'',`?${link}`);
507
526
  setStatus('tracing the chain…',false,true); loader(35);
508
527
  $('#hint').classList.add('hide');
@@ -510,14 +529,14 @@ async function run(){
510
529
  $('#v-timeline').innerHTML=''; $('#v-victims').innerHTML=''; $('#v-assess').innerHTML=''; $('#v-poison').innerHTML='';
511
530
  try{
512
531
  const dir=$('#direction').value;
513
- const g=await api(`/api/trace?address=${q(a)}&chain=${chain()}&depth=${$('#depth').value}&asset=${q($('#asset').value)}&direction=${dir}`);
532
+ const g=await api(`/api/trace?${link}`);
514
533
  loader(80); renderGraph(g);
515
- setStatus(`${g.nodes.length} addresses · ${g.edges.length} transfers`);
534
+ setStatus(`${g.nodes.length} addresses · ${g.edges.length} transfers${after?' · after '+fmtTs(after)+' UTC':''}`);
516
535
  // BTC/Tron/Solana/TON addresses are case-sensitive — never lowercase them
517
536
  inspect(NON_EVM[chain()] ? a : a.toLowerCase()); loader(100);
518
537
  if(!g.edges.length){ // explain an empty graph instead of showing nothing
519
538
  const other=dir==='out'?'← where funds came from':'→ where funds went';
520
- $('#hint').innerHTML=dir==='out'
539
+ $('#hint').innerHTML=after?'No matching transfers in the available history after this transaction.':dir==='out'
521
540
  ? `This address has no <b>outgoing</b> transfers — it only ever received funds.<br>
522
541
  Switch the direction to <b>${other}</b> to trace where its money came from.`
523
542
  : `This address has no <b>incoming</b> transfers on record.<br>
@@ -546,7 +565,7 @@ async function syncAssets(){
546
565
  sel.title=sel.disabled?'No tokens on this chain':'Asset to trace';
547
566
  }catch{ /* keep whatever is there if the backend is unreachable */ }
548
567
  }
549
- $('#chain').addEventListener('change',syncAssets); syncAssets();
568
+ $('#chain').addEventListener('change',syncAssets);
550
569
 
551
570
  // ---------- views: flow graph / timeline / victims ----------
552
571
  let currentView='graph', loaded={};
@@ -564,6 +583,7 @@ function showView(v){
564
583
  $('#v-poison').classList.toggle('on',v==='poison');
565
584
  $('#v-check').classList.toggle('on',v==='check');
566
585
  $('#v-common').classList.toggle('on',v==='common');
586
+ $('#v-transaction').classList.toggle('on',v==='transaction');
567
587
  if(v==='common') loadCaseNames();
568
588
  const a=$('#addr').value.trim();
569
589
  if(a && !loaded[v+a]) {
@@ -577,24 +597,70 @@ function showView(v){
577
597
  }
578
598
  document.querySelectorAll('.tab').forEach(t=>t.onclick=()=>showView(t.dataset.view));
579
599
 
600
+ $('#transaction-form').onsubmit=async event=>{
601
+ event.preventDefault();
602
+ const form=event.currentTarget, result=$('#transaction-results');
603
+ for(const control of form.elements) control.disabled=true;
604
+ result.textContent='Reading transaction…';
605
+ try{
606
+ const network=$('#transaction-chain').value, hash=$('#transaction-hash').value;
607
+ const tx=await api(`/api/transaction?chain=${q(network)}&hash=${q(hash)}`);
608
+ const status=tx.status==='unavailable'?'Transaction unavailable or not yet confirmed':tx.status;
609
+ const rows=tx.transfers.map(row=>{
610
+ const link=new URLSearchParams({address:row.to,chain:network,asset:row.asset,
611
+ direction:'out',after:tx.timestamp});
612
+ return `<section class="card"><h3>${esc(row.amount)} ${esc(row.symbol)}</h3>
613
+ <p>From ${esc(row.from)}<br>To ${esc(row.to)}</p>
614
+ <a href="/?${esc(link)}">Trace from recipient</a></section>`;
615
+ }).join('');
616
+ result.innerHTML=`<p>${esc(status)}${tx.timestamp?' · '+fmtTs(tx.timestamp)+' UTC':''}
617
+ · <a href="${safeUrl(tx.url)}" target="_blank" rel="noopener">Open in explorer</a></p>`
618
+ +(rows || (tx.status==='confirmed'?'<p>No supported transfers in this transaction.</p>':''));
619
+ }catch(e){ result.textContent=e.message; }
620
+ finally{ for(const control of form.elements) control.disabled=false; }
621
+ };
622
+
580
623
  $('#common-chain').innerHTML=$('#chain').innerHTML;
581
624
  async function loadCaseNames(){
582
- const select=$('#common-case'), previous=select.value;
625
+ const select=$('#common-case');
583
626
  try{
584
627
  const names=await api('/api/cases');
585
- select.replaceChildren(...names.map(name=>new Option(name,name)));
586
- if(names.includes(previous)) select.value=previous;
587
- else $('#common-results').textContent=names.length?'':'Create a case with crypttrace case new and add two addresses on one network.';
628
+ const previous=select.value;
629
+ for(const name of names){
630
+ if(!Array.from(select.options).some(option=>option.value===name)) select.add(new Option(name,name));
631
+ }
632
+ if(!select.dataset.loaded && names.length && !previous && !$('#case-name').value && !$('#case-wallets').value) select.value=names[0];
633
+ select.dataset.loaded='true';
634
+ updateCaseForm();
588
635
  }catch(e){ $('#common-results').textContent=e.message; }
589
636
  }
590
637
  const commonForm=$('#common-form'), commonResults=$('#common-results');
638
+ function updateCaseForm(){
639
+ const creating=!$('#common-case').value;
640
+ $('#new-case-fields').hidden=!creating;
641
+ $('#case-name').required=$('#case-wallets').required=creating;
642
+ $('#common-submit').textContent=creating?'Create case and find recipients':'Find common recipients';
643
+ }
644
+ $('#common-case').onchange=updateCaseForm;
591
645
  commonForm.onchange=()=>{commonResults.textContent='';};
592
646
  commonForm.onsubmit=async event=>{
593
647
  event.preventDefault();
594
- const name=$('#common-case').value, network=$('#common-chain').value;
648
+ let name=$('#common-case').value;
649
+ const network=$('#common-chain').value;
595
650
  for(const control of commonForm.elements) control.disabled=true;
596
651
  commonResults.textContent='Reading recent transfers…';
597
652
  try{
653
+ if(!name){
654
+ commonResults.textContent='Saving case…';
655
+ const saved=await api('/api/cases',{method:'POST',headers:{'Content-Type':'application/json'},
656
+ body:JSON.stringify({name:$('#case-name').value,chain:network,
657
+ addresses:$('#case-wallets').value.trim().split(/\s+/).filter(Boolean)})});
658
+ name=saved.name;
659
+ $('#common-case').add(new Option(name,name,true,true));
660
+ $('#case-name').value=$('#case-wallets').value='';
661
+ updateCaseForm();
662
+ commonResults.textContent='Case saved. Reading recent transfers…';
663
+ }
598
664
  const report=await api('/api/cases/'+q(name)+'/common-recipients?chain='+q(network));
599
665
  const warnings=report.warnings.map(w=>'<p>'+esc(w)+'</p>').join('');
600
666
  const groups=report.matches.map(m=>`<section class="card">
@@ -843,7 +909,7 @@ async function downloadGraph(fmt){
843
909
  if(!a){ setStatus('enter an address',true); return; }
844
910
  b.disabled=true; setStatus(`building the ${fmt} file…`,false,true);
845
911
  try{
846
- const r=await fetch(`/api/trace?address=${q(a)}&chain=${chain()}&depth=${$('#depth').value}&asset=${q($('#asset').value)}&direction=${$('#direction').value}&format=${fmt}`);
912
+ const r=await fetch(`/api/trace?address=${q(a)}&chain=${chain()}&depth=${$('#depth').value}&asset=${q($('#asset').value)}&direction=${$('#direction').value}&format=${fmt}&after=${traceAfter}`);
847
913
  if(!r.ok){ const j=await r.json().catch(()=>({})); throw new Error(j.error||`HTTP ${r.status}`); }
848
914
  const name=((r.headers.get('Content-Disposition')||'').match(/filename="([^"]+)"/)||[])[1]||`graph.${fmt}`;
849
915
  const u=URL.createObjectURL(await r.blob()), l=document.createElement('a');
@@ -866,7 +932,7 @@ function downloadCsv(){
866
932
  l.click(); URL.revokeObjectURL(u);
867
933
  }
868
934
 
869
- $('#go').onclick=run;
935
+ $('#go').onclick=()=>run();
870
936
  $('#fit').onclick=()=>network&&fitNice();
871
937
  $('#zin').onclick=()=>zoomBy(1.35);
872
938
  $('#zout').onclick=()=>zoomBy(1/1.35);
@@ -880,17 +946,19 @@ $('#zroot').onclick=()=>{
880
946
  $('#addr').addEventListener('keydown',e=>{ if(e.key==='Enter') run(); });
881
947
 
882
948
  // A link opens an investigation: /?address=…&chain=eth&direction=in&depth=4&asset=usdt&tab=check
883
- (function(){
949
+ (async function(){
884
950
  const p=new URLSearchParams(location.search), a=p.get('address');
885
- if(!a) return;
886
951
  const set=(id,v)=>{
887
952
  const el=$(id);
888
- if(v!==null && [...el.options].some(o=>o.value===v)){ el.value=v; el.dispatchEvent(new Event('change')); }
953
+ if(v!==null && [...el.options].some(o=>o.value===v)) el.value=v;
889
954
  };
890
- set('#chain',p.get('chain')); // first: it decides which assets are offered
955
+ set('#chain',p.get('chain'));
956
+ await syncAssets();
957
+ if(!a) return;
891
958
  set('#asset',p.get('asset')); set('#direction',p.get('direction')); set('#depth',p.get('depth'));
892
959
  $('#addr').value=a;
893
- run();
960
+ const after=Number(p.get('after'));
961
+ run(Number.isSafeInteger(after)&&after>0&&after<=253402300799?after:0);
894
962
  const v=p.get('tab');
895
963
  if(v && [...document.querySelectorAll('.tab')].some(t=>t.dataset.view===v)) showView(v);
896
964
  })();
@@ -81,6 +81,22 @@ def create_app() -> Flask:
81
81
  from crypttrace import case
82
82
  return jsonify([Path(c["path"]).stem for c in case.all_cases()])
83
83
 
84
+ @app.post("/api/cases")
85
+ def api_create_case():
86
+ from crypttrace import case
87
+ data = request.get_json()
88
+ if not isinstance(data, dict):
89
+ return jsonify(error="Expected a case name, network and addresses."), 400
90
+ name, chain, wallets = (data.get(key) for key in ("name", "chain", "addresses"))
91
+ if not (isinstance(name, str) and isinstance(chain, str) and isinstance(wallets, list)
92
+ and all(isinstance(wallet, str) for wallet in wallets)):
93
+ return jsonify(error="Expected a case name, network and a list of addresses."), 400
94
+ try:
95
+ path = case.new_from_wallets(name.strip(), chain, wallets)
96
+ except _KNOWN_ERRORS as e:
97
+ return jsonify(error=str(e)), 400
98
+ return jsonify(name=path.stem), 201
99
+
84
100
  @app.route("/api/cases/<name>/common-recipients")
85
101
  def api_common_recipients(name):
86
102
  from crypttrace import case
@@ -144,6 +160,14 @@ def create_app() -> Flask:
144
160
  "deposits": chains.exchange_deposits(addr, chain)[:5],
145
161
  })
146
162
 
163
+ @app.route("/api/transaction")
164
+ def api_transaction():
165
+ from crypttrace import transaction
166
+ try:
167
+ return jsonify(transaction.lookup(request.args.get("hash", ""), request.args.get("chain", "eth")))
168
+ except _KNOWN_ERRORS as e:
169
+ return jsonify(error=str(e)), 400
170
+
147
171
  @app.route("/api/trace")
148
172
  def api_trace():
149
173
  addr = request.args.get("address", "")
@@ -159,7 +183,13 @@ def create_app() -> Flask:
159
183
  return jsonify({"error": bad}), 400
160
184
  try:
161
185
  asset = assets.resolve_asset(asset_arg, chain)
162
- graph = trace_mod.build_graph(addr, chain, depth, branching, asset, direction)
186
+ after = int(request.args.get("after", 0))
187
+ if not 0 <= after <= 253402300799:
188
+ raise ValueError("Invalid trace start time.")
189
+ if after:
190
+ graph = trace_mod.build_graph(addr, chain, depth, branching, asset, direction, after=after)
191
+ else:
192
+ graph = trace_mod.build_graph(addr, chain, depth, branching, asset, direction)
163
193
  except _KNOWN_ERRORS as e:
164
194
  return jsonify({"error": str(e)}), 400
165
195
  fmt = request.args.get("format", "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypttrace
3
- Version: 0.36.0
3
+ Version: 0.38.0
4
4
  Summary: OSINT toolkit for crypto investigations: trace stolen funds across Ethereum, Bitcoin, Tron, Solana and TON
5
5
  Author: bobslayerX
6
6
  License-Expression: MIT
@@ -121,6 +121,15 @@ address (about a minute); with your own endpoint (a free Helius or QuickNode
121
121
  key) it reads up to **1,000**, in parallel. `CRYPTTRACE_SOLANA_MAX_TXS` sets
122
122
  the number either way.
123
123
 
124
+ ## Look up a transfer by transaction hash
125
+
126
+ Run `crypttrace tx HASH --chain eth` or `crypttrace tx HASH --chain tron`.
127
+ Ethereum lookup uses an Etherscan key and shows the transaction's native ETH
128
+ value and transfer events for the ERC-20 contracts in the asset registry.
129
+ Tron lookup shows USDT from solidified receipts. The **Transaction lookup** tab
130
+ also opens a flow graph from a recipient for the same asset. The graph includes
131
+ available transfers strictly after the transaction's UTC timestamp.
132
+
124
133
  ## Supported chains
125
134
 
126
135
  | Chain | `--chain` | Data source | Model |
@@ -388,8 +397,10 @@ It reads up to 200 recent native and 200 recent token transfer rows per wallet,
388
397
  provider limits. Each match shows the distinct senders, individual amounts and assets, UTC
389
398
  times, explorer links and any known recipient label. A shared exchange wallet can receive
390
399
  unrelated deposits. On UTXO networks, input shares are estimates and outputs can be change.
391
- In the web app, open **Common recipients**, choose a saved case and network, and click
392
- **Find common recipients**.
400
+ In the web app, open **Common recipients** and select **New case…**. Choose a network,
401
+ name the case and paste at least two wallet addresses, one per line. **Create case and
402
+ find recipients** saves the case to the local case library and searches it immediately.
403
+ You can reopen the case in the same tab or with `crypttrace case show NAME`.
393
404
 
394
405
  ### Watch & alerts — catching the cash-out
395
406
 
@@ -27,6 +27,7 @@ src/crypttrace/report.py
27
27
  src/crypttrace/spam.py
28
28
  src/crypttrace/store.py
29
29
  src/crypttrace/trace.py
30
+ src/crypttrace/transaction.py
30
31
  src/crypttrace/verify.py
31
32
  src/crypttrace/watch.py
32
33
  src/crypttrace/webapp.py
File without changes
File without changes
File without changes