Questions tagged [rpc]
Questions relating to custom RPC implementations or using existing RPCs to make calls to a Substrate node.
130
questions
0
votes
0
answers
7
views
is the endpoint TransactionPaymentApi_query_info usable on current Westend testnet?
I was trying to query payment_queryInfo on current Westend testnet, and the following payload used to works at spec 9430.
{
"jsonrpc": "2.0",
"method": "...
1
vote
0
answers
43
views
How are the node threads and tasks managed?
When we run a node, we start a bunch of tasks using task_manager.spawn_handle() or task_manager.spawn_essential_handle().
From my understanding, those spawn new Tokio tasks.
If my computer has ...
0
votes
0
answers
11
views
Does Substrate support custom node specific environment vars or flags
I have a pallet that should have access to a secp256k1::Keypair for signing messages. And I want to be able to start the node with either the secret_key string or a path to a key-file. Then have the ...
0
votes
0
answers
13
views
Adding RPC node in private network without node authorization
I have set up a private network and it has node_authorization pallet included. I have added several validator nodes by using the node_authorization pallet as well_known nodes.
Now I want to allow some ...
0
votes
0
answers
38
views
Implementing FullDeps in Substrate rpc.rs using channels instead of Arcs
This is a standard implementation of FullDeps in the rpc.rs:
// Full client dependencies.
pub struct FullDeps<C, P, SC, B> {
/// The client instance to use.
pub client: Arc<C>,
...
1
vote
0
answers
23
views
how to solve mismatched type error in substrate?
I have been integrating paritytech frontier(0.9.43) version with the substrate 0.9.43 version . while integrating when i added frontier changes in rpc.rs and service.rs file i am facing this error. ...
2
votes
0
answers
31
views
RPC node is rebooting itself from time to time
Node is working correct but there is a moment that shows the following error messages and reboots:
2023-10-12 19:39:26 Accepting new connection 170/10000
2023-10-12 19:39:26 Accepting new connection ...
1
vote
0
answers
18
views
How to curl `ink!` contract storage?
I'm trying to use curl to query an ink contract's storage using the RPC of substrate. I've looked at the below question
How do I call the RPC method `contractInfoOf` using curl?
but it does not ...
0
votes
1
answer
92
views
Beefy justification subscription is not working
I would like to subscribe to the beefy justification stream on Rococo. The rpc for getFinalizedHead works fine, but I also require the justifications themselves.
When I try to subscribe to the ...
0
votes
1
answer
32
views
AssetConversionApi (asset_conversion_pallet) - How to encode function input parameters in price and reserves RPC calls?
I'm trying to use asset_conversion pallet to call quote prices, and get reserved rpc endpoints (defined here)
In pallets official docs there is small section about calling that endpoint, but it doesn'...
0
votes
2
answers
35
views
A blockchain to read events from another blockchain
I'm working on an idea where I would want my substrate-based blockchain (let's name it Blockchain A) to read events from another substrate-based blockchain (let's call it Blockchain B) and perform ...
0
votes
1
answer
70
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 ...
3
votes
1
answer
59
views
Custom RPC vs. runtime API
As a Substrate builder, I don't see any reason of still implementing custom RPCs as runtime API seems superior to me. So I was wondering about any arguments for still adding custom RPCs to the client.
...
2
votes
1
answer
54
views
Validating node, how connet to polkadot.js
For running validate nodes, through set up, now i can see my node on the telemetry. but I don't know how to connect to polkadot.js.
polka wiki says
"You can generate your Session keys in the ...
3
votes
1
answer
33
views
Off chain worker for https:// request
I have a simple question if i use off chain workers to get calls to https://somecoinexchange/ to get data for some calculation, what will be the gas usage. I was presuming that since no chain work is ...
3
votes
1
answer
148
views
How to encode an extrinsic for RPC from a web client?
I need to programmatically pack an extrinsic for an RPC, I believe I'm looking for the following front-end functionality:
extract relevant indices from the Metadata
fill the extrinsic parameters
...
5
votes
1
answer
107
views
How to implement `into_rpc` method in jsonrpsee's rpc macro
I'm trying to add custom RPC to Substrate node template.
As explained in the jsonrpsee's proc_macro doc here, I define BalancesApi trait where #[rpc(server)] attribute added, and implement ...
3
votes
2
answers
176
views
polkadot js RPC can't get u128
i have an rpc call that returns an array of structs with multiple fields, one of which is balance of an asset for a user, balance type is u128. when the number is large i get this error createType(...
4
votes
1
answer
236
views
Sign a transaction offline for Westend testnet and verification of the transaction
Could Polkadot experts execute the code below and advise me on the questions, please?
You just need to replace the code by your own Westend accounts and nonce.
import { construct, getRegistry, ...
4
votes
2
answers
164
views
Read a value from offchain storage of a node
I want to read a single value from OffchainStorage of a live substrate node. Is it possible? Assume I can not use localStorageGet rpc request because it is an unsafe rpc.
3
votes
1
answer
64
views
When will I stop receiving TransactionStatus updates for a transaction submitted via author_submitAndWatchExtrinsic?
If I submit a transaction via "author_submitAndWatchExtrinsic", I start getting back TransactionStatus updates, which look like one of these:
pub enum TransactionStatus<Hash, BlockHash>...
0
votes
1
answer
99
views
how to fix transactionPaymentApi.queryInfo runtime call issue?
api.tx.balances.transfer(recipient, new BN(txAmount)).paymentInfo(sender)
When I call paymentinfo to get a transaction fee, I got this error.
Error: The transactionPaymentApi.queryInfo runtime call is ...
2
votes
1
answer
50
views
Calculate total staked & rewarded for validation per era/block
Is there an elegant way to get the total amount staked & rewarded for each era/block?
Right now I get a list of staking.Bonded data from Subscan:
{
"code": 0,
"message": &...
1
vote
1
answer
137
views
Parachain RPC errors since Polkadot 0.9.36 client upgrade
Astar uplifted to Polkadot 0.9.36 in v4.47.1
Client upgrade introduces 2 new errors on RPC nodes, both WS and HTTP.
HTTP: lots of these errors - seems high impact
HTTP serve connection failed hyper::...
1
vote
1
answer
46
views
Iterate storage maps inside an offchain worker
I need to iterate over the following double map inside an offchain worker:
How can I access this map outside the pallet assets? Can I use an RPC method to get all the values for that double map ...
2
votes
0
answers
74
views
Fuzzing Polkadot produces Invalid Signature after chaos is injected
I'm using Polkadot version 0.9.37-08b1c09ca46, across 4 Nodes - Alice, Bob, Charlie, Dave, in a local testnet environment. I have a period of network chaos applied, and then moments of stabilized '...
0
votes
1
answer
113
views
Custom RPC sized array parameters
I have custom RPC, which looks like so
#[rpc(client, server)]
pub trait SomeRpcApi {
#[method(name = "some_submitData")]
async fn submit_data(
&self,
id: u64,
...
2
votes
0
answers
69
views
RPC apis & node entry-points
I am trying to identify all the possible entry points that an extrinsic can reach the node.
From my understanding so far the following rpc endpoints are the only ones that can add transactions to the ...
0
votes
1
answer
75
views
polkadotJS chain state system.account() include option false, how to rebuild with RPC?
I'm trying to parse the whole storage from a node with the encoded partial key through RPC, it seems to be doable with polkadotJS see the picture in one call.
The fastest approach that we currently ...
0
votes
0
answers
58
views
--listen-addr /ip4/0.0.0.0/tcp/9944/ws breaks polkadot.js
I am trying to get my westend boot nodes to also serve polkadot.js
Following https://github.com/paritytech/polkadot/issues/6208, there is a recommendation [requirement?] to run polkadot with Node was ...
0
votes
1
answer
69
views
"Cannot call send() while not connected" with RPC websocket provider
I will try to explain it briefly. I'm using Promise API to connect to few different RPCs (ws). Also I'm listening to an event connected on each websocket provider. When all providers are connected I ...
3
votes
1
answer
59
views
How to build the browser extension with substrate?
Can we make browser extension with substrate and yes and how ?
can anyone please provide the resource to read about it ?
0
votes
0
answers
37
views
Property 'x' does not exist on type 'DecoratedRpc<"promise", RpcInterface>'
I have decorated custom RPC types for methods for polkadot-js-apps. I added them in ./packages/apps-config/src/api/spec/<chain-name>.ts, (then i also needed to add it into typesBundle.js, and ...
2
votes
1
answer
63
views
How do I query the state of a contract at a given block number given the deprecation of contracts_getStorage?
The previous answer is now incorrect due to the deprecation of the RPCs.
How do we query the historic contract state now?
In the PR comment it states:
The high level contracts API in polkadot.js ...
2
votes
1
answer
43
views
How to add parachains to parity signer?
I'm setting up a metadata site for parachains. I have the github pages site working, and am currently adding parachains. I just have a few questions to make sure I do this properly.
For rpc_endpoint ...
2
votes
1
answer
149
views
required by a bound in `Methods::merge`
i gonna add custom rpc in substrate , but every time i run this command : cargo check , it show me this error :
error[E0277]: the trait bound `Methods: From<jsonrpsee_core::server::...
2
votes
1
answer
188
views
Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Invalid length prefix
Getting Error : "Verification Error: Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Invalid length prefix" While calling the custom RPC ...
3
votes
1
answer
47
views
Duplicate Lang Error When Adding Custom RPC
I am trying to add a custom rpc in Substrate, but I ran into a problem.
I have done all steps in this article:
Add custom RPC to the node
and my code is here:
https://github.com/dortajkianoush/...
2
votes
1
answer
119
views
How to retrive data stored in a block
I have stored an information on chain and I want to access that information using RPC call.
I used the following code and provided the hash created.
const signedBlock = await api.rpc.chain.getBlock(...
1
vote
1
answer
39
views
When should an RPC be unsafe?
When making a new RPC/runtime-api endpoint, what criteria should you have in mind regarding making it safe/unsafe?
For example, assume that a UI wants to fetch a large amount of data (a lot of keys in ...
3
votes
1
answer
206
views
Error: no matching package named 'pallet-contracts-rpc' found
I am trying to add the pallet-contracts-rpc dependency but keep getting this error.
'''
error: no matching package named pallet-contracts-rpc found
location searched: https://github.com/paritytech/...
0
votes
0
answers
55
views
StakerStatus is not updating on my custom explorer
I have made a custom explorer of a substrate based blockchain, and when i am chilling the staker, its status is not updating to inactive on the custom explorer, is there any RPC call or any other way ...
2
votes
1
answer
80
views
Frontier EVM integration: UnknownTransaction::NoUnsignedValidator error occurs while transferring funds via Metamask
I'm integrating Frontier EVM into my Substrate chain and facing the following issue while trying to send some funds between accounts via metamask:
[ethjs-query] while formatting outputs from RPC '{&...
4
votes
2
answers
221
views
How to decorate RPC correctly?
The rpc methods (showing in rpc_methods), are still not showing in their own area, after (attempting to) decorate the rpc.
I have custom rpc on a substrate template.
Here are the rpc_methods:
I have ...
1
vote
1
answer
239
views
Is it possible to submit an extrinsic using rpc?
Could it be possible to submit and extrinsic using JSON-RPC methods.
Say submit a balance_transfer along with its parameters using curl or postman as a JSON-RPC
1
vote
1
answer
53
views
Best way to automate extrinsic submissions for testing
I am developing a chain in substrate, and am trying to find the best way to run integration tests against certain sets of extrinsic submissions when the network is running in development mode. It's ...
2
votes
2
answers
113
views
Finding about native token of a parachain
Is there a way to query whether a chain has a native token and what it is?
For instance can I query Moonbeam, to find that it's native token is GLMR(Glimmer). Similarly for the rest of the parachains.
1
vote
1
answer
28
views
Where is the `peer_count` function?
I can't find the net::* RPC APIs under https://github.com/paritytech/substrate/tree/be259234bfee056bef970ac372e04a74411c5224/client/rpc-api.
There are three net APIs, netListening, netPeerCount and ...
0
votes
2
answers
86
views
incorrect balance response
I've created test address in westend network. Topped up it using faucet. https://westend.subscan.io/account/5FpS4PkRzLmJZcwvJM6jxPU3N3481nbnTe6nzFwwQUVvu9LF?tab=transfer. In explorer I see 1WND ...
5
votes
1
answer
104
views
Removing randomness-collective-flip pallet from runtime
We recently tried to remove pallet-randomness-collective-flip from our runtime. This pallet has been in our runtime since it was created as it was included in the template-node-runtime, but we never ...