Skip to content

gOuroboros examples

The gOuroboros repository includes runnable programs that demonstrate how Go applications connect to Cardano nodes and use Ouroboros mini-protocols. This page includes a docs snapshot based on the examples from gOuroboros v0.211.0, with corrections listed in the bundle README.

Download all examples or browse the versioned source files on GitHub.

ExampleDemonstrates
block-fetchFetch a block by slot and hash from a node.
chain-syncSynchronize blocks and headers, with optional block fetching and range queries.
chain-tipRead and display the current chain tip.
peer-sharingRequest peers through the peer-sharing mini-protocol.
pingMeasure node connection and ChainSync response times.
state-queryQuery ledger state from a local node.
tx-monitorMonitor transactions in the node’s local mempool.
tx-submissionSubmit a transaction to a local node.

The examples are Go programs in the gOuroboros module. Follow the environment and connection settings in each source file, and use the module’s API documentation for additional package details.