I.e., if A has sent to B, distance = 1. If A has sent to B and B has sent to C, distance between A and C is 2.


You would have to parse the entire blockchain and construct a graph where nodes are addresses and edges are direct transactions between two accounts. Then you would perform Dijkstra's algorithm: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm


As per Sasa's answer, you'd need to generate a dataset that could then be interpreted in the appropriate way.

Instead of generating your own from the raw chain data, you could use something like Google's BigQuery public Ethereum dataset and run the appropriate query. (You'll need to enable the Cloud Platform API before you can browse the public datasets.)

It looks like the dataset was last updated on 4 Mar 2019, but there are instructions on how it was generated, here, so it may be possible to copy the public data and update it.

For existing examples of what can be done with the BigQuery data, see this clustering study: Clustering Ethereum Addresses. This used different measures of distance between addresses (e.g. Euclidean and cosine distances1) to categorise addresses into connected clusters.

There are probably better existing tools out there, such as the ones used by chain analysis/forensics groups.

1 More on distances in data science, here.


the true measurement between two addresses would be a subtraction of one from another, like this:

address1 := common.HexToAddress("0x.......")
address2 := common.HexToAddress("0x.......")
big_a1 := new(big.Int)
big_a2 := new(big.Int)
big_diff := new(big.Int)
fmt.Printf("difference = %v\n",big_diff.String())


  • I don't see how this answers the question. This is something totally different – Lauri Peltonen Feb 10 at 17:18
  • @LauriPeltonen if you don't see it, it is not my problem. The answer is correct. – Nulik Feb 10 at 17:28
  • @LauriPeltonen I think he's trolling :) – Sasa Milic Feb 10 at 20:13
  • @SasaMilic I am not trolling, he asked about distance between addresses, not transactions. Since address is a number the distance between two numbers is subtraction operation. the OP didn't formulate question correctly, the correct formulation would be "transactional distance between addresses". – Nulik Feb 10 at 20:35
  • He explicitly says if A has sent to B, distance = 1. – Ismael Feb 11 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.