Questions tagged [rpc]
Questions relating to custom RPC implementations or using existing RPCs to make calls to a Substrate node.
129
questions
1
vote
1
answer
130
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::...
2
votes
2
answers
154
views
Best way to query multiple blocks via chain RPC endpoint?
Currently there does not seem to be an easy way to query the content of multiple blocks in the same RPC operation, I guess for spam protection reasons?
What is then the best way to know how many ...
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,
...
5
votes
1
answer
106
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 ...
2
votes
1
answer
78
views
exposing RPC/ws publicaly
I want to expose an RPC/WS endpoints publicly. What mesures should I take into consideration?
Should I just expose RPC/WS using substrate options --unsafe-rpc-external --unsafe-ws-external?
But as I ...
1
vote
0
answers
30
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
9
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
1
answer
52
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
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 ...
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. ...
0
votes
1
answer
89
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 ...
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
68
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 ...
1
vote
1
answer
44
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 ...
0
votes
1
answer
31
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
1
answer
113
views
RPC connection errors(rate limits?)
How to check the rate limits of concrete RPC?
It works until some time and then starts throwing an error. I suspect it's the rate limits
I connect to the remote node. For example wss://acala-rpc....
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 ...
3
votes
1
answer
55
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.
...
5
votes
2
answers
195
views
Decode extrinsic on substrate side
hello is there a way to decode this kind of extrinsic on substrate side without polkadotJs :
extrinsics: [0402000b935b2a697f01,
...
7
votes
1
answer
102
views
How to programmatically get current unbonding information on the Polkadot relay chain?
Using either a Rust or JavaScript client library I would like to get the amount of DOT that is currently being unbonded on the relay chain.
Some staking information is available in the Polkadot JS ...
7
votes
1
answer
166
views
Is it possible to query an OCW's Off-chain storage via RPC from an external service?
I'm off-chain indexing some pallet events into my off-chain local storage using an OCW. Now, I want to be able to retrieve this data via RPC from an external service.
Is this possible? Does it require ...
4
votes
2
answers
144
views
How to update the SS58Prefix for a running node?
If I have started running a Substrate node but the ss58Format value in the chain specification .json file that is generated from using the build-spec command is not 42, how do I update the chain so ...
3
votes
2
answers
171
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(...
7
votes
2
answers
82
views
Is it ok to combine RPC node with collator together?
For a parachain is it ok to have RPC and collator in one node? If not why? I'd love to hear some deeper explanation.
3
votes
1
answer
73
views
RPC deployment Guideline
I have a question in regard to RPC node for Polkadot or Substrate.
RPC node configuration - I don't see too many information about this. Is there public information on how to setup a RPC, if there isn'...
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 ...
1
vote
1
answer
166
views
Get Metadata inside custom rpc call
Hello I am creating custom rpc call, I need metadata to be able to decode extrinsics call inside my calls.
But I don't know how to get substrate metadata inside my rpc call?
3
votes
1
answer
145
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
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 ...
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, ...
1
vote
1
answer
52
views
How to get the contract address for a events
I am using
github.com/centrifuge/go-substrate-rpc-client
And able to get list of events from each block and also able to filter it out but is there a way to identify which contract triggered the event....
0
votes
1
answer
96
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 ...
4
votes
2
answers
157
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.
2
votes
1
answer
147
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
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 '...
3
votes
1
answer
62
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>...
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": &...
5
votes
1
answer
734
views
How to add custom RPCs?
I have the template pallet in the Substrate node template.
This pallet template has a function do_something that store a value in the storage.
I would like to create an RPC call that queries that ...
0
votes
1
answer
67
views
Query returning all instances of a contract based on it's code hash?
Looking to write a call that could return all the contract addresses of ink contracts matching a code hash of the contract via RPC.
What would be the best way to go about getting the list of contract ...
3
votes
1
answer
58
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 ?
2
votes
0
answers
68
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
73
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
68
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 ...
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 ...
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 ...
12
votes
1
answer
271
views
PolkadotJS how to properly setup api for custom RPC invocation
I'm playing around with custom RPC endpoints exposed from my substrate node, but I'm encountering an issue when trying to call it with polkadotjs. Initially, my endpoint only accepted a single ...