CardanoSolutions / ouroboros-network

An implementation of the Ouroboros family of consensus algorithms, with its networking support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ouroboros-Network

  • io-sim - IOSim simulator monad which supports asynchronous exceptions, STM transactions and async interface, timers.
  • io-classes - type classes, all of them have instance for both IOSim and IO.
  • typed-protocols - session type framework with support of protocol pipelining
    • See 45min Haskell eXchange 2019 talk by @dcoutts.
    • See three 50min Monadic Party 2019 workshop talks by @coot: Part 1, Part 2, Part 3.
  • ouroboros-network- ouroboros network package which implements protocols which to run ouroboros family of protocols, multiplexing layer.
  • The byron-proxy is a network protocol proxy between Byron and Shelley. It now lives in a separate repository.

Ouroboros-Network Documentation

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

Ouroboros-Network API

The API consists of three layers:

• mini-protocol api's, which are GADTs for each mini-protocol under Ouroboros.Network.Protocol; this hides heavy type machinery of session types. One only needs the typed Peer type when one is using runPeer or runPeerPipelined function and each protocol exposes a function to create it (e.g. Ouroboros.Network.Protocol.ChainSync.Client.chainSyncClientPeer)

• callback ptcl -> channel -> m () where ptcl is enumeration for each mini-protocol, this is either NodeToNodeProtocols or NodeToClientProtocols. 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 V1 api which hides versioning from the caller.

Demo applications

Instructions 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.

Ouroboros-Consensus

Consensus layer of the family Ouroboros blockchain protocols.

Ouroboros-Consensus Documentation

The ouroboros-consensus/docs folder contains documentation about the consensus layer. Start with the README.md.

Formatting

The consensus team uses stylish-haskell >= 0.11.0.0 to format its code. This is enforced by CI.

Either enable editor integration or call the script used by CI itself:

./scripts/ci/check-stylish.sh

When using Nix, you can use the following command, which will build and use the right version of stylish-haskell.

nix-shell --run ./scripts/ci/check-stylish.sh

About

An implementation of the Ouroboros family of consensus algorithms, with its networking support

License:Apache License 2.0


Languages

Language:Haskell 93.4%Language:TeX 6.0%Language:Nix 0.4%Language:Shell 0.1%Language:Lua 0.1%Language:PowerShell 0.0%Language:Emacs Lisp 0.0%