{"id":42254630,"url":"https://github.com/bandprotocol/pyband","last_synced_at":"2026-01-27T05:18:37.576Z","repository":{"id":43813883,"uuid":"362702118","full_name":"bandprotocol/pyband","owner":"bandprotocol","description":"A Python SDK that offers a comprehensive set of features for interacting with BandChain","archived":false,"fork":false,"pushed_at":"2025-03-27T09:04:45.000Z","size":1742,"stargazers_count":14,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-08T20:29:03.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bandprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-29T05:37:45.000Z","updated_at":"2025-08-05T09:11:02.000Z","dependencies_parsed_at":"2023-01-22T20:45:26.198Z","dependency_job_id":"46b4da68-7940-44c3-8785-579b0b2aadc6","html_url":"https://github.com/bandprotocol/pyband","commit_stats":{"total_commits":256,"total_committers":14,"mean_commits":"18.285714285714285","dds":0.76953125,"last_synced_commit":"cd8413944df4e952ecc97972dbaeef5c074be843"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bandprotocol/pyband","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fpyband","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fpyband/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fpyband/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fpyband/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bandprotocol","download_url":"https://codeload.github.com/bandprotocol/pyband/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fpyband/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28803650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-27T05:18:36.904Z","updated_at":"2026-01-27T05:18:37.571Z","avatar_url":"https://github.com/bandprotocol.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch2\u003ePyBand\u003c/h2\u003e\n    \u003cblockquote\u003eBandChain Python Library\u003c/blockquote\u003e\n\u003c/div\u003e\n\nPyband is a library that is used to interact with BandChain through the `gRPC` protocol. Querying data and sending\ntransaction can be done here!\n\n## ⭐️ Features\n\nThis helper library allows users to interact with BandChain.\n\nPyBand supports the following features:\n\n- Getting the information of a specific oracle script, data source, and request ID.\n- Getting the account information of specific address.\n- Getting the latest request for a specific oracle script with its matching calldata and validator ask_count and\n  min_count.\n- Querying all the reporters associated with a specific validator.\n- Seeing what client_id you are using and getting BandChain's latest block data.\n- Able to send transaction in 3 modes: block mode, async mode, and sync mode.\n\n## 📦 Installation\n\nThis library is available on [PyPI](https://pypi.org/project/pyband/)\n\n```bash\npip install pyband\n```\n\n## 💎 Example Usage\n\nThe example below shows how this library can be used to get the result of the latest request for the price of any\ncryptocurrency. In this example, we will get the latest price of BTC on BandChain's testnet.\n\nThe specified parameters are:\n\n- `oracleScriptID`: 111\n- `calldata`: The hex string representing the [OBI](\u003chttps://github.com/bandprotocol/bandchain/wiki/Oracle-Binary-Encoding-(OBI)\u003e)-encoded value of `{'symbols': ['BTC'], 'multiplier': 100000000}`\n- `minCount`: 10\n- `askCount`: 16\n\n```python\nimport asyncio\n\nfrom pyband import Client, PyObi\n\n\nasync def main():\n    grpc_url = \"laozi-testnet6.bandchain.org\"\n    c = Client.from_endpoint(grpc_url, 443)\n\n    oid = 111\n    calldata = \"00000001000000034254430000000005f5e100\"\n    min_count = 10\n    ask_count = 16\n\n    req_info = await c.get_latest_request(oid, calldata, min_count, ask_count)\n    oracle_script = await c.get_oracle_script(oid)\n    obi = PyObi(oracle_script.schema)\n\n    # Converts the calldata into a readable syntax\n    print(obi.decode_input(bytes.fromhex(calldata)))\n\n    # Prints the result\n    print(obi.decode_output(req_info.request.result.result))\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\nBelow is the results of the example above.\n\n```\n{'symbols': ['BTC'], 'multiplier': 100000000}\n{'rates': [1936488410000]}\n```\n\nThis example shows how to send a transaction on BandChain using block mode.\n\n```python\nimport asyncio\nimport os\n\nfrom pyband import Client, Transaction, Wallet\nfrom pyband.messages.cosmos.bank.v1beta1 import MsgSend\nfrom pyband.proto.cosmos.base.v1beta1 import Coin\n\n\nasync def main():\n    # Create a GRPC connection\n    grpc_url = \"laozi-testnet6.bandchain.org\"\n    c = Client.from_endpoint(grpc_url, 443)\n\n    # Convert a mnemonic to a wallet\n    wallet = Wallet.from_mnemonic(os.getenv(\"MNEMONIC\"))\n    sender = wallet.get_address().to_acc_bech32()\n\n    # Prepare a transaction's properties\n    msg_send = MsgSend(\n        from_address=sender,\n        to_address=\"band19ajhdg6maw0ja0a7qd9sq7nm4ym9f4wjg8r96w\",\n        amount=[Coin(amount=\"1000000\", denom=\"uband\")],\n    )\n\n    account = await c.get_account(sender)\n    account_num = account.account_number\n    sequence = account.sequence\n\n    fee = [Coin(amount=\"50000\", denom=\"uband\")]\n    chain_id = await c.get_chain_id()\n\n    # Step 4 Construct a transaction\n    txn = (\n        Transaction()\n        .with_messages(msg_send)\n        .with_sequence(sequence)\n        .with_account_num(account_num)\n        .with_chain_id(chain_id)\n        .with_gas(2000000)\n        .with_fee(fee)\n        .with_memo(\"\")\n    )\n\n    # Sign and broadcast a transaction\n    tx_block = await c.send_tx_sync_mode(wallet.sign_and_build(txn))\n\n    # Converting to JSON for readability\n    print(tx_block.to_json(indent=4))\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## 🧀 Notes\n\nFor more examples, please go to [`examples`](/examples/request_data_example.py).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandprotocol%2Fpyband","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbandprotocol%2Fpyband","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandprotocol%2Fpyband/lists"}