{"id":13470986,"url":"https://github.com/polkascan/py-substrate-interface","last_synced_at":"2025-03-26T12:32:17.086Z","repository":{"id":38553751,"uuid":"180998078","full_name":"polkascan/py-substrate-interface","owner":"polkascan","description":"Python Substrate Interface","archived":false,"fork":false,"pushed_at":"2024-10-15T08:20:14.000Z","size":4613,"stargazers_count":241,"open_issues_count":36,"forks_count":116,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-10-30T02:57:53.232Z","etag":null,"topics":["blockchain","client","interface","polkadot","polkascan","python","substrate"],"latest_commit_sha":null,"homepage":"https://polkascan.github.io/py-substrate-interface/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polkascan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2019-04-12T11:52:31.000Z","updated_at":"2024-10-27T23:04:49.000Z","dependencies_parsed_at":"2024-03-29T11:27:52.301Z","dependency_job_id":"4806618c-aed8-4c9e-a6f9-51aca92d19b2","html_url":"https://github.com/polkascan/py-substrate-interface","commit_stats":{"total_commits":421,"total_committers":16,"mean_commits":26.3125,"dds":0.4774346793349169,"last_synced_commit":"6670599cf5e3fcfac139658bc1841057d57f59b9"},"previous_names":[],"tags_count":138,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polkascan%2Fpy-substrate-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polkascan%2Fpy-substrate-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polkascan%2Fpy-substrate-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polkascan%2Fpy-substrate-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polkascan","download_url":"https://codeload.github.com/polkascan/py-substrate-interface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245654394,"owners_count":20650857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["blockchain","client","interface","polkadot","polkascan","python","substrate"],"created_at":"2024-07-31T16:00:38.131Z","updated_at":"2025-03-26T12:32:16.418Z","avatar_url":"https://github.com/polkascan.png","language":"Python","funding_links":[],"categories":["🛠️ Libraries \u0026 Standards","Client Libraries","Libraries"],"sub_categories":["Testnets","Multisig Wallets"],"readme":"# Python Substrate Interface\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/polkascan/py-substrate-interface/unittests.yml?branch=master)](https://github.com/polkascan/py-substrate-interface/actions?query=workflow%3A%22Run+unit+tests%22)\n[![Latest Version](https://img.shields.io/pypi/v/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)\n[![License](https://img.shields.io/pypi/l/substrate-interface.svg)](https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE)\n\n\n## Description\nThis library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics, \nSCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of \nthe Substrate runtime.\n\n## Documentation\n\n* [Library documentation](https://polkascan.github.io/py-substrate-interface/)\n* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://polkascan.github.io/py-substrate-metadata-docs/)\n\n## Installation\n```bash\npip install substrate-interface\n```\n\n## Initialization\n\n```python\nsubstrate = SubstrateInterface(url=\"ws://127.0.0.1:9944\")\n```\n\nAfter connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At \nthe moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For \nolder or runtimes under development the `ss58_format` (default 42) and other properties should be set manually. \n\n## Quick usage\n\n### Balance information of an account\n```python\nresult = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'])\nprint(result.value['data']['free']) # 635278638077956496\n```\n### Create balance transfer extrinsic\n\n```python\ncall = substrate.compose_call(\n    call_module='Balances',\n    call_function='transfer',\n    call_params={\n        'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',\n        'value': 1 * 10**12\n    }\n)\n\nkeypair = Keypair.create_from_uri('//Alice')\nextrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)\n\nreceipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)\n\nprint(f\"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'\")\n```\n\n## Contact and Support \n\nFor questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python), [Github Discussions](https://github.com/polkascan/py-substrate-interface/discussions) or \nreach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org).\n\n## License\nhttps://github.com/polkascan/py-substrate-interface/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolkascan%2Fpy-substrate-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolkascan%2Fpy-substrate-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolkascan%2Fpy-substrate-interface/lists"}