chain-insights 0.76.0 → 0.77.1
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.
- package/dist/mcp-proxy.cjs +166 -2
- package/dist/mcp-proxy.d.cts.map +1 -1
- package/dist/mcp-proxy.d.mts.map +1 -1
- package/dist/mcp-proxy.mjs +166 -2
- package/dist/mcp-proxy.mjs.map +1 -1
- package/docs/graph-query-compatibility.md +19 -0
- package/docs/graph-tools.md +51 -0
- package/package.json +1 -1
- package/skills/chain-insights-cypher/SKILL.md +64 -3
- package/skills/chain-insights-virtuals/SKILL.md +2 -0
|
@@ -56,6 +56,9 @@ read as it is.
|
|
|
56
56
|
-- A probe: one node, no WHERE, a LIMIT of 100 or less
|
|
57
57
|
USE topology MATCH (a:Address) RETURN a.address AS address, a.network AS network LIMIT 20
|
|
58
58
|
|
|
59
|
+
-- A mark is an anchor: a WHERE on the node's own properties is allowed
|
|
60
|
+
USE topology MATCH (a:Mixer) WHERE "Mixer" IN a.labels RETURN a.address AS address, a.labels AS labels LIMIT 5
|
|
61
|
+
|
|
59
62
|
-- Anchored: an address in the pattern
|
|
60
63
|
USE topology MATCH (a:Address {address: "0x…"})-[f:FLOWED_TO]->(b:Address)
|
|
61
64
|
WHERE NOT a:Pool
|
|
@@ -403,6 +406,22 @@ while it has a live label of that role. A flag is never `false`, so test it
|
|
|
403
406
|
with `IS NOT NULL` or `IS NULL`, not `= false`. A withdrawn label removes its
|
|
404
407
|
node label and its flag. Only `is_exchange` ends a walk.
|
|
405
408
|
|
|
409
|
+
The labels layer adds three judgement marks with no flag: `:Poisoned` (a
|
|
410
|
+
look-alike address that sent worthless dust), `:Targeted` (a poisoning target
|
|
411
|
+
not yet proven to have lost money) and `:OnMoneyTrail` (on the trail the
|
|
412
|
+
evidence walk followed from an accused address). Beside the marks, sorted
|
|
413
|
+
lists say why: `risk_claims` on `:Scam`, `:Poisoned` and `:Sanctioned`,
|
|
414
|
+
`protection_claims` on `:Victim` and `:Targeted`, `traced_claims` on
|
|
415
|
+
`:OnMoneyTrail`, and `suspect_labels` for an address that used a mixer pool.
|
|
416
|
+
The values and their meaning are in
|
|
417
|
+
[Graph tools](graph-tools.md#judgement-marks-and-their-claims).
|
|
418
|
+
|
|
419
|
+
| Form | Result |
|
|
420
|
+
| ------------------------------------------------------------- | ---------------------------------------- |
|
|
421
|
+
| `MATCH (a:Scam) WHERE "FAKE_TOKEN" IN a.risk_claims RETURN a.address, a.risk_claims LIMIT 25` | ✅ the mark is the anchor |
|
|
422
|
+
| `MATCH (a:Address {address: "0x1111111111111111111111111111111111111111"}) RETURN a.protection_claims LIMIT 1` | ✅ anchored on one address |
|
|
423
|
+
| `MATCH (a:Address) WHERE "FAKE_TOKEN" IN a.risk_claims` | refused: no mark and no address |
|
|
424
|
+
|
|
406
425
|
Caveats: facts carries only its mapped labels, so role-label patterns are
|
|
407
426
|
topology-only. The property-flag form (`is_exchange`) remains the canonical
|
|
408
427
|
filter.
|
package/docs/graph-tools.md
CHANGED
|
@@ -402,6 +402,57 @@ flag on the node.
|
|
|
402
402
|
which (`USDG` or `PAXG` on robinhood). An unfreeze removes it. It is never
|
|
403
403
|
`:Scam` for the freeze alone.
|
|
404
404
|
|
|
405
|
+
### Judgement marks and their claims
|
|
406
|
+
|
|
407
|
+
Three more marks come from the labels layer: `:Poisoned`, `:Targeted` and
|
|
408
|
+
`:OnMoneyTrail`. They have no flag. Why a judgement mark is there sits in a
|
|
409
|
+
sorted list on the node, beside the mark.
|
|
410
|
+
|
|
411
|
+
| Mark | List | Holds |
|
|
412
|
+
| --------------- | ------------------- | ------------------------------------------------- |
|
|
413
|
+
| `:Scam` | `risk_claims` | the live risk values below |
|
|
414
|
+
| `:Poisoned` | `risk_claims` | `ADDRESS_POISONING` |
|
|
415
|
+
| `:Sanctioned` | `risk_claims` | `SANCTIONED` |
|
|
416
|
+
| `:Victim` | `protection_claims` | `VICTIM` |
|
|
417
|
+
| `:Targeted` | `protection_claims` | `ADDRESS_POISONING_TARGET`, an older value |
|
|
418
|
+
| `:OnMoneyTrail` | `traced_claims` | the trail values below |
|
|
419
|
+
| none | `suspect_labels` | `MIXER_DEPOSITOR`, `MIXER_WITHDRAWER` |
|
|
420
|
+
|
|
421
|
+
What each value means:
|
|
422
|
+
|
|
423
|
+
| Value | Meaning |
|
|
424
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
425
|
+
| `FAKE_TOKEN` | A fake token: a spoof contract that imitates a real token. |
|
|
426
|
+
| `FAKE_TOKEN_DEPLOYER` | The creator of a fake token. |
|
|
427
|
+
| `ADDRESS_POISONING` | A poisoner: a look-alike address that sent worthless dust so the target copies it from its history. `:Poisoned`, never `:Scam`. |
|
|
428
|
+
| `INBOUND_IMPERSONATION` | A look-alike address that paid the target to get into its history. |
|
|
429
|
+
| `PHANTOM_TRANSFER` | A contract that writes fake transfer events, claiming a transfer from a look-alike that never happened. |
|
|
430
|
+
| `PHANTOM_TRANSFER_EMITTER` | A contract that writes fake transfer events, claiming a transfer from a look-alike that never happened. |
|
|
431
|
+
| `PHANTOM_ENTRYPOINT` | A contract that writes fake transfer events, claiming a transfer from a look-alike that never happened. |
|
|
432
|
+
| `SWEEPER_DELEGATE` | An EIP-7702 delegate that empties the accounts that delegate to it. |
|
|
433
|
+
| `SWEEP_BENEFICIARY` | Where a sweeper sends the funds. |
|
|
434
|
+
| `UNSAFE_DELEGATE` | A delegate any caller can use to empty the account. |
|
|
435
|
+
| `APPROVAL_DRAINER` | A spender that moved the tokens of at least three owners with their approval or Permit2 within 72 hours of the grant, and paid nothing back. |
|
|
436
|
+
| `APPROVAL_DRAIN_BENEFICIARY` | The receiver of those tokens. |
|
|
437
|
+
| `SANCTIONED` | On a sanctions list. |
|
|
438
|
+
| `VICTIM` | Lost money to a scam the evidence walk traced: it paid the accused, was swept, or was drained after the attempt. Receiving a fake token or dust never makes a victim. |
|
|
439
|
+
| `ADDRESS_POISONING_TARGET` | A poisoning target the walk has not proven lost money. Not a victim. |
|
|
440
|
+
| `LAUNDERED` | On the trail from an accused address: it received the accused's money along the walk and moved it on. |
|
|
441
|
+
| `RECEIVED` | On the trail: it received that money and still holds it. It becomes `LAUNDERED` when it forwards it. |
|
|
442
|
+
| `FUNDER` | It funded the accused address. |
|
|
443
|
+
| `MIXED` | On the trail: it received that money and paid it into a mixer pool, where the walk ends. |
|
|
444
|
+
| `MIXER_DEPOSITOR` | It put money into a mixer pool. A warning, not a theft. |
|
|
445
|
+
| `MIXER_WITHDRAWER` | It took money out of a mixer pool. A warning, not a theft. |
|
|
446
|
+
|
|
447
|
+
- Ask by mark, `MATCH (a:Scam) WHERE "FAKE_TOKEN" IN a.risk_claims` for fake
|
|
448
|
+
tokens, or anchor on one full address. The mark is the anchor, and a
|
|
449
|
+
`WHERE` on its own properties is allowed. A `WHERE` with no mark and no
|
|
450
|
+
address is refused.
|
|
451
|
+
- The graph holds no link from an accused address to its victims. Answer per
|
|
452
|
+
address.
|
|
453
|
+
- An answer says what a value means in plain words: "a fake-token scam", never
|
|
454
|
+
the list name or the code.
|
|
455
|
+
|
|
405
456
|
- Each flag is absent unless true. An address carries the flag only while it
|
|
406
457
|
has a live label of that role. A flag is never `false`.
|
|
407
458
|
- Test a flag with `IS NOT NULL` or `IS NULL`. Do not test `= false`.
|
package/package.json
CHANGED
|
@@ -46,8 +46,12 @@ The one case without the tool is at the end, Shell without the tool.
|
|
|
46
46
|
3. A shortened address, a mixed-case address, or an ISO string against a
|
|
47
47
|
millisecond column gives zero rows with no error. Check these first. Zero
|
|
48
48
|
rows is not proof of safety.
|
|
49
|
-
4.
|
|
50
|
-
|
|
49
|
+
4. A risk question is answered from the graph: is this a scam, a fake
|
|
50
|
+
token, a poisoner, a drainer, a sweeper, a victim, on a laundering trail.
|
|
51
|
+
Read the judgement marks and the claims list beside each, see
|
|
52
|
+
[Judgement marks](#judgement-marks-scams-victims-and-trails). Do not
|
|
53
|
+
volunteer a risk screen when the user asked about flows, a balance or a
|
|
54
|
+
transaction. No overall risk score is served.
|
|
51
55
|
5. Never write files, reports or notes unless the user asks. Answer in the chat.
|
|
52
56
|
6. After a refusal, fix the query once from `fix` and `example`. A second
|
|
53
57
|
refusal ends it: tell the user plainly what cannot be asked and what can.
|
|
@@ -215,6 +219,7 @@ Marks say what an address is. They sit beside the kind and are never an anchor:
|
|
|
215
219
|
MATCH (a:Address {address: "0xc33acc93942105c57602e59e8e448c20ba718a85"})-[w:SWAPPED]->(a)
|
|
216
220
|
RETURN w.swap_count AS swap_count, w.sold_usd AS sold_usd, w.bought_usd AS bought_usd, w.pools AS pools LIMIT 1
|
|
217
221
|
```
|
|
222
|
+
- `:Scam` (`is_scam`), `:Poisoned`, `:Victim` (`is_victim`), `:Targeted` and `:OnMoneyTrail` are judgement marks from the labels layer. Why the mark is there sits in a sorted list on the node: `risk_claims` beside `:Scam`, `:Poisoned` and `:Sanctioned`, `protection_claims` beside `:Victim` and `:Targeted`, `traced_claims` beside `:OnMoneyTrail`. `suspect_labels` says the address itself used a mixer pool, and has no mark of its own. See [Judgement marks](#judgement-marks-scams-victims-and-trails).
|
|
218
223
|
- A basket is a Robinhood stock-basket token: one token that holds several stock tokens in near-equal USD weights. One factory, `0xe78b036bd6da158cd61a3dac3f67e18f62ecddfd`, creates every basket, and one router, `0xb672a5d825f82dea8574711d1da696fcc48d2ae0`, mints and redeems them. A basket is `:Protocol` and `:Token`, and its `labels` carry the word `Basket`. The factory is `:Protocol` and its `labels` carry `BasketFactory`. The router has no mark of its own beyond `:Contract`. See [Baskets](#baskets-is-this-a-basket-and-what-does-it-trade).
|
|
219
224
|
|
|
220
225
|
**Ask by mark.** A question that names a kind of thing (mixers, launchpad pools, NFT collections, tokens of one standard, arbitrage bots) is a label match on the mark, a probe the server answers from the label index: nine `:Mixer` rows come back in 13 ms, a count of 2.4 million `:Token` in 4 s.
|
|
@@ -223,6 +228,12 @@ Marks say what an address is. They sit beside the kind and are never an anchor:
|
|
|
223
228
|
USE topology MATCH (a:Mixer) RETURN a.address AS address, labels(a) AS node_labels, a.labels AS labels LIMIT 25
|
|
224
229
|
```
|
|
225
230
|
|
|
231
|
+
A `WHERE` on the marked node's own properties keeps the mark as the anchor. On production this read was admitted and gave 5 rows in 57 ms:
|
|
232
|
+
|
|
233
|
+
```cypher
|
|
234
|
+
USE topology MATCH (a:Mixer) WHERE "Mixer" IN a.labels RETURN a.address AS address, a.labels AS labels LIMIT 5
|
|
235
|
+
```
|
|
236
|
+
|
|
226
237
|
Never write `MATCH (a:Address) WHERE a.labels CONTAINS "mixer"` with no address: `labels` is a list on every address, the scan touches all of them and the query times out. Read `a.labels` only beside an anchor, or beside a mark. The marks a lane serves, and a golden set of 44 addresses with the marks each must carry, are pinned in `tests/fixtures/graph-marks-golden.json`.
|
|
227
238
|
|
|
228
239
|
A token name from an explorer gives `:Token`, not `:Protocol`. `:Token` is a mark, not a stop: the walk guard below does not name it. One contract can carry both marks: a Uniswap v2 pair is itself an ERC20 token of its liquidity providers, so it is `:Pool` and, when the asset scan lists it, `:Token` too. Ask which tokens or pools an address touched with the mark: `WHERE t:Token` or `WHERE p:Pool`.
|
|
@@ -266,13 +277,63 @@ How to answer:
|
|
|
266
277
|
- "Who created these tokens?" The factory. List its children with a `DEPLOYED_CONTRACT` read anchored on the factory, with a literal `LIMIT`. Never scan `a.labels` for `Basket` with no anchor; ask the factory's children, or the `:Protocol` mark beside an anchor.
|
|
267
278
|
- "Which baskets went through the router on a day?" A facts read needs both addresses, so never send one with the router alone: the server refuses it. List the factory's children first (above), then send one `graph_query_batch` of the facts day, one query per basket and direction (router to basket, basket to router), each with its own `id`.
|
|
268
279
|
|
|
280
|
+
### Judgement marks: scams, victims and trails
|
|
281
|
+
|
|
282
|
+
A mark says what the labels layer judged. The claims list beside it says why. The codes are for the query. The answer says what each one means, in plain words: "a fake-token scam", "it lost money to a scam". Never print the list name or the code to the user.
|
|
283
|
+
|
|
284
|
+
| Mark | List | Value: what it means |
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| `:Scam` | `risk_claims` | `FAKE_TOKEN`: a fake token, a spoof contract that imitates a real token. `FAKE_TOKEN_DEPLOYER`: its creator. `INBOUND_IMPERSONATION`: a look-alike address that paid the target to get into its history. `PHANTOM_TRANSFER`, `PHANTOM_TRANSFER_EMITTER`, `PHANTOM_ENTRYPOINT`: a contract that writes fake transfer events, claiming a transfer from a look-alike that never happened. `SWEEPER_DELEGATE`: an EIP-7702 delegate that empties the accounts that delegate to it. `SWEEP_BENEFICIARY`: where it sends the funds. `UNSAFE_DELEGATE`: a delegate any caller can use to empty the account. `APPROVAL_DRAINER`: a spender that moved the tokens of at least three owners with their approval or Permit2 within 72 hours of the grant, and paid nothing back. `APPROVAL_DRAIN_BENEFICIARY`: the receiver of those tokens. |
|
|
287
|
+
| `:Poisoned` | `risk_claims` | `ADDRESS_POISONING`: a poisoner, a look-alike address that sent worthless dust so the target copies it from its history. Never `:Scam`. |
|
|
288
|
+
| `:Sanctioned` | `risk_claims` | `SANCTIONED`: on a sanctions list. |
|
|
289
|
+
| `:Victim` | `protection_claims` | `VICTIM`: it lost money to a scam the evidence walk traced. It paid the accused, was swept, or was drained after the attempt. Receiving a fake token or dust never makes a victim. |
|
|
290
|
+
| `:Targeted` | `protection_claims` | `ADDRESS_POISONING_TARGET`, an older value a lane may still hold: a poisoning target the walk has not proven lost money. Never call it a victim. |
|
|
291
|
+
| `:OnMoneyTrail` | `traced_claims` | The trail the evidence walk followed from an accused address. `LAUNDERED`: it received the accused's money along the walk and moved it on. `RECEIVED`: it received that money and still holds it (it becomes `LAUNDERED` when it forwards it). `FUNDER`: it funded the accused address. `MIXED`: it received that money and paid it into a mixer pool, where the walk ends. |
|
|
292
|
+
| none | `suspect_labels` | `MIXER_DEPOSITOR`, `MIXER_WITHDRAWER`: it put money into, or took money out of, a mixer pool. A warning, not a theft. |
|
|
293
|
+
|
|
294
|
+
Ask by mark, or anchor on the full address. Never scan a claims list with no mark and no address: it reads every address and times out. A lane that has not written the lists yet returns null for them: name the mark, and say the graph gives no reason yet.
|
|
295
|
+
|
|
296
|
+
List fake-token scams: the `:Scam` mark is the anchor, and a `WHERE` on its own list picks the value. Approval drainers, sweepers and fake transfer events are the same read with `"APPROVAL_DRAINER"`, `"SWEEPER_DELEGATE"` or `"PHANTOM_TRANSFER"` in place of `"FAKE_TOKEN"`. For poisoners ask `:Poisoned` with `"ADDRESS_POISONING"`, for victims `:Victim` with `"VICTIM"`. When 25 rows come back, say there may be more.
|
|
297
|
+
|
|
298
|
+
```cypher
|
|
299
|
+
USE topology
|
|
300
|
+
MATCH (a:Scam) WHERE "FAKE_TOKEN" IN a.risk_claims
|
|
301
|
+
RETURN a.address AS address, a.risk_claims AS risk_claims, a.labels AS labels LIMIT 25
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Is this address a victim, and of what? Read its marks and lists first, anchored on the address:
|
|
305
|
+
|
|
306
|
+
```cypher
|
|
307
|
+
USE topology
|
|
308
|
+
MATCH (a:Address {address: "0x1111111111111111111111111111111111111111"})
|
|
309
|
+
RETURN a.address AS address, labels(a) AS node_labels, a.risk_claims AS risk_claims, a.protection_claims AS protection_claims, a.traced_claims AS traced_claims, a.suspect_labels AS suspect_labels LIMIT 1
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The graph holds no link from an accused address to its victims, so answer per address. For "of what", read where the victim paid a `:Scam` address, and name each by its claims:
|
|
313
|
+
|
|
314
|
+
```cypher
|
|
315
|
+
USE topology
|
|
316
|
+
MATCH (v:Address {address: "0x1111111111111111111111111111111111111111"})-[f:FLOWED_TO]->(s:Scam) WHERE NOT v:Pool
|
|
317
|
+
RETURN v.address AS from_address, s.address AS to_address, f.amount_usd_sum AS amount_usd_sum, f.tx_count AS tx_count, f.first_seen_timestamp AS first_seen_timestamp, f.last_seen_timestamp AS last_seen_timestamp, v.labels AS from_labels, s.labels AS to_labels, v.is_exchange AS from_is_exchange, s.is_exchange AS to_is_exchange, s.risk_claims AS to_risk_claims ORDER BY f.last_seen_timestamp DESC LIMIT 25
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Who did this drainer empty? Anchor on the drainer. Its victims are the `:Victim` owners who approved it, with `VICTIM` in their `protection_claims`. Each row is one address the walk proved lost money, and its approval of the drainer: say both, never that the graph links the two as thief and victim. `APPROVED` holds no Permit2 grants, so a Permit2 drainer's victims are not on it: find them, and a sweeper's or a beneficiary's, as the `:Victim` senders on `FLOWED_TO` into the address, anchored on it the same way.
|
|
321
|
+
|
|
322
|
+
```cypher
|
|
323
|
+
USE topology
|
|
324
|
+
MATCH (v:Victim)-[p:APPROVED]->(d:Address {address: "0x1111111111111111111111111111111111111111"})
|
|
325
|
+
WHERE "VICTIM" IN v.protection_claims
|
|
326
|
+
RETURN v.address AS victim_address, p.granted_tokens AS granted_tokens, p.last_height AS last_height LIMIT 25
|
|
327
|
+
```
|
|
328
|
+
|
|
269
329
|
## Topology
|
|
270
330
|
|
|
271
331
|
`USE topology` is the address graph: `FLOWED_TO` money flow, swaps, liquidity,
|
|
272
332
|
bridges and the `LINKED` overlay. The server checks these before it runs:
|
|
273
333
|
|
|
274
334
|
- Anchor every pattern on a full address: `{address: "<address>"}` in the node, or `WHERE a.address = "<address>"`. A list of at most 25 addresses is an anchor. An address in `RETURN`, in an `OR` or in a `$parameter` is no anchor.
|
|
275
|
-
-
|
|
335
|
+
- A label match on a mark, such as `MATCH (a:Scam)` or `MATCH (a:Mixer)`, is an anchor: the server reads it from the label index. A `WHERE` on that node's own properties is allowed. What is refused is a `WHERE` with no label and no address, such as `MATCH (a:Address) WHERE "exchange" IN a.labels`.
|
|
336
|
+
- The one read with no anchor is a probe on `:Address`: one node or one hop, no `WHERE`, no `ORDER BY`, no aggregate, and a small `LIMIT`. Its rows are arbitrary: never call them recent, top or biggest.
|
|
276
337
|
- A sort, an aggregate, `DISTINCT`, `collect()` or a filter on a link property needs an anchor on every pattern.
|
|
277
338
|
- End every read with a literal `LIMIT`: at most 5,000 rows, 100 for a probe. A path has at most 5 hops and a query at most 8. The live numbers are in `topology_admission` (`cia network robinhood --json`).
|
|
278
339
|
- Paths use bounded quantifiers such as `-[:FLOWED_TO]-{1,5}`. A `*` range, the legacy path functions, `PROFILE`, writes and `CALL` are refused.
|
|
@@ -92,6 +92,8 @@ Targeted and Victim labels only because millions of transactions touch
|
|
|
92
92
|
it. When a pool's only receiver is the router, the router is not the
|
|
93
93
|
buyer: the buyer is the sender of the buy transaction (reference B4).
|
|
94
94
|
Read an address's transaction count before you trust any label on it.
|
|
95
|
+
A Victim mark means the evidence walk proved the address lost money to a
|
|
96
|
+
scam; a hub is never one, whatever label it carries.
|
|
95
97
|
|
|
96
98
|
## Who the creator is
|
|
97
99
|
|