ogmios-python

Ogmios is a lightweight bridge interface for cardano-node. It offers a WebSockets API that enables local clients to speak Ouroboros’ mini-protocols via JSON/RPC. ogmios-python is an Ogmios client written in Python designed for ease of use.
Table of Contents
Installation
- Install cardano-node and Ogmios server as described here. (Docker installation is recommended.)
- Install ogmios-python from PyPI using pip:
pip install ogmios
Quickstart
To see how easy it is to build on Cardano with ogmios-python, let's use the library to view new blocks as they are added to the blockchain:
import ogmios
with ogmios.Client() as client:
_, tip, _ = client.find_intersection.execute([ogmios.Origin()])
_, _, _ = client.find_intersection.execute([tip.to_point()])
while True:
direction, tip, point, _ = client.next_block.execute()
if direction == ogmios.Direction.forward:
print(f"New block: {point}")

For more examples, see the documentation and example scripts in the repo.
Documentation
Complete client documentation is available on Read the Docs.
License
ogmios-python
is distributed under the terms of the GPL-3.0-or-later license.