keyspace is a publicly accessible, unique 128-bit ID generator, whose IDs can be used for any purpose
the GitHub repo: https://github.com/normalocity/keyspace/
Why build this?
keyspace is an experiment in interesting technology that doesn't have an obvious, or even single, purpose. Think of the way we use ISBN numbers to uniquely label books, and how you can find the ISBN number for any given book, or in reverse, find a book given the ISBN number. The idea of keyspace is to build a public service with a pool of unique IDs so large, that any/all objects anywhere can be labeled with a unique ID, if desired.
While we doubt that keyspace will have use beyond a few areas that need a very large number of unique keys, we wanted to build it to handle a large enough set of objects, resources, and datasets, that it could be used for any project, anywhere, of any size, large or small.
Why 128-bits?
The number of unique 128-bit keys that can be generated is approximately 340,282,367,000,000,000,000,000,000,000,000,000,000. That's about 340 billion, billion, billion, billion.
It's really big. It's a pool of unique keys large enough to give a unique ID to every object ever made by the human race, to uniquely identify every copy of every book ever printed, every word in every language...you get the idea. It's a big number. 128-bits is so huge, that it outstrips the total demand for unique IDs ever created, and therefore, there is no concern (at least not any time in the near future) that we'll ever run out. And if we ever do run out, we can simply bump it up to 256-bits, keeping the entire set of 128-bit IDs intact, and proceeding from there.
Why public?
A couple of reasons. First, because only the entire collection of the public space has a need large enough to even require such a large unique ID set. Second, why not make it public? It's such a simple, and possibly quite useful technology, that there's no reason we shouldn't give it away, and see for what purpose people decide to use it.
If I wanted to request a set of unique IDs, how do I do that?
You can either use the sample Java command-line client software that comes with the open source project, or create your own client software if you're a developer.
Building your own client, in whatever language suits you should be very simple. The protocol for requesting keys detailed below. If you know how to write basic networking code using UDP packets, then you're pretty much set to go.
keyspace protocol details
karmanebula has opened a public keyspace server at keyspace.karmanebula.com:6512 (6512 is the UDP port)
This first, public version of the keyspace server software runs as a just one machine, with some basic crash recovery features to help make sure that the unique IDs generated are truly unique (and not accidentally repeated, due to a server failure). In future versions keyspace will be converted into a distributed network service, and be made up of a handful of loosely coordinated systems.
The protocol for requesting keys is extremely simple:
- Create a 2-byte (16-bit) KeySet UDP request packet. The packet should contain a positive integer value in the range of 1-32767, that indicates the number of unique IDs you're requesting. Request packets that aren't exactly 2-bytes in length, and/or outside the valid request range, will be ignored.
- Send the KeySet request packet to the server at keyspace.karmanebula.com, on UDP port 6512
- Read the response from the server
- The server's response is a single UDP packet, that is 18-bytes in size
- The first 16 bytes (128-bits) is the first unique 128-bit ID in your KeySet
- The last 2 bytes is the number of keys issued in the KeySet. So, if you received a KeySet with a starting key of "3", and a KeySet size of 100, then you have keys 3-102 (100 keys total).
- It's important to make note of the number of keys in your KeySet. If you requested 100, but the server sent you a KeySet with only 50 keys in it, it's up to you to notice that you only have 50 keys - that's why the size of the KeySet is included in the server's reponse.
Notes:
- A KeySet is a set of unique IDs (or keys)
- A KeySet can be from 1-32,767 keys in size
- The size of the KeySet is the number of unique IDs (keys) you're asking to be issued to you. Implementation decisions limit you to requesting 32,767 IDs (kyes) at a time. However, you can request as many KeySets as you like.
