Last active
June 21, 2020 12:56
-
-
Save vladbatushkov/8a8420d20cc04197818e95a46e8f4032 to your computer and use it in GitHub Desktop.
Find txs chain with addresses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROFILE MATCH (:Address {address: "addr1-2"})-[:OUT]->(:Output)<-[:OUT]-(t:Transaction) | |
CALL apoc.path.expandConfig(t, { sequence:'Transaction, <IN, Input, <UNLOCK, Output, <OUT' }) | |
YIELD path | |
UNWIND nodes(path) as tx | |
MATCH (tx:Transaction)-[:OUT]->(o:Output)<-[:OUT]-(a:Address) | |
WHERE (o)-[:UNLOCK]->(:Input) | |
RETURN DISTINCT * | |
// check tx chain, 3 - min number of hops in the chain, 6 - max | |
// where is no chains longer than 3 hops = 2 tx. (each (tx)-to->(tx) step required 3 hops). | |
// you can try 4..6 - nothing found. | |
// with long chain in database we can apply: 4..12 (can find chain with at least 3 tx, max 5 tx) | |
MATCH path = (:Tx)<-[*3..6]-(:Tx) | |
RETURN path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment