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
7
votes
1 answer

What is the difference between Free Balance, Reserved Balance, Locked Balance, Vesting Balance, etc...?

In the Substrate blockchain development framework, the FRAME Balances pallet references 4 different kinds of balance: Free Balance Reserved Balance Locked Balance Vesting Balance What are the differences between these different types of balances,…
Shawn Tabrizi
  • 12,206
  • 1
  • 38
  • 69
6
votes
0 answers

How to use origin value in substrate pallet

The ensure_signed function of pallets/template/lib.rs contains a parameter named origin of type OrginFor<>. I have been looking inside various projects and all I see is doing ensure_signed(origin)?. My question is how actually should I get something…
Sudip Ghimire
  • 677
  • 6
  • 15
6
votes
1 answer

Substrate: How to validate the originator of unsigned extrinsics?

I need to be able to identify the source of an unsigned extrinsic for spam prevention purposes. Assume there is a set of known authorities from whom I am willing to accept an unsigned extrinsic. I want to check that the sender of the unsigned…
user1878986
  • 163
  • 4
6
votes
1 answer

In Substrate, what's the difference between `spec_version` and `authoring_version`?

Each Substrate runtime has a RuntimeVersion. The fields in this RuntimeVersion struct indicate when various aspects of the runtime change and each field has its own semantics described in those docs. I'm not sure what authoring_version means and…
JoshOrndorff
  • 1,591
  • 9
  • 19
6
votes
1 answer

Offchain Workers & Signed Transactions

It's stated that fn offchain_worker function is called every time by all nodes after a block import. Imagine the case where in fn offchain_worker we make a http call to fetch some not deterministic value from a remote server, and once we get the…
Dan Forbes
  • 2,734
  • 3
  • 30
  • 60
6
votes
4 answers

How to print out tracing message in Substrate runtime development

When working on Parity Substrate runtime development, how can I print out debug message for tracing and inspecting my variables?
Jimmy Chu
  • 972
  • 8
  • 27
6
votes
1 answer

Substrate has runtime versioning. What is the purpose and use case for these?

In the main lib.rs of substrate's runtime, (and also in the template node) there are several version attributes which can be changed - I'm guessing for tracking various build versions - but it's not clear how we are to use these in our own projects.…
T9b
  • 3,312
  • 5
  • 31
  • 50
6
votes
1 answer

What order is `on_initialize` invoked across different modules in a Substrate runtime?

I need to be sure that the on_initialize handler for a specific module runs before the same handler before all other modules in my runtime. a) How do ensure this? b) Is there some compile or runtime check I can enforce to absolutely guarantee that…
Bedeho Mender
  • 211
  • 1
  • 3
5
votes
3 answers

Substrate tutorials - trait `MaxEncodedLen` is not implemented for `Vec`

Presently, in working through the substrate tutorials, I've got to the "Build the runtime with your new pallet" section. With files updated and double checked as per the tutorial. I'm getting the following error on pre-build check (the previous…
Lee
  • 29,398
  • 28
  • 117
  • 170
5
votes
2 answers

Is it possible to create a blockchain with probabilistic finality with substrate?

Substrate depends on finality for its block production by default. Looking also into the application database layer with blocks, it seems that block reverting isn't normally possible with arbitrary depth. Does that mean it's impossible to have…
The Quantum Physicist
  • 24,987
  • 19
  • 103
  • 189
5
votes
1 answer

The relation between using `std` and `no_std` attributes and including WASM

I've just started to study substrate, and the Add a Pallet tutorial already has me seriously confused: It is important to note that the Substrate runtime compiles to both a native Rust std binary and a WebAssembly (Wasm) binary. For more…
mkl
  • 635
  • 1
  • 6
  • 16
5
votes
1 answer

Substrate genesis blocks not matching

I am currently doing this tutorial. When I am following it as described and execute the alice and bob nodes both on the same machine it works as expected: the nodes are connecting and are creating and finalizing blocks. Now I want to get the same…
5
votes
1 answer

How do I update my token's name in Substrate?

I have set up a custom Substrate chain, and I want to modify the display name of my token. What do I need to modify such that Polkadot JS and other APIs can discover my token name? By default it is "Unit".
Shawn Tabrizi
  • 12,206
  • 1
  • 38
  • 69
5
votes
1 answer

Transaction Failed: Error: 1014: Priority is too low: (515000139 vs 515000139)

I play with https://github.com/substrate-developer-hub/substrate-node-template and I want to make transaction like: But I got: Transaction Failed: Error: 1014: Priority is too low: (515000139 vs 515000139): The transaction has too low priority to…
Tomasz Waszczyk
  • 2,680
  • 5
  • 35
  • 73
5
votes
1 answer

How can I save string value on Substrate

I want to save "String" Value on Substrate At First, I use "Vec" But It's not recognized by Polkadot JS I use "Bytes",So I get the below error How can I solve this problem? Please help me. Is it correct to use "Bytes" as a way to store…
s.Takahashi
  • 469
  • 4
  • 15
1
2
3
39 40