in3

Crates.ioin3
lib.rsin3
version0.1.8
sourcesrc
created_at2020-05-22 10:17:46.303954
updated_at2021-03-08 14:21:03.720848
descriptionHigh-level bindings to IN3 library
homepagehttps://slock.it/incubed/
repositoryhttps://github.com/blockchainsllc/in3/releases
max_upload_size
id244523
size234,847
devops-slockIt (devops-slockIt)

documentation

https://in3.readthedocs.io

README

in3-rs

Rust bindings for the Incubed C library.

The Incubed client is a

  • Crypto-Economic
  • Non-syncronizing and stateless, but fully verifying
  • Minimal resource consuming

blockchain client (Crypto-Economic Client, Minimal Verification Client, Ultra Light Client).

[dependencies]
in3 = "0.0.2"

Links:

Requirements

  • Rust compiler version >= 1.42.0 -> rustc --version
  • A toolchain capable of compiling IN3 C sources
    • Ubuntu: apt-get install build-essential
    • Windows: https://visualstudio.microsoft.com/visual-cpp-build-tools/
  • OpenSSL dev libs
    • Ubuntu: apt-get install libssl-dev
    • Windows: TODO
  • CMake version >= 3.5.1, because we build the bundled IN3 C library with the cmake crate
    • Ubuntu: apt-get install cmake
    • Windows: https://cmake.org/install/, Make sure you add it to path for windows
  • bindgen and therefore clang dev libraries
    • Ubuntu: apt-get install clang libclang-dev llvm-dev
    • Windows: TODO

in3-rs uses the in3-sys to provide low-level bindings to the IN3 C library.

Features

  • blocking- Enables the blocking API which depends on async-std.

Example

Cargo.toml

[dependencies]
async-std = "1.5.0"
in3 = "0.2.0"

main.rs

use std::convert::TryInto;
use async_std::task;

use in3::eth1::*;
use in3::prelude::*;

fn main() -> In3Result<()> {
    let mut eth_api = Api::new(Client::new(chain::MAINNET));
    eth_api.client().configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#)?;

    let latest_blk_num: u64 = task::block_on(eth_api.block_number())?.try_into()?;
    println!("Latest block number is {:?}", latest_blk_num);
    Ok(())
}

Contributing

Instructions for running the tests

  1. To run the tests you need to first run the build script. ./scripts/build_rust.sh.
  2. Navigate to the rust binding folder. cd rust
  3. Then run the test using cargo and an additional option RUST_TEST_THREADS=1. This can be done via RUST_TEST_THREADS=1 cargo test.
Commit count: 6831

cargo fmt