Questions tagged [runtime-api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
6 views

jsonrpc method `payment_queryInfo` is being deprecated

I saw this polkadot API document: https://polkadot.js.org/docs/substrate/rpc/#payment and it mentioned that the payment_queryInfo is deprecated and should use api.call.transactionPaymentApi.queryInfo ...
johnhckuo's user avatar
  • 111
3 votes
0 answers
30 views

Integrating External Data into Blockchain: Can Validators Fetch and Incorporate API-sourced Data?

Is it feasible for validators to retrieve information from external APIs, particularly news data, and seamlessly incorporate it into the blockchain?
Ajit's user avatar
  • 775
1 vote
0 answers
31 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 ...
Timothée Delabrouille's user avatar
0 votes
0 answers
15 views

Why can't runtime APIs have default implementations?

I encountered a compile error error: A runtime API function cannot have a default implementation! when attempting to define a default implementation for a runtime API. Why is this not possible?
liamaharon's user avatar
0 votes
0 answers
12 views

Standalone Runtime

I want to use Substrate Runtime in my application without consensus layer (outer node). I only want to create extrinsics in memory and pass them to runtime (or FRAME) of my custom pallets to proceed. ...
Saman H. Pasha's user avatar
1 vote
1 answer
72 views

I'm struggling to understand the concept of runtime calls, RPC calls, and extrinsics in Substrate

Can someone please explain these concepts in a simplified manner and highlight their key distinctions? I would greatly appreciate any help in clarifying these concepts. I'm relatively new to Substrate ...
UPENDRA SINGH's user avatar
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. ...
0x5hmoo's user avatar
  • 167
0 votes
1 answer
21 views

Error on custom rpc in new version

Updating to new version of substrate, of the branch = "polkadot-v0.9.42", it giving error, impl<C, Block, AccountId> ProfileValidationApi<<Block as BlockT>::Hash, AccountId>...
Amiya Behera's user avatar
6 votes
1 answer
22 views

Nested runtime Api's `fn execute_in_transaction` calls no longer supported in v0.9.42?

When upgrading our codebase on top of substrate's polkadot-v0.9.42, we discovered it is no longer possible to make nested request to fn execute_in_transaction(call), from within the call. Given in ...
vanderian's user avatar
1 vote
1 answer
42 views

What's the difference between the runtime Block type and the opaque::Block type?

In a substrate runtime, take the node-template as an example, we have two definitions from Block, among other types such as BlockId but let's focus on Block.. : // runtime/src/lib.rs pub type Block = ...
Purple_Turtle's user avatar
3 votes
1 answer
64 views

How to connect the our local chain to the frontend?

I want to build a frontend for our local chain. how can we connect our local to chain to the frontend?
Deepak Chaudhary's user avatar
2 votes
0 answers
32 views

Steps to handle renaming runtime api + upgrade

I'm considering a large refactor in our substrate codebase which would involve moving large chunks of code around. This includes a runtime api. In it's destined place, the runtime api's name(both its ...
Justin Frevert's user avatar
1 vote
1 answer
37 views

Expensive runtime api: attack vector?

If i have a very expensive runtime api, that can be called via an rpc, is this a vector for a dos attack? I understand that this is an offchain query to storage and therefore should not interfere with ...
gatsey's user avatar
  • 183
1 vote
1 answer
19 views

Does sp_api::Core::execute_block return a Result? If not shall I panic when importing a bad block?

The rustdocs for execute_block indicate that it returns a Result<(), ApiError>. However, when I look at a real-world runtime like in the node template , there is no return type. So I want to ...
JoshOrndorff's user avatar
  • 1,105
2 votes
2 answers
46 views

Does RuntimeApis storage accesses counts towards PoV when called from RPC and not any extrinisc?

We have some custom RPCs that call some custom RuntimeApis that from inside our pallets expose some on chain data. I know that any access (read or write) of on-chain storage from extrinsics will ...
Aramik M's user avatar
5 votes
2 answers
203 views

How to make runtime api available from polkadot js

I declared runtime api, implemented it in runtime, but i can't call my runtime api from polkadot.js. What i need to do to be able to call it? Declaration: sp_api::decl_runtime_apis! { pub trait ...
artem's user avatar
  • 51
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 ...
kianenigma's user avatar
  • 2,614
5 votes
2 answers
143 views

Show custom RPCs/RuntimeAPIs in PolkadotJS UI

At the moment I try to figure out why PolkadotJS UI (https://polkadot.js.org/) is not able to show my custom RPC endpoints or runtime APIs. They are available in general and also available in the list ...
Janislav's user avatar
  • 319
4 votes
1 answer
71 views

Panic when Using Rayon with runtime_api in a custom RPC

Works: Use normal iteration in a custom RPC with a runtime_api() call. Goal: Use rayon parallel iteration instead. Result: Panic Working code Simplified Real Code in GitHub let api = self.client....
Wil W's user avatar
  • 433
1 vote
0 answers
62 views

Use state call to query from custom Runtime Api, Balance in frontend is not equal to Balance in Runtime

Background Our front end use state call to query custom RuntimeApi of our solo chain. We try to use state call to replace custom rpcs. Definition Balance is our chain is u128. RuntimeApi Definition ...
ironman_ch_parami's user avatar
3 votes
1 answer
102 views

Testing Custom RPC with a Mock Runtime API

I'm trying to test a Custom RPC. Let's make it a simple pass through. p_api::decl_runtime_apis! { pub trait SimpleApi<AccountId> where AccountId: Codec, { fn is_true() -&...
Wil W's user avatar
  • 433
2 votes
1 answer
108 views

unreachable` instruction executed when running overhead benchmark

for some reason running overhead benchmarks fails in our parachain. cargo run --release --features=runtime-benchmarks benchmark overhead --chain local results with following stacktrace Error: Client(...
Mateusz Nowakowski's user avatar
5 votes
2 answers
108 views

Runtime api not available just after client creation? Exported method is not found

I am trying to incorporate benchmark overhead command to our parachain. The issue i have is that runtime api methods are not available right away after client is created. https://github.com/mangata-...
Mateusz Nowakowski's user avatar
4 votes
0 answers
161 views

api.call.transactionPaymentApi.queryInfo returns partial fee 0

With the update to the Polkadot-JS api depreciating rpc.payment.queryInfo in favor for api.call.transactionPaymentApi.queryInfo I am currently trying to migrate my code over. However I used to get the ...
cooper jones's user avatar
1 vote
0 answers
44 views

Why isn't the state root checked on the client side?

Substrate requires that every header has a state root. (See Trait Header.) When the runtime executes a block authored by a peer, it is assumed that the runtime will check the state root from the ...
JoshOrndorff's user avatar
  • 1,105
1 vote
1 answer
361 views

Simple runtime call in Rust

I am building a somewhat generic client for Substrate-based chains in Rust using the subxt crate. To learn about runtime calls, my goal was to call the core.version runtime API directly using the RPC ...
wigy's user avatar
  • 375
3 votes
1 answer
132 views

Provide more details about the compilation target of Polkadot's wasm runtime

I am trying to compile my own runtime, as PoC, but I don't use Rust's toolchain and some things are unclear how to do it at the moment. With Substrate, you can write your blockchain logic in any ...
user2862's user avatar
  • 309
3 votes
0 answers
59 views

Ways to mock client + custom runtime api from client side

I have some code in a Substrate client that needs to call one of my runtime apis. I'd like an easy way to mock the client and custom runtime api functions to check that they're called. Is there an ...
Justin Frevert's user avatar
2 votes
1 answer
41 views

Why is `initialize_block` in the `Core` runtime API (as opposed to `BlockBuilder`)?

Every Substrate runtime implements several Runtime APIs. Two essential ones are the Core and BlockBuilder APIs. The Core API is for executing blocks, a task that will be performed by all nodes. A ...
JoshOrndorff's user avatar
  • 1,105
3 votes
1 answer
83 views

Why do runtime APIs have a block_height parameter on the client side but not on the runtime side?

Runtime APIs are declared using the decl_runtime_api! macro. This is typically in a primitives crate. For example: decl_runtime_apis! { pub trait ExampleApi { fn get_info(param1: u32, ...
JoshOrndorff's user avatar
  • 1,105