What is the btc.to address shortening algorithm?

3

How does the btc.to address shortening algorithm work? Is is a deterministic algorithm, that is, it can be reproduced on other websites with the same results, or are the results specific to the website and the order in which the addresses were inputted?

ThePiachu

Posted 2012-01-12T11:22:03.497

Reputation: 41 594

1this might actually be more appropriate on StackOverflow, as it isn't actually a bitcoin specific piece (cf twitter's t.co, and stackexchange's own shortened URL's)Rory Alsop 2012-01-12T11:30:40.713

3@RoryAlsop: I'd say it's pretty Bitcoin specific since it is a way to shorten Bitcoin addresses, not a general service for web addresses or so. Do you agree?D.H. - bitcoin.se 2012-01-12T11:54:53.010

2@RoryAlsop I believe this question is on-topic, as it deals with a website specific to Bitcoins. Whether their algorithm relies on Bitcoin-related data or not is (at least to me), unknown, thus only by answering this question we can know if any further topics related to btc.co would be on, or off topic.ThePiachu 2012-01-12T12:00:26.073

that makes sense - I was thinking it was the more general case.Rory Alsop 2012-01-12T12:22:48.277

Answers

3

The results are specific to the website and the order in which the addresses were input.

This can be easily determined by experiment. I took a random address from BE and it gave me http://btc.to/2z7. I took another address and it gave me http://btc.to/2z8.

So clearly, it stores all given addresses in a database, and the URL is the address ID encoded in base 36 (experiment also shows that it's case insensitive).

Also, it only accepts valid Bitcoin addresses.

More generally, it's impossible for any algorithm to take an arbitrary long, high-entropy string and give a short string which can be uniquely mapped back to the input.

Meni Rosenfeld

Posted 2012-01-12T11:22:03.497

Reputation: 18 542

As for the last part, you can still create an algorithm that shortens some of those high-entropy strings, especially if you have some additional information about them (like FirstBits did).ThePiachu 2012-01-12T17:10:05.657

2Firstbits makes use of the fact that the address already appears in the block chain, which means that it is not high-entropy (or that it is not arbitrary, depending on how you look at it).Meni Rosenfeld 2012-01-12T17:23:57.473