cq - CBOR Query Tool for Cardano
Think "jq for Cardano CBOR" - A fast CLI tool to inspect and query Cardano transactions encoded in CBOR format.
Born from a real pain point in the 2025 Cardano Developer Survey: developers lack good CLI tooling for debugging CBOR transactions. cq fills that gap.
Features
- Parse transactions from file, hex string, or stdin
- Query with dot-notation -
cq outputs.0.address tx.cbor - Wildcard support -
cq outputs.*.value tx.cbor - Filter queries -
cq 'outputs[value.coin > 1000000]' tx.cbor - Plutus data decoding - Datums and redeemers decoded to JSON
- Address decoding -
cq addr <bech32>decodes any Cardano address - CIP metadata standards - CIP-20 messages, CIP-25 NFTs, CIP-68 datum metadata
- Asset name decoding - Token names display as UTF-8 when valid
- Bech32 addresses - Auto-formatted for readability
- Pretty terminal output - Colors, tables, smart truncation
- JSON output - Perfect for piping to
jq - Babbage + Conway eras - Full support including governance
- Blazing fast - Native Rust, no WASM overhead
Installation
From crates.io (recommended)
Pre-built binaries
# Linux/macOS
|
# Windows (PowerShell)
Or download directly from GitHub Releases.
Upgrading
To upgrade to the latest version:
Check for updates
Upgrade via cargo
Pre-built binaries
Re-run the installer script - it always fetches the latest version:
# Linux/macOS
|
# Windows (PowerShell)
From source
Quick Start
# Show full transaction (pretty output)
# Query specific fields
# Nested queries
# Wildcard queries
# Different output formats
# Validation mode
&&
# Read from stdin
|
|
# Hex input (with or without 0x prefix)
# Filter queries (v0.2.0+)
# Datum queries - decode Plutus data (v0.3.0+)
# Redeemer queries (v0.3.0+)
# Reference inputs (CIP-31, v0.3.0+)
# Decode any address (v0.2.0+)
Query Shortcuts
| Shortcut | Expands To | Description |
|---|---|---|
fee |
body.fee |
Transaction fee |
inputs |
body.inputs |
Input UTxOs |
outputs |
body.outputs |
Output UTxOs |
hash |
(computed) | Transaction hash |
metadata |
auxiliary_data.metadata |
Transaction metadata |
witnesses |
witness_set |
Signatures & scripts |
ttl |
body.ttl |
Time to live |
mint |
body.mint |
Minted assets |
certs |
body.certs |
Certificates |
withdrawals |
body.withdrawals |
Stake withdrawals |
collateral |
body.collateral_inputs |
Collateral inputs |
reference_inputs |
body.reference_inputs |
Reference inputs (CIP-31) |
redeemers |
witness_set.redeemers |
Script redeemers |
required_signers |
body.required_signers |
Required signers |
network_id |
body.network_id |
Network ID |
validity_start |
body.validity_interval_start |
Valid from slot |
script_data_hash |
body.script_data_hash |
Plutus script data hash |
collateral_return |
body.collateral_return |
Collateral return output |
total_collateral |
body.total_collateral |
Total collateral amount |
Example Output
$ cq transaction.cbor
Transaction
Hash: 0edb4eac0b992ac4af71a2a52f41ab63c806e0ef4e5c5d9c7348ea03cf9a9e4e
Valid: true
Body
Fee: 171,617 lovelace
Inputs (1)
┌───┬─────────────────┬───────┐
│ # ┆ Transaction ID ┆ Index │
╞═══╪═════════════════╪═══════╡
│ 0 ┆ 852ec7...73fa31 ┆ 0 │
└───┴─────────────────┴───────┘
Outputs (2)
┌───┬──────────────────────────┬────────────────────────┬───────┐
│ # ┆ Address ┆ Value ┆ Datum │
╞═══╪══════════════════════════╪════════════════════════╪═══════╡
│ 0 ┆ addr_test1vp9...jg52l8g8 ┆ 9,594,993,891 lovelace ┆ - │
│ 1 ┆ addr_test1qz8...h7q3xhdsk│ 1,500,000 lovelace ┆ - │
└───┴──────────────────────────┴────────────────────────┴───────┘
Witnesses
VKey signatures: 2
Fetching Real Transactions
Use Koios API to fetch CBOR from mainnet/testnet:
# Mainnet
| | |
# Preprod testnet
| | |
Pro tip - Add this to your .bashrc:
# Usage: cqtx <tx_hash> [query] [flags]
# cqtx 31ed9234a830667a0152fbfe4a244f896f5aad459831a5620571465283ec5f0c
# cqtx 31ed9234... fee --ada
Supported Certificate Types
Babbage Era
StakeRegistration,StakeDeregistration,StakeDelegationPoolRegistration,PoolRetirement
Conway Era (Governance)
RegCert,UnregCertVoteDelegCert,StakeVoteDelegCertStakeRegDelegCert,VoteRegDelegCert,StakeVoteRegDelegCertAuthCommitteeHotCert,ResignCommitteeColdCertRegDrepCert,UnregDrepCert,UpdateDrepCert
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Validation failed (invalid CBOR/transaction) |
| 2 | Parse error |
| 3 | I/O error (file not found, etc.) |
| 4 | Query error (field not found, index out of bounds) |
Comparison with Alternatives
| Feature | cq | cardano-cli | CQUISITOR | cbor.me |
|---|---|---|---|---|
| Offline | Yes | Yes | No | No |
| Query syntax | Dot notation | Flags | GUI | N/A |
| JSON output | Yes | Yes | No | No |
| Scriptable | Yes | Yes | No | No |
| Pretty output | Yes | Limited | Yes | Yes |
| Install | cargo install |
Heavy | Browser | Browser |
Building from Source
Requirements
- Rust 1.85+ (edition 2024)
- No system dependencies
Running Tests
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Run
cargo testandcargo clippy - Submit a PR
License
MIT License - see LICENSE for details.
Acknowledgments
- CML (Cardano Multiplatform Lib) for Cardano type parsing
- Inspired by the excellent jq tool