GhostNet demonstrates a peer-to-peer, private, permissionless, and decentralized communication protocol, drawing inspiration from Waku.
CAUTION: This is a basic demonstration of a communication protocol and should not be employed in any production setting. It lacks many essential features, particularly in spam prevention, scalability, and security.
Retrieves the address of a specified node.
GET /addresscurl --location '/address'[NODE ADDRESS]
Sends a ping request to an external node within the network; upon a successful ping, the external node will acknowledge the requesting node as a peer.
POST /pingcurl --location '/ping' \
--header 'Content-Type: application/json' \
--data '{
"node": "[REQUESTING NODE ADDRESS]"
}'[PINGED NODE ADDRESS]
Receives a list of external node addresses for establishing connections. Upon successful connections, it acknowledges these nodes as peers, and the external nodes reciprocally recognize the requesting node as a peer.
POST /bootstrapcurl --location '/bootstrap' \
--header 'Content-Type: application/json' \
--data '[
"EXTERNAL NODE ADDRESS 1",
"EXTERNAL NODE ADDRESS 2",
"EXTERNAL NODE ADDRESS 3"
]'[
["SUCCESSFUL NODE CONNECTIONS"],
["UNSUCCESSFUL NODE CONNECTIONS"]
]Retrieves the list of connected nodes for a given node.
GET /nodescurl --location '/nodes'[
"CONNECTED NODE ADDRESS 1",
"CONNECTED NODE ADDRESS 2",
"CONNECTED NODE ADDRESS 3"
]Broadcasts a provided message across the entire network, with the capability to accept messages in any arbitrary JSON structure. It returns a list of nodes that acted as relays for the message originating from the source node.
POST /relaycurl --location '/relay' \
--header 'Content-Type: application/json' \
--data '{
"message": "Hello, World!",
"timestamp": 1234567890
}'[
"RELAYED NODE ADDRESS 1",
"RELAYED NODE ADDRESS 2",
"RELAYED NODE ADDRESS 3"
]Expands its network of connections by requesting existing nodes to share their list of connected nodes and subsequently establishing connections with them.
GET /node-sharingcurl --location '/node-sharing'[
["SUCCESSFUL NODE CONNECTIONS"],
["UNSUCCESSFUL NODE CONNECTIONS"]
]Clone the project
git clone https://github.com/LordGhostX/GhostNetGo to the project directory
cd GhostNetInstall dependencies
pip install -r requirements.txtRun a node instance
# Run an instance on the default port (6969)
python3 node.py
# Run an instance on a custom port number
python3 node.py [PORT NUMBER]To run tests, run the following command
python3 tests.py