#hash-table #routes #peer #pulsar #distributed #blockchain #astreuos

pulsar-network

Pulsar Network is a distributed hash table peer-to-peer communication protocol for the Astreuos Blockchain

16 releases (5 breaking)

0.8.0 May 3, 2022
0.7.0 Apr 11, 2022
0.6.1 Apr 5, 2022
0.5.3 Mar 26, 2022
0.1.2 Dec 9, 2021

#1 in #astreuos

Download history 42/week @ 2024-06-29 54/week @ 2024-07-27 53/week @ 2024-09-21 22/week @ 2024-09-28

75 downloads per month

MIT license

26KB
530 lines

Pulsar Network

Pulsar Network is the distributed hash table peer-to-peer communication protocol for the Astreuos Blockchain.

Features

  • send and receive messages between peers.
  • messages are contained in an envelope with the context, nonce, sender, route and time.
  • message encryption uses chacha20poly1305 and a x25519 blake3 flavor as the key.
  • peers can join the network by sending join requests and valid peers returning the nearest peers
  • peers can be pinged and respond with their public key and route supported.
  • currently supported routes are Astreuos blockchain main and test routes used for validation.

API

Client

use pulsar_network::{Client, Route};

let bootstrap = false;

let route = Route::Test

let seeders: Vec<SocketAddr>;

let client = Client::new(bootstrap, route, seeders);

for (message, peer) in client.messages() {
    println!("Got: {}", message.body);
}

Message

use pulsar_network::{Message, Kind};

let mut message = Message::new(Kind::Block, message_bytes);

Broadcast

network.broadcast(message);

Send

network.send(message, peer)

Improvements

  • multi-threading
  • ephemeral keys
  • bluetooth communication

Contributions

Pull requests, bug reports and any kind of suggestion are welcome.

2022-05-03

Dependencies

~6MB
~128K SLoC