4 releases

0.1.3 Jul 14, 2022
0.1.2 Jan 14, 2020
0.1.1 Nov 16, 2019
0.1.0 Nov 16, 2019

#6 in #abci

33 downloads per month
Used in orga

MIT license

25KB
155 lines

abci2

Low-level ABCI protocol server

Crate API

This crate provides low-level access to the ABCI protocol, via a Connection type which exposes read() and write() methods which return or accept ABCI request or response structs.

Currently supports Tendermint 0.32.

Usage

Add this crate as a dependency:

[dependencies]
abci2 = "0.1"

Example:

// listen for ABCI connections from Tendermint
let server = abci2::Server::listen("localhost:26658").unwrap();

// wait for Tendermint to connect (note that we will need to accept the 3
// separate connections that Tendermint makes). this function blocks until
// a connection comes in.
let connection = server.accept().unwrap();

loop {
    // get an incoming request
    let req = connection.read().unwrap();

    // handle the request somehow
    let res = process_request();

    // send back the response
    connection.write(res).unwrap();
}

For a more complete example, see examples/simple.rs (you can run it via cargo run --example simple).

Rebuild Protobuf

If you are updating this crate to protobuf definitions for a newer version of Tendermint, you can regenerate the code by running: cargo run --bin codegen --features codegen.

Dependencies

~4.5MB
~88K SLoC