Implementation of the network part of the Everscale blockchain.
┌─────────────────────┐
│ 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
└────────────────────────────────┘
cargo add everscale-networkuse anyhow::Result;use everscale_network::{adnl,NetworkBuilder};use tl_proto::{TlRead,TlWrite};#[derive(TlWrite,TlRead)]#[tl(boxed, id = 0x11223344)]structMyCustomData{counter:u32,}asyncfnexample() -> Result<()>{constDHT_KEY_TAG:usize = 0;// Create and fill keystorelet 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 peerslet(_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 DHTlet 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.
The current minimum required Rust version is 1.64.0.
We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.
This project is licensed under the License Apache.
