5 releases
0.1.8 | Mar 8, 2021 |
---|---|
0.1.7 | Sep 3, 2020 |
0.1.6 | Jul 23, 2020 |
0.0.2 | May 22, 2020 |
0.0.1 | May 22, 2020 |
#16 in #consuming
16MB
386K
SLoC
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/
- Ubuntu:
- OpenSSL dev libs
- Ubuntu:
apt-get install libssl-dev
- Windows: TODO
- Ubuntu:
- 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
- Ubuntu:
- bindgen and therefore clang dev libraries
- Ubuntu:
apt-get install clang libclang-dev llvm-dev
- Windows: TODO
- Ubuntu:
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
- To run the tests you need to first run the build script.
./scripts/build_rust.sh
. - Navigate to the rust binding folder.
cd rust
- Then run the test using cargo and an additional option
RUST_TEST_THREADS=1
. This can be done viaRUST_TEST_THREADS=1 cargo test
.
Dependencies
~5.5–10MB
~183K SLoC