Questions tagged [substrate-node-template]
Posts that reference the Substrate node template, a basic Substrate node typically used for getting started with Substrate.
512
questions
11
votes
1
answer
125
views
Understanding service.rs in substrate-node-template
Recently, I have been trying to understand the block import for Aura and Grandpa but I don't understand some parts in substrate-node-template/node/service.rs:
1- In the new_partial() method when ...
10
votes
1
answer
238
views
How to change the era period?
I believe the default era period in substrate-node-template is 24 hours. Is there a way for me to change that period?
9
votes
3
answers
190
views
Error adding Custom RPCs for pallet
I've been trying to add some rpc calls available for my node, but an error related to the 'getrandom' module appears (even tho I'm not even using it).
I have a very simple pallet that creates and ...
9
votes
1
answer
212
views
Single node performance
I've a couple of questions:
I'm running a the node-template on a machine that has 8 cores and 64GB of RAM and its using an SSD. I have some pallets working there and I'm using the python client to ...
8
votes
1
answer
271
views
`MaxEncodedLen` is not implemented for `Vec<u8>`
Here is a simple edit of the pallet/template/lib.rs that uses Vec<u8> in storage:
#![cfg_attr(not(feature = "std"), no_std)]
pub use pallet::*;
#[frame_support::pallet]
pub mod ...
8
votes
1
answer
86
views
What are the best practices for keeping chain specifications for Devnet, Testnet, and Mainnet environments?
can anybody help me to understand what questions I should address before choosing the approach for keeping the runtime configuration for Devnet/Testnet/Mainnet environments in a substrate-based ...
7
votes
2
answers
86
views
What are the differences between using declarative and attribute macros in FRAME?
What's the main difference (besides the code) between using the decl_storage! macro rule and using the [pallet::storage] macro?
I've seen pretty much everyone using macro rules, but on the latest ...
7
votes
1
answer
141
views
How to perform arithmetic operation on Option<BalanceOf<T>>?
Hello all developers and community members, I am very new to Substrate and Rust.
I am creating a pallet for NFT marketplace.
for storing out the NFT details I've created a struct as mentioned below.
...
7
votes
2
answers
109
views
How to change the number of heap pages
We are running into an allocator memory error where the number of heap pages appears to be insufficient to run a transaction on our validator (substrate-node).
This is the error in question:
2022-04-...
7
votes
1
answer
242
views
pallet loose-coupling+tight-coupling, and missing traits
The question is about both types of pallets-coupling. let's say we have 3 pallets A,B, and C.
C is tightly coupled to B (C Config is added in B Config), and we want to do a loose Coupling of A and B ...
7
votes
1
answer
229
views
usage parity-db instead of rocksdb
in the substrate-node-template case , I don't want to compile rocks-db at all. how it would be possible compile parity-db instead of rocks-db?
6
votes
6
answers
9k
views
How do I fix a failed build error [E0635]: unknown feature 'proc_macro_span_shrink'?
Following the instructions at (https://bruno.id/preparation-for-the-substrate-workshop/) until I received a build error, executing the instructions under the 'Error' heading, I received the following ...
6
votes
1
answer
258
views
How does Substrate detect the signing scheme when verifying signatures?
Substrate supports multiple signature schemes: ecdsa, sr2551, ed25519.
When sending a signed transaction how does substrate know what scheme to use for signature verification?
6
votes
2
answers
143
views
How to use substrate archive for custom chains?
In the substrate archive wiki, they showed how to archive the polkadot chain's data. Now I want to get other chains' data (like a substrate template node or Astar, Moonbeam, etc). How can I do that?
...
6
votes
1
answer
181
views
Building a substrate node template with a global cargo `target` directory
I'm trying to build a substrate-node-template with the following command:
cargo build
I have my cargo target-dir set inside a global ~/.cargo/config.toml file:
[build]
target-dir = "/home/foo/....
6
votes
1
answer
81
views
Using Go Runtime in Substrate node template
I am trying to run a local network using Substrate Node Template and have replaced the wasm runtime with one, built from Go. Unfortunately, when I start the network I get the following error:
Error: ...
6
votes
2
answers
197
views
What's the different between "Extrinsic" and "RPC" methods for pallets?
I notice that for the nicks pallet there is no need to write a custom RPC or configure that, while with the contracts pallet that need seems to be there. It also seems that in the Substrate Front End ...
6
votes
1
answer
55
views
Use of ProposalIndex in pallet-collective
What is the use of ProposalIndex in pallet-collective? However, we also have proposal_hash for identifying the proposal.
6
votes
1
answer
200
views
How to get previous block time using timestamp
How I can get the previous block time using timestamp pallet
6
votes
1
answer
93
views
What this 'grandpa-voter' error means?
I was doing last section of substrate private network tutorial.
Before i stored key set, i could started network smoothly.
But after i stored key set of aura and grandpa, i got this error.
yc6936@...
5
votes
1
answer
741
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 ...
5
votes
1
answer
118
views
How to convert substrate Specific Types(Option<BalanceOf<T>> ) to Rust Primitive types (U64)?
I don't know how can I convert Option<BalanceOf> (subtrate specific type)to u64 (rust primitive types)?
I followed this article( How do you convert between Substrate specific types and Rust ...
5
votes
1
answer
70
views
Substrate dependency management
My team is looking to implement a project in Substrate, and after some studying it seems like a dependency management nightmare.
Many of the 'sp' libraries call specific required functions within our ...
5
votes
1
answer
43
views
Gas less Transactions
Hi I am building a solo chain by using the substrate node template but i am stuck here that i wanna change the gas fee to 0 of every transaction that is happening on the chain this chain will be a ...
5
votes
1
answer
93
views
adding an account
I just want to simply add an account in the development config but have no idea how to do it, i tried simply adding the seed in the development_config function but it dosent work, what can i do to add ...
5
votes
1
answer
39
views
Hot Reloading of changes in Pallet in substrate
While developing with substrate when we make changes in pallets and want to quickly test the changes have explicitly stop existing running node and build the node template (which obviously takes time) ...
5
votes
1
answer
372
views
How do the Staking Rewards payouts work?
I've added Staking to substrate-node-template and just explored the feature. I've managed to add validators and nominators and it looks like everything is working well.
One thing I'm not able to ...
5
votes
1
answer
122
views
How to solve this error: associated type `BlockNumber` not found for `T`?
I have substrate node template with babe and i want to integrate orml-currencies.
I'm using this in cargo.toml:
orml-currencies = { default-features = false, git = "https://github.com/open-web3-...
5
votes
1
answer
79
views
Custom deposit function for Substrate runtime
As you're aware, the latest version of substrate removed the need for manual memory management, hence when creating the new SC - tokens are automatically reserved from caller's balance.
To my ...
5
votes
1
answer
1k
views
Error: failed to run custom build command for `tikv-jemalloc-sys v0.4.3+5.2.1-patched.2`
I was trying to build the substrate-node-template (https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/) for the first time. I am using WSL2 with Ubuntu 22.04 LTS.
I came to the ...
5
votes
1
answer
268
views
Build a docker file/image for my new pallet
I am using substrate-node-template and recently I added a new pallet.
Now I need to build a docker file because I would like to send it for testing.
Any information?
Thank you.
5
votes
1
answer
107
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 ...
5
votes
0
answers
118
views
Query node information from PeerId only
How do I get Listen addresses of a node (and possibly other info like agent, protocols etc..) given that I only have node's PeerId? Is there any existing solutions available for this? Simple enter ...
5
votes
0
answers
43
views
Error on Launching the First Node Following the Tutorial
I was following the substrate get started tutorial. In the "Trusted Network - Add trusted nodes", I was failed to start the first node step.
(I was using the virtual machine and the os is ...
4
votes
3
answers
263
views
How do i find the address of the treasury?
I have implemented pallet_treasury just like Kusama, how do i find the resulting address?
4
votes
1
answer
351
views
How the transaction payment pallet handles transaction fee of every extrinsic?
I was doing some experiments with Substrate Node Template. I found that for every extrinsic, user is charged with some fee. I explored
https://github.com/paritytech/substrate/blob/master/frame/...
4
votes
1
answer
157
views
Adding pallet-gilt to a running chain breaks the chain
I am running a simple 2-validator substrate chain with my own keys (https://github.com/paritytech/substrate, branch = polkadot-v0.9.27). I have removed pallet-gilt from the runtime and what I am ...
4
votes
2
answers
90
views
How to fetch all accounts in a pallet?
I need to change the balances of all the accounts in my custom pallet, For that first i need to fetch the accounts in the pallet. How to do this?
4
votes
2
answers
209
views
How to increase performance of building Substrate by "cargo build --release" command
I using Substrate-template-node to build pallet and my laptop have Core-i7 chip, but the time to build is range from 9-12 minutes. So, when I change code and have to wait to build and run.
So, my ...
4
votes
2
answers
2k
views
failed to resolve: use of undeclared crate or module `imp`
I got this error when building the whole project 'cargo build --release'. But build package works fine 'cargo build -p pallet-template'
error: the wasm32-unknown-unknown target is not supported by ...
4
votes
4
answers
160
views
How could I configure that reward amount or value for my Aura validators?
Now that the PoA is running with multiple Aura validators in my substrate-node-template. How could I configure that reward amount or value for my validators?
4
votes
2
answers
880
views
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
I am using the latest substrate-node-template few weeks back it was building fine.
But the same project isn't building now, I did not do any changes. Error is occurring in runtime interface. I am ...
4
votes
2
answers
371
views
Local network does not change validator set
Currently, we have a local test net with 4 substrate nodes using this runtime which has the staking and session pallets. 2 nodes (Alice and Bob) are validators, placed in the chain spec json file and ...
4
votes
2
answers
161
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.
4
votes
2
answers
642
views
"error: failed to select a version for `parity-util-mem`"
Currently dealing with an issue building my chain where parity-util-mem is conflicting with parity-util-mem-ban duplicates and I don't know the exact way to specify a certain version for all ...
4
votes
1
answer
335
views
the trait `WrapperTypeEncode` is not implemented for `ethereum_types::H256` & `ethereum_types::U256`
I am using:
ethereum-type version = "0.12", codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"]}
scale-...
4
votes
1
answer
87
views
How do I include a new rpc that uses a NetworkWorker in the node-template?
The node-template says its service.rs is a specialisation of that on the substrate master branch. Hence, it's sort of hard to relate the two. Nonetheless, I'd like to expose an RPC endpoint that's ...
4
votes
1
answer
82
views
This function takes 2 arguments but 1 argument was supplied
I'm working on a Substrate project, and I have the following storage definition:
#[pallet::storage]
#[pallet::getter(fn bids)]
pub(super) type Bids<T: Config> = StorageDoubleMap<
_,
...
4
votes
2
answers
82
views
Polkadot vs Rococo runtimes
I noticed various projects having multiple runtimes for Kusama, Polkadot and maybe a local-testnet. This makes sense as they can have different set of features.
In my case I only want to test on ...
4
votes
1
answer
42
views
How often to refresh chain metadata?
I was surprised to see that there while state_subscribeRuntimeVersion exists, there's no chain_subscribeMetadata so that made me wonder two things:
What is the expected process for detecting metadata ...