Practical overview
When it fits
Use Cosmpy when a Python application needs to query or interact with a Cosmos-SDK-based blockchain and its documented examples match the intended operation.
Who it is for
- Python developers building applications that interact with Cosmos-SDK networks.
- Developers exploring ledger queries, token transfers, staking, smart contracts or atomic swaps.
Documented uses
- Query all coin balances for a blockchain account.
- Build workflows for token transfers or staking.
- Explore smart-contract deployment and interaction.
- Prototype atomic-swap applications.
Requirements & limits
- The library is written in Python and installed through pip.
- The balance-query example uses Fetch.ai mainnet configuration.
- The repository lists an Apache-2.0 license.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Query account balances on Fetch.ai mainnet
Use CosmPy’s documented example to query and print all balances for an account.
Before you start
- Python environment with CosmPy installed using pip3.
- The account address to query.
Steps
Install CosmPy with the command below.
pip3 install cosmpyCreate a
LedgerClientusingNetworkConfig.fetchai_mainnet().Pass the account address to
query_bank_all_balances.Iterate over the returned coins and print each coin’s amount and denomination.
Expected outcome
The example prints the queried account’s coin balances as amount-and-denomination pairs.
Guide limitations
- This recipe covers the Fetch.ai mainnet configuration shown in the example; other network configurations are not specified here.
- The example queries balances only; it does not document how to submit transactions.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 6 October 2026
- Original website title
- fetchai/cosmpy · Official homepage title · retained in its source language

