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.
| Example | Demonstrates |
|---|---|
| block-fetch | Fetch a block by slot and hash from a node. |
| chain-sync | Synchronize blocks and headers, with optional block fetching and range queries. |
| chain-tip | Read and display the current chain tip. |
| peer-sharing | Request peers through the peer-sharing mini-protocol. |
| ping | Measure node connection and ChainSync response times. |
| state-query | Query ledger state from a local node. |
| tx-monitor | Monitor transactions in the node’s local mempool. |
| tx-submission | Submit a transaction to a local node. |
The examples are Go programs in the gOuroboros module and require Go 1.26.5 or newer. After extracting the download, follow its README to copy the corrected examples into the matching v0.211.0 module, run the tests, and configure a node connection. Follow the environment and connection settings in each source file, and use the module’s API documentation for additional package details.