CSE 124 Peer-to-peer networks and Chord
2017 November 29: Homework 6

## Question 1

In the Chord DHT, both servers and data items (keys) are mapped to a keyspace typically visualized as a ring. Explain how servers are mapped to the ring, and how data items (keys) are mapped to the ring. Given a server with ID A, with a predecessor with ID P, and a successor with ID S, which parts of the keyspace is mapped to A?

## Question 2

In expectation, how many lookups/hops are needed to find a key in a Chord network with N nodes?

## Question 3

Consider a Chord network with 4 bits of keyspace (so 16 total identifiers in the ring). Now consider that there are four servers in this network: {“starbase.neosoft.com”, “www.cs.berkeley.edu”, “www.cs.ucsd.edu”, “www.sdsc.edu”}.

For question 3, we’re going to use the hash function `SHA-256`. In Python, you can generate a hash value, given a string, in the following way:

``````import hashlib

def h(s):
return hashlib.sha256(s).hexdigest()
``````

Note that this returns the entire hash, however for this exercise you need the hash value modulo the keyspace, in this case modulo 2^4 = 16.

### Question 3.1

For each node, write out its finger table

### Question 3.2

Now insert a set of data items into this Chord network, with identifiers {“Berners-Lee”, “Diffie”, “Hellman”, “Stonebraker”, “Lamport”, “Goldwasser”, “Micali”, “Pearl”, “Valiant”, “Thacker”, “Liskov”}

Which node hosts “Berners-Lee”? Which node hosts “Lamport”? Which node hosts “Valiant”? Which node hosts “Liskov”?

### Question 3.3

Node “www.cs.berkeley.edu” wants to find “Thacker”. Indicate the lookups/network transfers needed to resolve and download “Thacker”.

## Question 4

Now imagine that a new node joins the system with the identifier “www.cs.washington.edu”. Where in the ring does this new server belong? Which data items need to move locations based on this new addition, and to where do they need to go?