Asynchronous Queries

This example shows how to use the ogmios-python library to asynchronously execute multiple queries. This is useful for applications that need to query the chain frequently:

import ogmios

batch_size = 100

with ogmios.Client() as client:
    for i in range(batch_size):

    results = []
    for i in range(batch_size):

    results.sort(key=lambda tup: tup[1])
    for height, id in results:
        print(f"Block height: {height} (ID: {id})")

Example output:


Open this example on GitLab