Skip to content

Demessfor/bitcoin-closure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitcoin-closure

A project by Serena Randolph and Austin Williams

bitcoin-closure is a tool for computing the closure of a bitcoin address.

What is the Closure of a Bitcoin Address?

The closure of a bitcoin address is defined recursively as follows:

  1. An address is contained in its own closure.
  2. If address A is in the closure, and there exists a transaction using coins from address A and address B as inputs, then address B is also in the closure.

The motivation is that if two addresses appear together as inputs in some transaction, then the two addresses are very likely to be controlled by the same entity. As a result, all of the addresses in the closure of an address are very likely owned by the same entity*.

This linking was noted by Satoshi Nakamoto in the Bitcoin whitepaper (page 6):

“Some linking is still unavoidable with multi-input transactions, which necessarily reveal that their inputs were owned by the same owner. The risk is that if the owner of a key is revealed, linking could reveal other transactions that belonged to the same owner.”

You can read more about closures at these links:

(*) There are important exceptions. Coinjoin transactions, for example, contain inputs from three or more distinct entities -- yet all the addresses used as inputs to a coinjoin transaction are contained in the same closure.

Getting Started

JavaScript Web Interface

We're hosting a working implementation online here, so feel free to check that out.

Otherwise, you can run the application from your own computer as follows.

Grab the files from this repo:

$ git clone https://github.com/sharkcrayon/bitcoin-closure

Dig into the javascript folder:

$ cd bitcoin-closure
$ cd javascript

Then open the index.html file in your browser and enter a bitcoin address.

Python Command Line Tool

Grab the files from this repo:

$ git clone https://github.com/sharkcrayon/bitcoin-closure

Dig into the python folder:

$ cd bitcoin-closure
$ cd python

Then to find the closure of an address just use the following command from command line:

$ python closure.py 'address'

As a good first example, try this command:

$ python closure.py 1M8s2S5bgAzSSzVTeL7zruvMPLvzSkEAuv

And here is a list of some fun addresses to play around with.

Troubleshooting

It can be slow (it takes time for the API at insight.bitpay.com to respond).

Most errors are caused by:

(1) invalid input address or

(2) timeouts (slow internet speeds can result in timeout errors) or

(3) API rate limiting (the API will stop responding if you call it too many times too quickly, or make the same calls several times in a row).

Some Thoughts About Closures

Let X be the set of all bitcoin addresses. We will write A ~ B whenever bitcoin address A is in the closure of bitcoin address B.

The following properties hold for the relation ~ defined on the set of all bitcoin addresses, and are easy to prove from the definition of closure:

Reflexive: ∀A ∈X, A~A.

Symmetric: ∀A,B ∈ X, AB ⇒ BA.

Transitive: ∀A,B,C ∈X, AB & BC ⇒ A~C

Thus ~ induces an equivalence relation on X. It follows that the set of all bitcoin addresses can be partitioned into closures of addresses.

For those researchers doing blockchain analysis, it may be useful to consider whether your analysis can be extended from individual bitcoin addresses to entire closures. For example, rather than simply analysing the traditional bitcoin-transaction graph, you may also want to study the closure-transaction graph -- where the vertices are bitcoin closures and there exists a directed edge from closureA to closureB if any address in closureA has sent funds to any address in closureB.

Donate

If you like the project please donate a few bits to 17fEqNTUuot3FoDaR5YrCAVwpGRNn8zJDU.

Here's the QRC:

Image of QRC for 17fE...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.1%
  • Python 5.2%
  • HTML 2.7%