Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

Async operations with substrate library in python

I am curious, does the current python library support Async operations ? For some reason, I am getting an Aenter error when calling the substrate in python library. Thanks
PutsandCalls's user avatar
2 votes
2 answers
115 views

Historical Balance of Polkadot Accounts (python substrate)

Is there a way to retrieve the historical balance of a Polkadot account without the need to query every individual block? My current approach involves querying blocks in batches, but it's quite time-...
data-adventure's user avatar
0 votes
1 answer
38 views

Create Balance Transfer using a Proxy

I am trying to initiate a balance transfer call using a proxy with the 'Any' type. I'm using the Python API, which allows me to create and submit the transaction successfully. However, it fails (https:...
slickfive's user avatar
0 votes
1 answer
24 views

Query Tokens.Accounts storage function using py-substrate-interface

I'm trying to fetch asset balances in accounts for various assets using py-substrate-interface. I know I can query the Tokens.Accounts storage function but I'm not sure which params I need to pass to ...
Pranay's user avatar
  • 141
0 votes
1 answer
81 views

Scalecodec: How can I get the equivalent of Decode in Python, instead of DecodeAll?

When using the Python script: timestamp = ScaleDecoder.get_decoder_class('Timestamp', ScaleBytes(timestamp_bytes_array)).decode() it seems that the decoder expects the size of the array to be exactly ...
The Quantum Physicist's user avatar
2 votes
1 answer
76 views

Error calling smart contract with py-substrate-interface

I am using substrate-contracts-node. I've uploaded and instantiated the smart contract. I would like to interact and query the function using py-substrate-interface. However, I ran into an error while ...
BHappy's user avatar
  • 45
1 vote
1 answer
46 views

Pagination issues in py-substrate-interface

It is not clear how to use pagination in py-substrate-interface. In the sample code below, there are only 32 records so all the query should be complete, but result.loading_complete shows false. from ...
Roger J Bos CFA's user avatar
2 votes
2 answers
153 views

List of assets on Statemint

How do I get the list of all the assets that are present and their supply in Statemint? Ideally either with Polkadot-JS api or py-substrate-interface.
Pranay's user avatar
  • 141
0 votes
1 answer
68 views

Get a block based on timestamp from python substrate interface

Is it possible to get either block_number or block_hash of the nearest block for a given timestamp from python substrate interface? For example if i pass timestamp of 2022-11-28 10:00:00 (+UTC) I ...
Pranay's user avatar
  • 141
0 votes
1 answer
68 views

How to start a local substrate node using python substrate interface

I am using python substrate Interface (https://github.com/polkascan/py-substrate-interface) to interact with the substrate node. How to start my local substrate-node-template using python for ...
Syed Kamran's user avatar
0 votes
1 answer
119 views

How to submit a transaction form the root/sudo acount using python substrate interface

I am using Python Substrate Interface (https://github.com/polkascan/py-substrate-interface) to interact with the substrate node. I need to execute Pallet::Balances::force_transfer function, this ...
Syed Kamran's user avatar
3 votes
2 answers
155 views

Accessing historical data for validators from the API

I have been trying to pull the validator-level data for Polkadot for a project I am working on. I am using this API and have been unable to find a command I need. Ideally, the request URL would either ...
TG_hence's user avatar
1 vote
1 answer
31 views

Why do are some events in a block missing an extrinsic_idx?

Using py-substrate-interface to parse block data, we noticed that some events return None for the extrinsic_idx parameter. Would someone please be so kind to explain why an event wouldn't have an ...
olliecorbs's user avatar
1 vote
2 answers
127 views

Is that possible to implement bridge to send USDT from statemint to other parachains?

I have tried to explore https://github.com/polkascan/py-substrate-interface, but didn't find any example, so I am wondering if I want to send asset like USDT from statemine parachain to another ...
DrCao's user avatar
  • 11
0 votes
2 answers
105 views

How to subscribe the new pending transaction of polkadot in substrate python

How can i subscribe to the new pending transactions of polkadot by using substrate interface python
Shahbaz Ali's user avatar
2 votes
2 answers
305 views

How we can Create Wallet / Generate address in polkadot

I want to Create Wallet / Generate address like in ethereum we use web3.py but how could I do same thing in polkadot by using python?
Shahbaz Ali's user avatar
1 vote
1 answer
297 views

How to query transaction details by using the transaction hash on polkadot by using python

Is there something equivalent to w3.eth.getTransaction(txHash), for Substrate based chains using python?
Shahbaz Ali's user avatar
2 votes
3 answers
156 views

JSON-RPC getBlockHash Request

I am trying to request a block hash for a specific block using the Polkadot JSON-RPC but no matter how I construct the request (with Python), it always returns the latest block and not the one I want. ...
Teodor's user avatar
  • 21
1 vote
2 answers
79 views

Python substrate-interface discovering which params need to be passed into query function for parallel API?

I am trying to find the correct parameters to pass into the query function for the substrate interface module when interacting with the parallel api to interact with their AMM. I attempted to modify ...
travnado300's user avatar
1 vote
1 answer
228 views

How to convert ss58 address to a different parachain in py-substrate-interface

I have code to convert ss58 address to a different parachain using polkadot{js}, such as below: const { Keyring } = require("@polkadot/keyring"); const keyring = new Keyring(); keyring....
Roger J Bos CFA's user avatar
0 votes
1 answer
137 views

How to decode RPC results using Python's Scale library

I'm trying to get the chain state information from substrate using RPC for IdentityOf of any Accountid Upon succesfull request, I get the following result: { "jsonrpc": "2.0", ...
Faisal Ahmed's user avatar
1 vote
2 answers
87 views

How to determine what parameter to pass into substrate.query() to query a storage_function from polkascan's py-substrate-interface?

I am trying to use py-substrate-interface to query the acalaOracle.value for Acala/Karura. Below I show a screenshot of how to get the data using polkadot{js}. Here is the python code I am trying: ...
Roger J Bos CFA's user avatar
2 votes
1 answer
222 views

How to get the balance for a specific account using py-substrate

The following code will return the balance for a few random accounts? How would I pass in a specific account that I am interested in? url = 'wss://karura.polkawallet.io' substrate = ...
Roger J Bos CFA's user avatar
1 vote
1 answer
87 views

How to perform RPC call system.properties() using py-substrate-interface?

Is there a way to the RPC call output of system.properties() using the py-substrate-interface? I want to access the token name and decimals as shown below (based on this link) { ss58Format: 2 ...
Roger J Bos CFA's user avatar
0 votes
1 answer
47 views

How do I best calculate angle differences when crossing the 360 axis? (Python) [closed]

I am trying to calculate the total number of turns of a vehicle over time to be a feature in the prediction of accident likelihood. Unfortunately, I am having issues solving the problem of crossing ...
user2506's user avatar
0 votes
1 answer
57 views

Use Ledger For ECDSA Signature in Python Substrate Interface

I'm trying to create a KeyPair class instance (https://github.com/polkascan/py-substrate-interface/blob/master/substrateinterface/base.py) from a Ledger hardware wallet. Does anyone know how to do ...
kayolord's user avatar
3 votes
1 answer
199 views

How to obtain the staking amount for non-active validators?

Using substrate-interface I'm trying to get the amount of DOT in staking for non-active validators, those that are waiting. I can get the active validators' amount by using the storage_function ...
Saccharo's user avatar
1 vote
3 answers
232 views

0x02000000 Being Returned in Extrinsic Receipt and Failing Error Module Indexing

When submitting a stake request through the Python substrate-interface library, the extrinsic receipt comes back with the following parameters: ({'Module': {'index': 6, 'error': '0x02000000'}}, {'...
kayolord's user avatar
6 votes
2 answers
299 views

Get account transactions using Substrate API

I think Substrate API is really messy and difficult to understand. How could I get all the transactions for an account? And getting account by address is also counterintuitive: you need to make a ...
Holmes's user avatar
  • 63
1 vote
0 answers
52 views

How to solve " ValueError: Element count of value (1) doesn\'t match type_definition (2)" when I teleport ksm in kusama to ksm in statemine? [duplicate]

I want to teleport the ksm in kusama to ksm in statemine. I use the code call = _substrate.compose_call( call_module='XcmPallet', call_function='limited_teleport_assets', ...
Jack's user avatar
  • 61
2 votes
1 answer
140 views

Can generate an address by mnemonic with the sdk substrate-interface?

I want to generate an kusama address. The substrate-interface can make it?Or how to generate an ss58 format address by python
Jack's user avatar
  • 61
1 vote
1 answer
75 views

How to solve the issue"Element "asset_id" of struct is missing in given value" when I send a token transaction

I send the transaction using the substrate interface. I get the key pair and call: call_module = "Assets" call_function = 'transfer' call_params = { "id": asset_id, "...
Jack's user avatar
  • 61
2 votes
1 answer
79 views

How to get the token balance(rmrk) by py-substrate?

I want to get the token balance of RMRK in the chain statemine with py-substrate.
Jack's user avatar
  • 61
0 votes
1 answer
87 views

Retrieve reason of fail substrate rpc call

I would like to know if there is a way for understanding why a rpc call via python substrate-interface is failing. On my case, I'm using python substrateinterface lib. And in function "...
Nadav Sagie's user avatar
2 votes
1 answer
217 views

How to determine which parameters are required when using substrate.query() to query a storage_function from polkascan's py-substrate-interface?

When querying storage functions using Polkascan's py-substrate-interface how do you figure out which parameters are required? For example, I am trying to discern how much KSM is on Karura via storage ...
olliecorbs's user avatar