{"id":23456,"library":"cosmpy","title":"cosmpy","description":"A Python library for interacting with Cosmos SDK-based blockchains. Supports transaction creation, signing, and querying. Current version 0.11.2 (latest stable), with release candidates for 0.12.0 targeting Cosmos SDK v0.53.4. Release cadence is irregular, with several minor versions per year.","status":"active","version":"0.11.2","language":"python","source_language":"en","source_url":"https://github.com/fetchai/cosmpy","tags":["cosmos","blockchain","cosmos-sdk","crypto","web3"],"install":[{"cmd":"pip install cosmpy","lang":"bash","label":"stable"}],"dependencies":[],"imports":[{"note":"Common mistake is importing from cosmpy.client (missing 's').","symbol":"LedgerClient","correct":"from cosmpy.clients import LedgerClient"},{"note":"Wallet was moved from cosmpy.crypto in v0.8.","wrong":"from cosmpy.crypto import Wallet","symbol":"Wallet","correct":"from cosmpy.wallet import Wallet"},{"note":"Similar to LedgerClient, path is cosmpy.clients (plural).","wrong":"from cosmpy.client import StargateClient","symbol":"StargateClient","correct":"from cosmpy.clients import StargateClient"},{"note":"Address lives in cosmpy.crypto.address.","wrong":"from cosmpy.address import Address","symbol":"Address","correct":"from cosmpy.crypto.address import Address"}],"quickstart":{"code":"from cosmpy.clients import LedgerClient\nfrom cosmpy.wallet import Wallet\n\n# Connect to a Cosmos node\nclient = LedgerClient(\"https://rpc.cosmos.network:26657\")\n\n# Create a wallet from a mnemonic (use env var for security)\nimport os\nmnemonic = os.environ.get(\"MNEMONIC\", \"\")\nwallet = Wallet.from_mnemonic(mnemonic)\n\n# Query balance\nbalance = client.query_bank_balance(wallet.address(), \"uatom\")\nprint(balance)","lang":"python","description":"Connect to a Cosmos node, create a wallet from a mnemonic, and query a balance."},"warnings":[{"fix":"Use 'from cosmpy.clients import LedgerClient'.","message":"Import path for clients is cosmpy.clients (plural). Many examples show 'cosmpy.client' which does not exist.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Use 'from cosmpy.wallet import Wallet'.","message":"Wallet class moved from cosmpy.crypto to cosmpy.wallet in v0.8.0.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Use 'from cosmpy.clients import StargateClient' instead.","message":"The 'LedgerClient' is not available in v0.12.0rc* (replaced by 'StargateClient'). If you upgrade to v0.12.0rc, update imports.","severity":"gotcha","affected_versions":"0.12.0rc0,0.12.0rc1"},{"fix":"Check the chain's coin denom (e.g., 'uatom', 'uosmo', etc.).","message":"When querying balances, the denomination string must match the chain's coin type (e.g., 'uatom' for Cosmos Hub). Using a wrong denomination returns zero or error.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the RPC URL is correct and the node is accessible. Use client.ping() to test connectivity.","message":"Transaction broadcasting requires a client with a valid connection. Timeout errors often occur if RPC endpoint is unreachable.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from cosmpy.clients import LedgerClient' (plural).","cause":"Wrong import path (singular 'client' does not exist).","error":"ModuleNotFoundError: No module named 'cosmpy.client'"},{"fix":"Use 'from cosmpy.wallet import Wallet'.","cause":"Wallet was moved to cosmpy.wallet in v0.8.0.","error":"AttributeError: module 'cosmpy' has no attribute 'Wallet'"},{"fix":"Use the proper micro-denomination string (e.g., 'uatom').","cause":"Denomination must be the smallest base unit (e.g., uatom, not atom).","error":"ValueError: Invalid denomination: \"atom\" (expected micro-denom like \"uatom\")"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}