Technology · 8 min read

Kademlia: The Bulgarian Algorithm Behind the Decen­tral­ized World

Kademlia is the name of one of the most significant technological solutions in information technology ever created by a Bulgarian. Never heard of it? Then it's high time! Petar Maymunkov created, almost as a joke, the system that is now widely used across the world of decentralized solutions, from BitTorrent to Ethereum. Kademlia turned out to be exactly the right answer at the turn of the millennium, when the internet took its decisive step away from centralized systems and toward the path that led us to blockchain. The scientist and his creation deserve their fame, and here is why.

Translated from the Bulgarian original →
Kademlia

Kademlia is the name of one of the most significant technological solutions in information technology ever created by a Bulgarian. Never heard of it? Then it's high time!

“Да ти е на кадем!” (da ti e na kadem, “may it bring you luck”) is a classic, old-fashioned Bulgarian wish for good fortune on your road; kadem is an old Turkish loanword for luck. Perhaps torrents as a technology, and many of the applications of the blockchain world, got off to such a lucky start thanks to the algorithm of the same name that beats at their heart.

Petar Maymunkov, a graduate of TUES and MIT, created, almost as a joke, the system that is now widely used across the world of decentralized solutions, from BitTorrent to Ethereum. Kademlia turned out to be exactly the right answer at the turn of the millennium, right at the time when the internet first took its decisive step away from centralized systems and toward the path that led us to blockchain.

Petar Maymunkov and his creation deserve their fame, and here is why.

A Little Fortune

What is Kademlia? A distributed hash table. If those last three words mean nothing to you, don't worry. In plain terms, it is an algorithm that lets millions of computers work together, organizing themselves and exchanging resources. And all of this without any kind of central registry run by a single person or company.

In even plainer terms: Petar Maymunkov's idea turned out to be exactly the solution everyone was looking for at the moment when the internet community was ripe to take the next big step in its development. Kademlia gave birth to the torrent system, which showed for the first time that the dreamed-of decentralization could really exist online.

Then that path paved the way for the next big step: blockchain. Torrents were the pioneer, and what came after them proved once and for all that decentralization is the future. Meanwhile, Kademlia did not become a museum piece; it turned out to be a splendid solution in the new conditions as well. Suffice it to say that the second most recognizable cryptocurrency, ether, also rests on the shoulders of this algorithm.

Petar Maymunkov
Petar Maymunkov

Fingers Crossed

Petar Maymunkov is a graduate of the famous Technological School “Electronic Systems,” known as TUES. On paper, TUES is an ordinary state high school in Mladost, a residential district of the capital, Sofia, yet over the past 30 years it has turned out specialists ready to step into the world of information technology at a global level.

The story of Kademlia's creator shows it too. He graduated from TUES in 1997. His path continued to Harvard for a bachelor's degree in computer science, followed by a master's at New York University and a doctorate at the mythical MIT.

Maymunkov was still a student, halfway along that road, when he created his remarkable project.

A Pie Full of Fortunes

“It all started in 2001, when Napster went down,” he recalls in one of the very few testimonies from those days that you can still find online today:

Napster was one of the first platforms through which users could swap songs on the same principle torrents use. But it was far from perfect. Launched in 1999, it certainly paved the way for the whole approach, yet it survived only three years, because the internet was not ready for that kind of solution. If you were online back then, you surely remember how primitive the connections were and how immature the technology.

In any case, Petar decided to build his own version, and he did it as a school project. His aim was both to create something meaningful with the knowledge he had gained and to find himself a practical solution similar to Napster.

And a better one, in one specific, fundamental respect. Although Napster worked on the principle of connections between individual users, it still depended on a centralized server to coordinate them.

“Isn't there a way for all users to take on that role? Aren't they all equally important?” Petar wondered. And a simple solution occurred to him, one that would later become known as Kademlia. He discussed it with his university colleague David Mazières, and they decided to finish it together.

“We found a simple way to organize a huge number of users into a system that evolves and changes constantly. And the users are part of it only while they are online,” the programmer recalls. “Our algorithm showed how computers can cooperate to build something with an orderly logic.”

Kademlia

Four-Leaf Clover

As he himself notes, several quite similar solutions appeared around the same time. But the race was largely won by the two students because… they created the simplest version. “Our solution turned out to be the most popular because it was the easiest to reproduce. The others were much harder mathematically; they came from far more academic circles. They worked too, but they were much more difficult to put into practice.”

“I think this algorithm turned out to be the decisive step in making file sharing on a global scale a mass practice,” he adds.

Among the first platforms to adopt it were the file-sharing projects eMule and BitTorrent.

And it is a fact that today, 20 years later, even ultramodern technologies rest on Kademlia, a thing created almost as a joke.

Knock on Wood

The main problem it solves is that it offers a way to organize information on the network without requiring a single “map” of it. At any moment, every participant who happens to be online can check the information about, say, a given file, without having to consult some central server.

Kademlia solves this problem through the right data structure, using the basic principles of cryptography.

In the years that followed, and to this day, Maymunkov has never stopped working in that direction: creating ever more decentralized solutions that help us break away, in one way or another, from the monopolies. Solutions that help us return to the charming days of the internet, when we believed it served democracy and equality.

“Alas, this type of solution never has a sensible business model, because it is very hard when the participants are equal, when some have no privileges at the expense of others,” he says in the only interview I managed to find after a good deal of searching.

Kademlia

Lucky Devil

It is safe to say that Kademlia was the first to make full democracy on the internet possible on a mass scale. It made decentralization possible. It demolished the logic of strict hierarchy.

And it did all of this by letting computers connect into a network and exchange resources without a central server.

What's more, its communication protocol solves a problem that is still behind some of the most common attacks on software security today: denial of service (DoS and DDoS). Because the information is not “nailed down” to a central source, attacks on such a source cannot harm it.

It is hard to get into the more technical side of things, because it is rather specialized. If you have a professional interest, you can find quite a sensible summary here and here.

Still, in brief: the idea is that every participant in the network keeps its own table with information about the objects currently being exchanged over the network. When two participants “meet,” they can easily compare their information, thanks to the tables that store encoded information about the individual units. And they can just as easily verify it, thanks to fast communication with other participants.

The system lets millions of participants work together at remarkable speed, checking and synchronizing information. That is because they store, in their tables, information about all the participants they come into contact with.

Ask Not the Old, but the One Who's Coded

An interesting nuance is that Kademlia values more highly the sources of information that have been on the network longer, because they are more likely to stay there in the future, and they have more accurate “knowledge.”

At the same time, new participants join the network quickly; it is enough for just one existing participant to register them.

And indeed: the structure Maymunkov proposed has been adopted, with slight modifications, in the way individual participants interact on the Ethereum blockchain.

Kademlia was developed as an unpatented algorithm, so it never brought its creator any income. But it did become a recognizable solution, well known and constantly used by specialists in the field.

As for Maymunkov's path from there, it has been a colorful one. He spent two years at Google, and today he is a blockchain engineer at a large American company.

Petar Maymunkov
Petar Maymunkov

Bear Me Lucky, Mother

The heading comes from a Bulgarian proverb that ends “and then throw me into the sea”: luck matters more than anything. He never achieved dazzling commercial success, and perhaps he never sought it. But why did he choose this colorful, so typically Bulgarian name for his algorithm? I wrote to him on every social platform and tried to find a way to reach him, but… I hit a wall. Alas, by all appearances Maymunkov is not fond of meeting journalists, and he has every right not to be. I would be glad if at some point we could continue this digital story in the words of Kademlia's creator himself.

It turns out that he himself is a kademliya, a lucky one, in a fairly literal sense. On September 11, 2001, he was studying in New York. His dormitory was seven blocks from the World Trade Center. After the first plane hit, he climbed onto the roof of the building and literally felt the wind as the second one arrived and crashed into the South Tower.

Sometimes luck simply loves the brave. Kademlia proved lucky and became a significant discovery. Even though it was a school project dreamed up by two students. Miracles in the tech world sometimes lean on good old superstition too, the kind in which almost everyone finds a lifeline now and then. If that is true for you as well, may the story of Kademlia bring you luck!

Almost there…
If you liked the story, support the project. The site has no ads.
Support

Next story

All stories →