Skip to content

Implement Ethereum DEX Trade Mirroring Detection Linked to Stellar Wallet Behaviour #210

Description

@Inkman007

Description

Cross-chain wash trading — where the same actor runs coordinated manipulation across Stellar DEX and Ethereum DEX (Uniswap, Curve) — is a known evasion tactic. The existing detection/cross_chain/ module has a resolver and identity graph but does not yet pull Ethereum DEX trade data or correlate it with Stellar activity. This issue asks you to implement Ethereum DEX trade mirroring detection: identifying Stellar wallets whose trading patterns are statistically mirrored on Ethereum within a short time window.

What needs to be built

  • Add detection/cross_chain/ethereum_dex_loader.py that queries Ethereum DEX trade history from The Graph protocol (subgraph queries for Uniswap v3 and Curve) via GraphQL.
  • Implement detect_mirrored_trades(stellar_wallet, eth_address, window_seconds=300) in detection/cross_chain/behavioral_matcher.py that computes a mirroring score: fraction of trades on Stellar with a matching trade (same asset pair, opposite direction, similar amount) on Ethereum within the time window.
  • Add the mirroring score as a new feature (eth_mirror_score) in detection/feature_engineering.py.
  • Resolve Stellar ↔ Ethereum address linkages from the existing detection/cross_chain/identity_graph.py.

Requirements

Functional

  • Ethereum data fetcher must respect rate limits of The Graph hosted service (max 1000 queries/day on free tier); cache responses in the existing feature cache with a 1-hour TTL.
  • The mirroring score must gracefully return 0.0 when no Ethereum address is linked to the Stellar wallet (not an error).

Testing

  • Unit test: construct two synthetic trade sequences (one Stellar, one Ethereum) with 80% mirror overlap; assert mirroring score > 0.7.
  • Test: no linked Ethereum address; assert mirroring score = 0.0 and no exception.

Security

  • GraphQL queries to The Graph must be sanitised; wallet addresses must be validated as checksummed Ethereum addresses before insertion into queries.

Documentation

  • Add a section to docs/cross_venue_detection.md explaining the Ethereum mirroring detection approach and its limitations (requires prior cross-chain identity resolution).

Contributor guidance

Area of specialty: Cross-chain blockchain analytics, GraphQL, Python, Ethereum/Stellar.

How to contribute:

  1. Comment describing your experience querying The Graph or Ethereum on-chain data.
  2. Describe how you would handle the address resolution uncertainty (Stellar ↔ Ethereum links are probabilistic, not definitive).
  3. PR must include the GraphQL query, the mirroring score calculation, and both unit tests.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions