{"id":21814019,"url":"https://github.com/hoanhan101/hchord","last_synced_at":"2025-03-21T09:24:54.904Z","repository":{"id":112870735,"uuid":"115272258","full_name":"hoanhan101/hchord","owner":"hoanhan101","description":"Peer-to-peer lookup protocol","archived":false,"fork":false,"pushed_at":"2018-05-02T23:23:29.000Z","size":194,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T06:11:07.563Z","etag":null,"topics":["chord","distributed-algorithms","distributed-systems"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoanhan101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-24T15:38:17.000Z","updated_at":"2019-02-25T13:54:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"7bec8e3b-0120-4273-aa91-7c72f34cf606","html_url":"https://github.com/hoanhan101/hchord","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoanhan101%2Fhchord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoanhan101%2Fhchord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoanhan101%2Fhchord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoanhan101%2Fhchord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoanhan101","download_url":"https://codeload.github.com/hoanhan101/hchord/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244769283,"owners_count":20507418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chord","distributed-algorithms","distributed-systems"],"created_at":"2024-11-27T14:34:57.951Z","updated_at":"2025-03-21T09:24:54.876Z","avatar_url":"https://github.com/hoanhan101.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chord\n\n![build-success](https://img.shields.io/badge/build-success-brightgreen.svg)\n![test-passing](https://img.shields.io/badge/test-passing-brightgreen.svg)\n![status-stable](https://img.shields.io/badge/status-stable-green.svg)\n\n**Chord** is a \n[A Scalable Peer-to-peer Lookup Service for Internet\nApplications](https://pdos.csail.mit.edu/papers/chord:sigcomm01/chord_sigcomm.pdf).\nThe goal of the project is to gain a better understanding of a lookup service\nin distributed systems world.\n\n![Demo](demo.png)\n\n## Project Status\n\nThere are 3 versions: ChordLocal, ChordServer and ChordServer (alt.). \nDetails are provided below.\n\n## Table of Contents\n\n- [ChordLocal](#chordlocal)\n  - [Files](#files)\n  - [Testing](#testing)\n- [ChordServer](#chordserver)\n  - [Files](#files-1)\n  - [Testing](#testing-1)\n- [ChordServer (alt.)](#chordserver-alt)\n  - [Files](#files-2)\n  - [Testing](#testing-2)\n- [TODO](#todo)\n\n## ChordLocal\n\nChordLocal has the main Chord logic and can be used locally, which makes it easy for testing.\n\n#### Files\n\n- `chord_instance.py` is a Chord Instance class, which has main Chord logic as described in the paper.\n- `const.py` has a constant key space size m.\n- `node.py` is a Node class.\n- `utils.py` contains helper functions.\n\n#### Testing\n\n- Tests are written using 32 nodes and key space size equals to 16,\nbut you can test it with as many nodes and as big key space size as you want.\n- Configure the key space size in `const.py` under variable `m`.\n- Configure the number of nodes in `chord_instance.py` under variable `NUMBER_OF_NODES`.\n- Run `chord_instance.py`. \n\n## ChordServer\n\n*This version is not working properly yet because of some strange behavior with RPC calls.\nThe alternative version below is working but is implemented in a hacky way.*\n\nChordServer implements TCP networking on top of ChordLocal, using RPC. We chose to use\n [zerorpc](http://www.zerorpc.io \"zerorpc's Homepage\") module for this purpose.\n\n#### Files\n\n- `peer.py` is a Peer class that acts as a server and a client. It has a thread to listen and another\none to use RPC. The server starts listening at the default port (9000) which can be modified in `const.py`.\n- The client thread runs and asks the user which IP and port to connect to. The client then tries to connect\n to the given TCP address. If the client fails to find the server with that address in the network within 10\n  seconds, then it will create a new ring with the server as the node.\n- If the client is successful in connecting to a peer's server, then it will call its join function to that peer.\n Finger tables will be updated and a new node will be attached to our ring. \n- The algorithms for the joining and updated finger tables are discussed in detail in the paper.\n\n#### Testing\n\nThe chord implementation with networking is located in the [ChordServer](/ChordServer) folder.\n\nFirst change the `my_IP` variable in the `peer.py` file to your IP address.\n\nThen you may want to change the key space value (m) in the `const.py` file to something large like 16, as with a small number\n of identifiers in the circle there is a higher chance of the hashed IDs colliding.\n \nIf you want to use a port other than 9000, then  you may do so by modifying the value of the `default_port` \nvariable.\n- `pip3 install zerorpc`\n- `python3 peer.py`\n- You will be asked to enter the IP adress and port of the peer you'd like to join to.\n- The first node in the network will take approximately 10 seconds to initialize as the server times out after sending\ncontinuous heartbeat messages and failing to connect to the given address. When it initializes, it begins listening for\nany other peer in the network to join.\n- You may then use the first node's IP address and port to connect to other nodes.\n\n## ChordServer (alt.)\n\nThis is an alternative version of ChordServer. \nIn this implementation, each Chord Instance maintains a list of every other Chord Instance in the ring.\nThat is not how Chord should work. However, until the main version is fixed and working properly,\njust leave it here as a reminder.\n\n#### Files\n\n- `peer.py` is a Peer class that acts as a server and a client. It has a thread to listen and another\none to use RPC. \n- Each peer maintains a list of other peers who has already joined.\n- The list gets updated every time a peer joins and synchronizes across all peers.\n- When a peer joins the network, it asks anyone for the list, do all the computation locally,\nthen sends that updated list to everyone.\n- That way, everyone has the latest list and is ready to be called.\n\n#### Testing\n\n- `pip3 install zerorpc`\n- Run `peer.py` in different machines.\n- You will be ask for IP to join on each machine. Default port is 9000.\n\n## TODO\n\n- Fix RPC calls issues in ChordServer.\n- Dockerize everything\n- Test over AWS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoanhan101%2Fhchord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoanhan101%2Fhchord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoanhan101%2Fhchord/lists"}