Query dApp Staking extrinsics and participating addresses with Python
TL;DR
As a Substrate-based multi-VM blockchain, Astar nodes have all Polkadot or Substrate features. Python Substrate Interface library allows developers to query Substrate-runtime-level metadata from an Astar node and interact with the node's Polkadot or Substrate features, including querying and composing extrinsics using a native Python interface.
In this guide, we will cover:
- How to install Python Substrate Interface
- How to create an API provider instance
- How to query blocks and extrinsics, using an example of querying dApp staking participants’ addresses.
What is Substrate?
Substrate is an open-source software development kit (SDK) that allows teams to quickly build highly customized blockchains. It comes with native support for connecting to Polkadot and Kusama right out of the box.
All Polkadot and Kusama parachains and relay chains are built with Substrate, this include Astar and Shiden networks. Thus, Astar nodes have all the major Polkadot or Substrate features.
What is Substrate Python Interface?
Substrate Python Interface is a Python library that specializes in interfacing with a Substrate node; querying storage, composing extrinsics, SCALE encoding/decoding, and providing additional convenience methods to deal with the features and metadata of the Substrate runtime.
For interface function reference, please read https://polkascan.github.io/py-substrate-interface/.