Questions tagged [substrate]

Substrate is a framework for blockchain prototyping and development written in Rust. General questions about Substrate should be asked on https://substrate.stackexchange.com

Substrate is a framework for prototyping and development written in . At its heart, Substrate is a combination of three technologies: , and AfG Consensus. It is both a library for building new blockchains and a skeleton key of a blockchain client, able to synchronize to any Substrate-based chain.

Substrate chains have three distinct features that make them next-generation: a dynamic, self-defining state-transition function (STF), light-client functionality from day one and a progressive consensus algorithm with fast block production and adaptive, definite finality.

The STF, encoded in WebAssembly, is known as the runtime. This defines the execute_block function and can specify everything from the staking algorithm, transaction semantics, logging mechanisms and procedures for replacing any aspect of itself or of the blockchain’s state (governance). Because the runtime is entirely dynamic, all of these can be switched out or upgraded at any time. A Substrate chain is very much a living organism.

587 questions
5
votes
1 answer

Dispatching a Function Defined in Another Substrate FRAME Pallet

I am familiar with one mechanism for achieving the goal described in this question's title: passing a dispatchable call, which is written in its own pallet, as an argument when invoking an extrinsic that is written in another pallet, as in the Sudo…
Dan Forbes
  • 2,734
  • 3
  • 30
  • 60
5
votes
1 answer

How to encode the hex string representation of an account id in Substrate using Rust?

Given a hex representation: 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d, we can get the AccountId it represents using keyring.encodeAddress() using JavaScript. However, what is the corresponding function in Rust? AccountId is…
Aviral Srivastava
  • 4,058
  • 8
  • 29
  • 81
5
votes
1 answer

How to activate Substrate GRANDPA finalization?

I want to start a chain with Babe/Grandpa consensus. I'm able to start block production using Toolbox->RPC->author->insertKey() in UI. But I don't know how to start block finalization. I've tried setting grandpa keys the same way I sat babe keys in…
5
votes
1 answer

In Substrate what does code: 1012 "Transaction is temporarily banned" mean?

The full text of the message is : {code: 1012, message: "Transaction is temporarily banned"} This would indicate that the transaction is held somewhere in Substrate Runtime mempool or something of that nature, but it is not entirely clear what…
T9b
  • 3,312
  • 5
  • 31
  • 50
5
votes
2 answers

How to get the roothash or a proof from a child trie in substrate?

According to the example here, I see one could use the srml_support::storage::child API to create a merkle sub trie out of arbitrary data. But how can we get the merkle root or a proof for a particular leaf using this? I see the API doesn't provide…
vim
  • 1,098
  • 9
  • 21
4
votes
1 answer

Why does "code" in spec not start with magic number and version number?

I am creating spec using ./polkadot build-spec --disable-default-bootnode --dev (I am running version 0.9.8-3a10ee63c-x86_64-linux-gnu) spec generated using above command contains code field. My understanding is that this field contains wasm bytes.…
4
votes
1 answer

What does T represent in a Pallet?

So every pallet type has more or less the same declaration : pub struct Pallet(_) or pub struct Pallet(PhantomData) where T: Config. My question is what does T stand for? Someone mentioned that T represents the substrate runtime which led…
RequireKeys
  • 466
  • 4
  • 15
4
votes
1 answer

Multiple substrate nodes but each only has a single peer

Following this tutorial I have a network of five nodes running, the boot node and four peers. The boot node shows four peers. Two nodes running on the same PC find each other and see two peers each. But the final two nodes show only a single peer,…
v-man
  • 51
  • 4
4
votes
0 answers

How can I subscribe to a single event using Polkadot.js API?

I want to subscribe to a single event (or a list of events) using the Polkadot.js API. However, I have only found information on how to traverse events and then filter the results. In addition, the documentation about events lists all the events…
4
votes
1 answer

How do you write a system test for your runtime?

Hi I am developing a runtime using Substrate-FRAME and I would like to know how can I write a system test for my runtime? The main purpose of writing a system test is to ensure that the final build is fulfilling all of the required specifications…
Jdawg287
  • 117
  • 5
4
votes
0 answers

Public key / Private key encryption using polkadot lib?

I'm building a substrate blockchain backed by polkadot js. While working on a task I have a requirement of public/private key encryption and decryption. for ex: Bob wants to send Alice an encrypted email. To do this, Bob takes Alice's public key and…
sachin murali
  • 469
  • 2
  • 7
  • 22
4
votes
1 answer

How to find all the polkadot accounts with index or identity attached

I want to find all the polkadot accounts which either have an index or have registered their identity; similar to https://polkascan.io/polkadot/account/identities and https://polkascan.io/polkadot/indices/account.
4
votes
1 answer

Convert Ethereum or Bitcoin address to Polkadot or Substrate-based address

I would like to convert user's Ethereum address for example(0xc5D3a7d27DbDe23A7FC5E53F1a6f17F38C03194F) to substrate based address in this case(5DXoin5qNbzKt88CxDtx86vmaCxhxYzEfEWXahTvwgYMf4Gq). I manage to do it via subkey although it is based on…
Afeez Aziz
  • 1,337
  • 2
  • 12
  • 26
4
votes
1 answer

Pruning mode for Validators

Why a validator node should always be an archive node? What are the risks and downsides of not doing so? I understand that it is probably interesting to have at least one archive node, but why all of them? If the blockchain data is kept (extrinsics…
NachoPal
  • 196
  • 4
4
votes
2 answers

Use custom types (Substrate FRAME pallet + Polkadot/Substrate frontend)

Scenario: You are developing a FRAME pallet for a custom Substrate node that uses custom types within Storage or Events. To interact with your custom Substrate node, you use the Polkadot/Substrate frontend Problem: When you query the storage that…
sea212
  • 299
  • 2
  • 12
1 2
3
39 40