Skip to content

Command line

Installing pyogmios adds a pyogmios command (also python -m pyogmios), for quick checks and scripts.

pyogmios health                          # version, network, sync progress and tip
pyogmios tip                             # the tip and block height
pyogmios query epoch                     # any query, by its short or full name
pyogmios query ledger-state/tip
pyogmios query utxo '{"addresses": ["addr_test1..."]}'
pyogmios follow --from origin --headers  # chain events, one JSON document per line
pyogmios follow --from 1234.abcd... --count 100
pyogmios mempool --full                  # transactions as they enter the mempool
pyogmios submit tx.signed                # hex, CBOR bytes, or a cardano-cli text envelope
pyogmios evaluate tx.raw
  • Server: --url, else $OGMIOS_URL, else ws://localhost:1337. Options work before or after the command.
  • Output: JSON with Ogmios's own field names, indented in a terminal and compact when piped (--pretty and --compact choose). Streams print one document per line, ready for jq.
  • Exit codes: 0 on success, 1 for an error from the server (its data goes to standard error), 2 for a usage error, 3 when the server cannot be reached.
pyogmios follow --headers | jq -c 'select(.direction == "forward") | .block | {height, id}'

Help

usage: pyogmios [-h] [--version] [--url URL] [--timeout TIMEOUT] [--pretty |
                --compact]
                command ...

Query and follow an Ogmios v7 server.

positional arguments:
  command
    health           the server's version, network, sync progress and tip
    tip              the network tip and block height
    query            run any ledger state or network query
    follow           follow the chain: one JSON event per line
    mempool          transactions entering the mempool: one per line
    submit           submit a signed transaction
    evaluate         evaluate a transaction's scripts

options:
  -h, --help         show this help message and exit
  --version          show program's version number and exit
  --url URL          Ogmios URL (default: $OGMIOS_URL or ws://localhost:1337)
  --timeout TIMEOUT  seconds per request (default: 60)
  --pretty           indent the JSON output
  --compact          one line of JSON

Queries: block-height, constitution, constitutional-committee, delegate-
representatives, dump, epoch, era-start, era-summaries, genesis-configuration,
governance-proposals, live-stake-distribution, nonces, operational-
certificates, projected-rewards, protocol-parameters, reward-account-
summaries, rewards-provenance, stake-pools, stake-pools-performances, start-
time, treasury-and-reserves, utxo