Skip to main content

Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Can't compose_call with call function limited_reserve_transfer_assets - python substrate interface?

This question relates to building the call_params for the compose_call function. I have the params for the rest correct, but have trouble building the assets attribute params? Here's a reference I ...
0 votes
1 answer
33 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 ...
0 votes
1 answer
27 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
2 votes
2 answers
137 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-...
0 votes
1 answer
40 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:...
0 votes
1 answer
102 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 ...
2 votes
1 answer
84 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 ...
1 vote
1 answer
247 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....
1 vote
1 answer
51 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 ...
2 votes
2 answers
158 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.
0 votes
1 answer
71 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 ...
0 votes
1 answer
124 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 ...
0 votes
1 answer
71 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 ...
3 votes
2 answers
174 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 ...
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 "...
1 vote
1 answer
34 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 ...
1 vote
2 answers
133 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 ...
0 votes
2 answers
111 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
2 votes
1 answer
159 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
2 votes
2 answers
361 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?
1 vote
2 answers
83 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 ...
1 vote
1 answer
319 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?
2 votes
3 answers
170 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. ...
2 votes
1 answer
238 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 ...
0 votes
1 answer
157 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", ...
1 vote
2 answers
91 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: ...
2 votes
1 answer
243 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 = ...
0 votes
1 answer
61 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 ...
1 vote
1 answer
98 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 ...
0 votes
1 answer
58 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 ...
1 vote
3 answers
255 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'}}, {'...
3 votes
1 answer
216 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 ...
1 vote
1 answer
78 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, "...
6 votes
2 answers
328 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 ...
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', ...
2 votes
1 answer
83 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.