Giter VIP home page Giter VIP logo

consentry's Introduction

consentry

๐Ÿ—๏ธ๐Ÿšง WIP ๏ธ๐Ÿ—๐Ÿšง

Ethereum consensus network sentry

Overview

Consentry is a standalone consensus networking service, for listening to events like blocks, attestations and more over the libp2p consensus network.

The repo is adapted from the lighthouse_network crate.

Usage

This is more or less the main example:

use consentry::{GossipKind, Service, ServiceConfig};
use futures::StreamExt;

#[tokio::main]
async fn main() {
    // Build the service. ServiceConfig::default() will
    // come with sensible defaults (and bootnodes)
    let mut svc = Service::new(ServiceConfig::default());

    // Get a handle for interacting with the service
    let handle = svc.handle();

    // Subscribe to any `GossipKind` topics
    handle.subscribe_topic(GossipKind::BeaconBlock);

    // Open the event stream on which these topics will be sent
    let mut events = svc.pubsub_event_stream();

    // Spawn the service
    tokio::task::spawn(svc.start());

    while let Some(event) = events.next().await {
        println!("Event: {:?}", event.kind());
        println!("Peer count: {}", handle.peer_count().await);
    }
}

Running Example

Run the example with:

RUST_LOG=consentry=info cargo run --example main

This will print out received blocks and peer counts. You can also tune RUST_LOG to more granular tracing like debug or trace.

consentry's People

Contributors

mempirate avatar

Stargazers

 avatar Javed Khan avatar eth_sign avatar  avatar greyireland avatar zerosnacks avatar 0xAr0k avatar Rodrigo Herrera avatar jpgonzalezra avatar deltartificial avatar Akihito Nakano avatar Georgios Konstantopoulos avatar Michael Sproul avatar Jack McPherson avatar  avatar vanbeethoven.eth avatar Perelyn avatar  avatar Stone Gao avatar bt3gl avatar  avatar Elvis avatar Eugene Kadish avatar Matt Ma avatar  avatar Nikita avatar  avatar 0xYYY avatar sam bacha avatar  avatar Friday James avatar Mutalisk avatar HAOYUatHZ avatar Zeqing Guo avatar Muzann avatar Kyle Cain avatar David avatar  avatar  avatar longcpp avatar cawfree avatar Shabbir Hasan avatar evalir avatar Dustin Brickwood avatar Runchao Han avatar Mulili Nzuki avatar Hilliam T. avatar Matthias Seitz avatar Masanori Ogino avatar Dan Cline avatar

Watchers

 avatar

Forkers

bbenzikry gmh5225

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.