Skip to main content

Crate pallas_network

Crate pallas_network 

Source
Expand description

Implementation of the Ouroboros networking stack.

A multiplexer plus state-machines for each Cardano mini-protocol (handshake, chain-sync, block-fetch, tx-submission, local-state-query, …), exposed through ergonomic per-role facades. Async, tokio-backed.

This is the original, single-connection / client-server-shaped stack. A peer-to-peer rewrite is in progress in pallas-network2; once that is mature it is intended to replace this crate.

§Usage

use pallas_network::facades::PeerClient;
use pallas_network::miniprotocols::MAINNET_MAGIC;

let mut peer = PeerClient::connect(
    "relays-new.cardano-mainnet.iohk.io:3001",
    MAINNET_MAGIC,
).await?;

let _chainsync  = peer.chainsync();   // &mut chainsync::N2NClient
let _blockfetch = peer.blockfetch();  // &mut blockfetch::Client

§Overview

§Usage as part of pallas

When depending on the umbrella pallas crate, this crate is re-exported as pallas::network.

Modules§

facades
High-level client/server facades (node-to-node, node-to-client).
miniprotocols
State-machines for every Ouroboros mini-protocol (handshake, chain-sync, block-fetch, tx-submission, local-state-query, …) and the shared network-magic constants. Implementations for the different Ouroboros mini-protocols
multiplexer
Segment-level transport that multiplexes mini-protocol traffic over a single bearer. A multiplexer of several mini-protocols through a single bearer