#overlay #dht #part #blockchain #everscale #adnl #rldp

everscale-network

Implementation of the network part of the Everscale blockchain

27 releases

0.5.5-rc.0 Jul 21, 2023
0.5.3 Mar 13, 2023
0.4.0 Nov 11, 2022
0.3.5 Jul 6, 2022

#807 in Magic Beans

Download history 8/week @ 2024-01-04 17/week @ 2024-01-11 14/week @ 2024-01-18 17/week @ 2024-01-25 13/week @ 2024-02-01 37/week @ 2024-02-08 42/week @ 2024-02-15 58/week @ 2024-02-22 16/week @ 2024-02-29 27/week @ 2024-03-07 25/week @ 2024-03-14 47/week @ 2024-03-21 48/week @ 2024-03-28 54/week @ 2024-04-04 33/week @ 2024-04-11 30/week @ 2024-04-18

172 downloads per month

Apache-2.0

345KB
8K SLoC

Logo

everscale-network   Latest Version Workflow badge License Apache badge Docs badge

Table of Contents

About

Implementation of the network part of the Everscale blockchain.

Network stack

           ┌─────────────────────┐
           │            Overlay  │ - Overlay: Virtual subnetwork
┌──────────┼──────────┐          │ - DHT: Kademlia-like Distributed Hash Table
│    DHT   │   RLDP   │          │ - RLDP: Reliable Large Datagram Protocol
├──────────┴──────────┴──────────┤
│              ADNL              │ - ADNL: Abstract Data Network Layer
├────────────────────────────────┤
│              UDP               │ - underlying transport protocol
└────────────────────────────────┘

Usage

cargo add everscale-network
use anyhow::Result;
use everscale_network::{adnl, NetworkBuilder};
use tl_proto::{TlRead, TlWrite};

#[derive(TlWrite, TlRead)]
#[tl(boxed, id = 0x11223344)]
struct MyCustomData {
    counter: u32,
}

async fn example() -> Result<()> {
    const DHT_KEY_TAG: usize = 0;
    // Create and fill keystore
    let keystore = adnl::Keystore::builder()
        .with_tagged_key([1u8; 32], DHT_KEY_TAG)?
        .build();

    // Create basic network parts
    // NOTE: our ip address must be accessible from other peers
    let (_adnl, dht) = NetworkBuilder::with_adnl("1.2.3.4:10000", keystore, Default::default())
        .with_dht(DHT_KEY_TAG, Default::default())
        .build()?;

    // Store some data in DHT
    let stored = dht
        .entry(dht.key().id(), "some_value")
        .with_data(MyCustomData { counter: 0 })
        .with_ttl(3600)
        .sign_and_store(dht.key())?
        .then_check(|_, MyCustomData { counter }| Ok(counter == 0))
        .await?;
    assert!(stored);

    Ok(())
}

For more information you can check the docs or the examples.

Minimum Rust version

The current minimum required Rust version is 1.64.0.

Contributing

We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.

License

This project is licensed under the License Apache.

Dependencies

~8–19MB
~253K SLoC