#p2p #protocols #hypercore #dat

hypercore-protocol

Replication protocol for Hypercore feeds

10 releases (5 breaking)

Uses new Rust 2024

0.7.0 Feb 19, 2026
0.6.1 Oct 28, 2024
0.5.0 Jul 5, 2024
0.4.1 Oct 26, 2023
0.0.1 Jun 1, 2020

#594 in Cryptography

Download history 5/week @ 2026-01-14 10/week @ 2026-01-21 12/week @ 2026-01-28 21/week @ 2026-02-04 8/week @ 2026-02-11 26/week @ 2026-02-18 22/week @ 2026-02-25 18/week @ 2026-03-04

74 downloads per month
Used in peermerge

MIT/Apache

110KB
2.5K SLoC

Hypercore Protocol

crates.io version build status downloads docs.rs docs

Hypercore protocol is a streaming, message based protocol. This is a Rust port of the wire protocol implementation in the original Javascript version. This crate targets the Hypercore LTS version 10.

This crate provides a low-level streaming API to hypercore-protocol and exposes an interface that should make it easy to implement actual protocol logic on top.

This crate uses either async-std or tokio for async IO, snow for the Noise handshake and RustCrypto's crypto_secretsteram for encryption.

Features

  • Complete the Noise handshake
  • Establish libsodium's crypto_secretstream.
  • Open channels with a key
  • Accept channels opened by the remote end if your end knows the key
  • Create and verify capability hashes
  • Send and receive all protocol messages
  • Support async-std or tokio runtimes
  • Support WASM
  • Test Javascript interoperability
  • Support the new manifest in the wire protocol to remain compatible with upcoming v11
  • Finalize documentation and release v1.0.0

Installation

cargo add hypercore-protocol

Examples

These examples sync data between Rust and NodeJS hypercore-protocol implementations. To prepare, run

cd examples-nodejs && npm install && cd ..

replication.rs

Runs the replication.rs example by replicating a hypercore between Rust and Node hypercores and printing the result.

  • Node Server / Rust Client
node examples-nodejs/run.js nodeServer
  • Rust Server / Node Client
node examples-nodejs/run.js rustServer
  • Rust Server / Rust Client
node examples-nodejs/run.js rust
  • Node Server / Node Client
node examples-nodejs/run.js node

Development

To test interoperability with Javascript, enable the js_tests feature:

cargo test --features js_tests

Run benches with:

cargo bench

Contributing

We're actively looking for contributors to the datrust development! If you're interested, the easiest is to say hi in the #rust channel on the Hypercore Protocol Discord.

Want to help with Hypercore Protocol? Check out our "Contributing" guide and take a look at the open issues.

License

MIT OR Apache-2.0

Dependencies

~10–14MB
~177K SLoC