Use this tag for questions about the Polkadot blockchain network platform. General questions about Polkadot should be asked at https://substrate.stackexchange.com
Questions tagged [polkadot]
203 questions
0
votes
1 answer
How to update state of reactjs in realtime from an polkadotjs rpc api?
const unsubHeads = await data.rpc.chain.subscribeNewHeads((lastHeader) => {
console.log(`: last block #${lastHeader.number} has hash ${lastHeader.hash}`);
});
I'm using polkadot js rpc api for updating my reactjs…

sachin murali
- 469
- 2
- 7
- 22
0
votes
1 answer
Accessing CLI values in the runtime
I have an offchain worker that reads something via http and i would like users to be able to use different urls for it. I have a custom flag in the CLI which takes this URL (something like ./target/release/substrate --custom-url http://google.com)…

Nahu
- 143
- 10
0
votes
1 answer
Cannot connect front-end template to node-template in Substrate
So, I installed everything as directed in the documentation, both the node-template and front-end template. Then, I went on to run ./target/release/node-template --dev --tmp in the node-template directory, which worked fine and was able to produce…

CoolDude789454
- 1
- 3
0
votes
2 answers
How to clean up substrate runtime compiled result and compile again
Now, The only way I used is cargo clean and then cargo build again.

boundless-forest
- 387
- 2
- 9
0
votes
0 answers
Is it possible to trigger shell command-line execution via an on-chain transaction?
I want to design an application to buy and sell machine learning models as if they were commodities.But other nodes need to agree whether the model is consistent with the uploader's description.So I'm wondering if it's possible to trigger the…

banker
- 1
0
votes
0 answers
Going through first tutorial: 'cannot access native cert store' when starting the node
I've tried to initiate my first instance of the substrate node using the Create Your First Substrate Chain tutorial.
On running the command
./target/release/node-template --dev --tmp
We got a panic
main WARN sc_cli::commands::run_cmd Running in…

Bob
- 13
- 3
0
votes
1 answer
How do I get difficulty over time from Kulupu (polkadotjs)?
// Import
import { ApiPromise, WsProvider } from "@polkadot/api";
// Construct
/*
https://rpc.kulupu.network
https://rpc.kulupu.network/ws
https://rpc.kulupu.corepaper.org
https://rpc.kulupu.corepaper.org/ws
*/
(async () => {
//const wsProvider…

chovy
- 72,281
- 52
- 227
- 295
0
votes
1 answer
What does Bad Origin mean, while trying to transfer DOTs?
I am trying to transfer DOT from one wallet to another and it's failing with "Bad Origin" message. What does that mean? How can I resolve it. I am keeping enough balance necessary as well as that's needed for transaction fees. What could be the…

Vamshi Vangapally
- 1,972
- 6
- 21
- 25
0
votes
1 answer
Getting finalised block data
I am trying to get block data (extrinsics) for finalised blocks only in the client (not runtime). I can see that there is an RPC endpoint called chain_getBlock. Am i correct in thinking that this endpoint does not filter on finalised blocks…

Nahu
- 143
- 10
0
votes
1 answer
How to read a hash value and get the corresponding AccountId from Substrate using RPC call?
I have a substrate node up and running with storage item as: value(Hash): Option. My aim is to provide the hash value (say, 0x0000000000000000000000000000000000000000000000000000000000000001 and get the corresponding account id in…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
0
votes
1 answer
How to store hashes in the Substrate Chain?
My objective is to store hash values in the substrate chain. I have declared the storage and the module for it in the following code:
use support::{decl_module, decl_storage, dispatch::Result, ensure, StorageMap};
use system::ensure_signed;
pub…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
0
votes
1 answer
What is the equivalent of OP_RETURN from Bitcoin in Substrate?
I want to write transactions where two things matter:
i) sender's address
ii) SHA 256 hash that I want to write
How can I achieve that?
I looked into Bitcoin's transaction types and found out that OP_RETURN is used to write data like transactions…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
0
votes
0 answers
How to authenticate a user on Substrate chain in Rust?
I want to verify whether a potential user is actually a user on a Substrate chain. For this purpose, I am looking for an API that would let me perform this task. While going through the tutorial, I used ensure_signed multiple times. So, I am looking…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
0
votes
1 answer
Why there are no changes in the mutability behaviour of storage values even after changing the source code of the substrate chain?
Reading about the mutability, I implemented the following piece of code in my substrate chain:
use support::{decl_module, decl_storage, dispatch::Result, ensure, StorageMap};
use system::ensure_signed;
pub trait Trait: balances::Trait…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
0
votes
1 answer
How to have immutable key-value map in Substrate?
I am writing a key: value StorageMap in substrate. I want to make it immutable such that a key is written if non-existent but if it exists:
i) if the value is the same as stored, alright
ii) invalidate the transaction.
I have written the following…

Aviral Srivastava
- 4,058
- 8
- 29
- 81