Skip to main content

Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface

Project description

Async Substrate Interface

This project provides an asynchronous interface for interacting with Substrate-based blockchains. It is based on the py-substrate-interface project.

Additionally, this project uses bt-decode instead of py-scale-codec for faster SCALE decoding.

Installation

To install the package, use the following command:

pip install async-substrate-interface

Usage

Here are examples of how to use the sync and async inferfaces:

from async_substrate_interface import SubstrateInterface

def main():
    substrate = SubstrateInterface(
        url="wss://rpc.polkadot.io"
    )
    with substrate:
        result = substrate.query(
            module='System',
            storage_function='Account',
            params=['5CZs3T15Ky4jch1sUpSFwkUbYEnsCfe1WCY51fH3SPV6NFnf']
        )

        print(result)

main()
import asyncio
from async_substrate_interface import AsyncSubstrateInterface

async def main():
    substrate = AsyncSubstrateInterface(
        url="wss://rpc.polkadot.io"
    )
    async with substrate:
        result = await substrate.query(
            module='System',
            storage_function='Account',
            params=['5CZs3T15Ky4jch1sUpSFwkUbYEnsCfe1WCY51fH3SPV6NFnf']
        )

        print(result)

asyncio.run(main())

Contributing

Contributions are welcome! Please open an issue or submit a pull request to the staging branch.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or inquiries, please join the Bittensor Development Discord server: Church of Rao.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_substrate_interface-1.0.3.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_substrate_interface-1.0.3-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file async_substrate_interface-1.0.3.tar.gz.

File metadata

File hashes

Hashes for async_substrate_interface-1.0.3.tar.gz
Algorithm Hash digest
SHA256 da944b42aad508a6681a58b3223801013fbabc2f3d63c1e599eada4ecb53a2e9
MD5 8b1a709c1647c6f06a406c920b86c0a3
BLAKE2b-256 dad771421a4f2ecb82a0141e61dab83770c0f9b2257543ad09f8a7eb4ed3017e

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_substrate_interface-1.0.3.tar.gz:

Publisher: release.yml on opentensor/async-substrate-interface

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file async_substrate_interface-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for async_substrate_interface-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d51db230fa0c0de6f9960089faad806da773c7500727096a2659c0fd398edc92
MD5 6942a6b2840c5d0e160ac9378a002cb7
BLAKE2b-256 5da96c36e68b0b7cce2ff2a35a3a76c19e0dd2a1a6dedcf72189f6dd52b5d4a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_substrate_interface-1.0.3-py3-none-any.whl:

Publisher: release.yml on opentensor/async-substrate-interface

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page