Home

Awesome

Ouroboros Network

x86_64-linux x86_64-darwin aarch64-darwin mingw64 Nightly CI Haddocks Discord

This repository contains specification and implementation of the network protocols and applications for Ouroboros family of protocols, primiarly used by cardano-node, cardano-cli, cardano-db-sync or cardano-wallet.

The following graph shows the dependency tree. The top-level package is ouroboros-consensus-diffusion which is part of ouroboros-consensus. Note that we abbreviate ouroboros-{consensus,network} to o-{c,n} in the labels.

flowchart TB
  subgraph ourobors-consensus
    I[o-c-diffusion]
    L[o-c]
    click I "https://github.com/intersectmbo/ouroboros-consensus/" _blank
    click L "https://github.com/intersectmbo/ouroboros-consensus/" _blank
  end

  subgraph ouroboros-network
    M[cardano-ping]      --> A[network-mux]
    D[o-n-framework]     --> A
    D                    --> E[o-n-api]
    F[ouroboros-network] --> D
    F                    --> G[o-n-protocols]
    J[cardano-client]    --> F
    I                    --> F
    L                    --> E
    G                    --> E
    K[ntp-client]

    click A "https://ouroboros-network.cardano.intersectmbo.org/network-mux/" _blank
    click M "https://ouroboros-network.cardano.intersectmbo.org/cardano-ping/" _blank
    click D "https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network-framework/" _blank
    click E "https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network-api/" _blank
    click F "https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network/" _blank
    click G "https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network-protocols/" _blank
    click J "https://ouroboros-network.cardano.intersectmbo.org/cardano-client/" _blank
    click K "https://ouroboros-network.cardano.intersectmbo.org/ntp-client/" _blank
  end

  subgraph network
    B[network]     
    N[Win32-network]

    click B "https://hackage.haskell.org/package/network" _blank
    click N "https://input-output-hk.github.io/typed-protocols" _blank
  end

  subgraph typed-protocols
    H[typed-protocols]

    click H "https://github.com/input-output-hk/typed-protocols/" _blank
  end

  A --> network
  K --> network

  E --> typed-protocols
  G --> typed-protocols

Libraries:

Documentation

We have two documents which describe various levels of the networking layer of the Cardano Shelley implementation:

Work progress

On a biweekly basis, we publish updates on cardano-updates. We are also tracking our current work in the Ouroboros Network Project.

Contributing

The contributing guide is available here. The style guide is available here. The code of conduct is available here.

Ouroboros Network API

The API consists of three layers:

• mini-protocol APIs, which are GADTs for each mini-protocol under Ouroboros.Network.Protocol (defined in ouroboros-network-protocols package); this hides heavy type machinery of session types. One only needs the Peer or [PeerPipelined] type when one is using runPeer or [runPeerPipelined] function and each protocol exposes a function to create it (e.g. chainSyncClientPeer. There is also API which allows to run a Peer or [PipelinedPeer] with limits (i.e. per state timeouts & per message size limits).

• callback MiniProtocolCb. The callback is wrapped in OuroborosApplication GADT which allows to differentiate the initiator/responder (or client/server) callbacks.

• versioning which is a map from version numbers to the above callbacks and version data (the tricky part here is that version data type can be different between different versions; there is a simple way of building this map using a semigroup). You can use simpleSingletonVersion if your application does not depend on negotiated version data. However, Ouroboros.Network.NodeToNode and Ouroboros.Network.NodeToClient expose API which hides versioning from the caller.

Demo applications

<details> <summary>Instructions</summary> To run a demo type:
cabal run <DEMO_NAME> --

After -- you will need to pass arguments, when a demo is run without arguments it will specify what arguments it needs.

</details>