Kademlia

Intro

Me

Target

n

n-1

Me

Target

ID Labeled

2a759b.....916879c

2a759b.....9168983

2a759b.....9169c9

2a0959b.....9169c9

2a759b.....09ceac9

2a759b.....0901c8

2a0bacb.....0901c8

2a0bacb.....00cabe2

2a0bacb.....0c0eba

0c9af3cb.....0c0eba

0c9bacb.....0c0eba

Distance

Calculator by XOR

0x004F

0x007D

XOR

0x0032

Source

Target

Buckets

XOR

0x0032

0
1
2
3
4
5 0x0032

0x004F

0x007D

Source

Target

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 001

TARGET: 110

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 001

TARGET: 101

0 001
1 010 011
2 110 100 111

001 ^ 101 = 100

Buckets

最高非 0 位 index

KNOWN

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 001

TARGET: 101

0 001
1 010 011
2 110 100 111

Buckets

最高非 0 位 index

KNOWN

QUERY: 110

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 110

TARGET: 101

0 111
1 100
2 011 010 001 000

110 Buckets

最高非 0 位 index

KNOWN

QUERY: 110

110 ^ 101 = 011

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 110

TARGET: 101

0 111
1 100
2 011 010 001 000

110 Buckets

最高非 0 位 index

KNOWN

QUERY: 100

110 ^ 101 = 011

Position

1

1

1

1

1

1

1

0

0

0

0

0

0

0

ME: 100

TARGET: 101

0 101
1 111 110
2 001 100 010 011

100 Buckets

最高非 0 位 index

KNOWN

100 ^ 101 = 001

Peer to Peer

File Sharing

Hash file into Kad ID

fd02cb2e4703fb0bcaf39314efa35f9e333ce258a108389899d0721745b96e50

SHA-256

Calculator distance and put into self bucket

Magnet Link

Kademlia Intro

By Chia Yu Pai

Kademlia Intro

  • 319