crypttrace 0.37.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.37.0/src/crypttrace.egg-info → crypttrace-0.38.0}/PKG-INFO +10 -1
  2. {crypttrace-0.37.0 → crypttrace-0.38.0}/README.md +9 -0
  3. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/__init__.py +1 -1
  4. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/chains.py +3 -1
  5. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/cli.py +19 -0
  6. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/etherscan.py +8 -0
  7. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/tron.py +15 -2
  8. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/trace.py +3 -3
  9. crypttrace-0.38.0/src/crypttrace/transaction.py +79 -0
  10. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/web/index.html +50 -12
  11. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/webapp.py +15 -1
  12. {crypttrace-0.37.0 → crypttrace-0.38.0/src/crypttrace.egg-info}/PKG-INFO +10 -1
  13. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/SOURCES.txt +1 -0
  14. {crypttrace-0.37.0 → crypttrace-0.38.0}/LICENSE +0 -0
  15. {crypttrace-0.37.0 → crypttrace-0.38.0}/pyproject.toml +0 -0
  16. {crypttrace-0.37.0 → crypttrace-0.38.0}/setup.cfg +0 -0
  17. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/addresses.py +0 -0
  18. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/analysis.py +0 -0
  19. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/assess.py +0 -0
  20. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/assets.py +0 -0
  21. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/bridges.py +0 -0
  22. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/case.py +0 -0
  23. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/config.py +0 -0
  24. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/drain.py +0 -0
  25. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/evidence.py +0 -0
  26. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/export.py +0 -0
  27. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/__init__.py +0 -0
  28. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/bitcoin.py +0 -0
  29. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/http.py +0 -0
  30. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/solana.py +0 -0
  31. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/fetchers/ton.py +0 -0
  32. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/freeze.py +0 -0
  33. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/funder.py +0 -0
  34. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/gascluster.py +0 -0
  35. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/investigate.py +0 -0
  36. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/__init__.py +0 -0
  37. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/audit.py +0 -0
  38. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/bulk.py +0 -0
  39. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/known.json +0 -0
  40. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/labels.py +0 -0
  41. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/names.py +0 -0
  42. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/partial.json +0 -0
  43. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/tonapi.py +0 -0
  44. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/labels/tronscan.py +0 -0
  45. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/offramp.py +0 -0
  46. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/pdf.py +0 -0
  47. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/poisoning.py +0 -0
  48. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/prices.py +0 -0
  49. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/render.py +0 -0
  50. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/report.py +0 -0
  51. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/spam.py +0 -0
  52. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/store.py +0 -0
  53. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/verify.py +0 -0
  54. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace/watch.py +0 -0
  55. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/dependency_links.txt +0 -0
  56. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/entry_points.txt +0 -0
  57. {crypttrace-0.37.0 → crypttrace-0.38.0}/src/crypttrace.egg-info/requires.txt +0 -0
  58. {crypttrace-0.37.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.37.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 |
@@ -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 |
@@ -1,2 +1,2 @@
1
1
  """crypttrace — OSINT crypto investigation CLI."""
2
- __version__ = "0.37.0"
2
+ __version__ = "0.38.0"
@@ -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
@@ -258,6 +258,7 @@
258
258
  <button class="tab" data-view="poison">Poisoning</button>
259
259
  <button class="tab" data-view="check">Was I drained?</button>
260
260
  <button class="tab" data-view="common">Common recipients</button>
261
+ <button class="tab" data-view="transaction">Transaction lookup</button>
261
262
  </div>
262
263
  <div class="stage">
263
264
  <div class="loader" id="loader"></div>
@@ -269,6 +270,14 @@
269
270
  <div class="view" id="v-victims"></div>
270
271
  <div class="view" id="v-poison"></div>
271
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>
272
281
  <div class="view" id="v-common">
273
282
  <form id="common-form">
274
283
  <label>Case <select id="common-case"><option value="">New case…</option></select></label>
@@ -504,12 +513,15 @@ async function inspect(addr){
504
513
  }catch(e){ $('#side').innerHTML=card('Error',`<div class="err">${esc(e.message)}</div>`); }
505
514
  }
506
515
 
507
- async function run(){
516
+ let traceAfter=0;
517
+ async function run(after=0){
508
518
  const a=$('#addr').value.trim();
509
519
  if(!a){ setStatus('enter an address',true); return; }
510
520
  // the page's own address becomes a link to this investigation
511
521
  const link=new URLSearchParams({address:a,chain:chain(),asset:$('#asset').value,
512
522
  direction:$('#direction').value,depth:$('#depth').value});
523
+ traceAfter=after;
524
+ if(after) link.set('after',after);
513
525
  history.replaceState(null,'',`?${link}`);
514
526
  setStatus('tracing the chain…',false,true); loader(35);
515
527
  $('#hint').classList.add('hide');
@@ -517,14 +529,14 @@ async function run(){
517
529
  $('#v-timeline').innerHTML=''; $('#v-victims').innerHTML=''; $('#v-assess').innerHTML=''; $('#v-poison').innerHTML='';
518
530
  try{
519
531
  const dir=$('#direction').value;
520
- 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}`);
521
533
  loader(80); renderGraph(g);
522
- setStatus(`${g.nodes.length} addresses · ${g.edges.length} transfers`);
534
+ setStatus(`${g.nodes.length} addresses · ${g.edges.length} transfers${after?' · after '+fmtTs(after)+' UTC':''}`);
523
535
  // BTC/Tron/Solana/TON addresses are case-sensitive — never lowercase them
524
536
  inspect(NON_EVM[chain()] ? a : a.toLowerCase()); loader(100);
525
537
  if(!g.edges.length){ // explain an empty graph instead of showing nothing
526
538
  const other=dir==='out'?'← where funds came from':'→ where funds went';
527
- $('#hint').innerHTML=dir==='out'
539
+ $('#hint').innerHTML=after?'No matching transfers in the available history after this transaction.':dir==='out'
528
540
  ? `This address has no <b>outgoing</b> transfers — it only ever received funds.<br>
529
541
  Switch the direction to <b>${other}</b> to trace where its money came from.`
530
542
  : `This address has no <b>incoming</b> transfers on record.<br>
@@ -553,7 +565,7 @@ async function syncAssets(){
553
565
  sel.title=sel.disabled?'No tokens on this chain':'Asset to trace';
554
566
  }catch{ /* keep whatever is there if the backend is unreachable */ }
555
567
  }
556
- $('#chain').addEventListener('change',syncAssets); syncAssets();
568
+ $('#chain').addEventListener('change',syncAssets);
557
569
 
558
570
  // ---------- views: flow graph / timeline / victims ----------
559
571
  let currentView='graph', loaded={};
@@ -571,6 +583,7 @@ function showView(v){
571
583
  $('#v-poison').classList.toggle('on',v==='poison');
572
584
  $('#v-check').classList.toggle('on',v==='check');
573
585
  $('#v-common').classList.toggle('on',v==='common');
586
+ $('#v-transaction').classList.toggle('on',v==='transaction');
574
587
  if(v==='common') loadCaseNames();
575
588
  const a=$('#addr').value.trim();
576
589
  if(a && !loaded[v+a]) {
@@ -584,6 +597,29 @@ function showView(v){
584
597
  }
585
598
  document.querySelectorAll('.tab').forEach(t=>t.onclick=()=>showView(t.dataset.view));
586
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
+
587
623
  $('#common-chain').innerHTML=$('#chain').innerHTML;
588
624
  async function loadCaseNames(){
589
625
  const select=$('#common-case');
@@ -873,7 +909,7 @@ async function downloadGraph(fmt){
873
909
  if(!a){ setStatus('enter an address',true); return; }
874
910
  b.disabled=true; setStatus(`building the ${fmt} file…`,false,true);
875
911
  try{
876
- 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}`);
877
913
  if(!r.ok){ const j=await r.json().catch(()=>({})); throw new Error(j.error||`HTTP ${r.status}`); }
878
914
  const name=((r.headers.get('Content-Disposition')||'').match(/filename="([^"]+)"/)||[])[1]||`graph.${fmt}`;
879
915
  const u=URL.createObjectURL(await r.blob()), l=document.createElement('a');
@@ -896,7 +932,7 @@ function downloadCsv(){
896
932
  l.click(); URL.revokeObjectURL(u);
897
933
  }
898
934
 
899
- $('#go').onclick=run;
935
+ $('#go').onclick=()=>run();
900
936
  $('#fit').onclick=()=>network&&fitNice();
901
937
  $('#zin').onclick=()=>zoomBy(1.35);
902
938
  $('#zout').onclick=()=>zoomBy(1/1.35);
@@ -910,17 +946,19 @@ $('#zroot').onclick=()=>{
910
946
  $('#addr').addEventListener('keydown',e=>{ if(e.key==='Enter') run(); });
911
947
 
912
948
  // A link opens an investigation: /?address=…&chain=eth&direction=in&depth=4&asset=usdt&tab=check
913
- (function(){
949
+ (async function(){
914
950
  const p=new URLSearchParams(location.search), a=p.get('address');
915
- if(!a) return;
916
951
  const set=(id,v)=>{
917
952
  const el=$(id);
918
- 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;
919
954
  };
920
- 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;
921
958
  set('#asset',p.get('asset')); set('#direction',p.get('direction')); set('#depth',p.get('depth'));
922
959
  $('#addr').value=a;
923
- run();
960
+ const after=Number(p.get('after'));
961
+ run(Number.isSafeInteger(after)&&after>0&&after<=253402300799?after:0);
924
962
  const v=p.get('tab');
925
963
  if(v && [...document.querySelectorAll('.tab')].some(t=>t.dataset.view===v)) showView(v);
926
964
  })();
@@ -160,6 +160,14 @@ def create_app() -> Flask:
160
160
  "deposits": chains.exchange_deposits(addr, chain)[:5],
161
161
  })
162
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
+
163
171
  @app.route("/api/trace")
164
172
  def api_trace():
165
173
  addr = request.args.get("address", "")
@@ -175,7 +183,13 @@ def create_app() -> Flask:
175
183
  return jsonify({"error": bad}), 400
176
184
  try:
177
185
  asset = assets.resolve_asset(asset_arg, chain)
178
- 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)
179
193
  except _KNOWN_ERRORS as e:
180
194
  return jsonify({"error": str(e)}), 400
181
195
  fmt = request.args.get("format", "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypttrace
3
- Version: 0.37.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 |
@@ -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