9 votes
Accepted

Do I need a json chainspec for a production chain or does a code defined one suffices?

Yes that is right. To generate the genesis block we are currently leveraging the native runtime. It holds the GenesisConfig that can decode the json chain specs for example or is the one that is used ...
bkchr's user avatar
  • 10.8k
6 votes

What is `codeSubstitutes` in the chain spec?

codeSubstitutes is a really cool and useful feature to upgrade your chain when a runtime upgrade is not possible. This can be useful when your chain is not producing blocks due to a bug. ...
Bruno's user avatar
  • 8,260
6 votes
Accepted

What is the full list of ChainSpec properties?

The Properties field in the Chain Specification is intentionally arbitrary. As you see in the comment: Arbitrary properties defined in chain spec as a JSON object As a chain spec creator, you can ...
Shawn Tabrizi's user avatar
  • 15.9k
5 votes

Can we modify chain spec while running the node?

To answer this question, I think we should present a concrete example. Here is the current Polkadot chainspec (I replaced the long blobs with [...]). You can obtain this by runnning: polkadot build-...
Pierre Besson's user avatar
5 votes

What is `codeSubstitutes` in the chain spec?

As it has been pointed out already here codeSubstitutes is a good option only when a fix is needed to be included into the runtime because there is no other way to make it through. This is the case ...
Alejandro Martínez's user avatar
4 votes
Accepted

How to overwrite endowed account balances using additional accounts and balances from a JSON file for genesis block inclusion?

So you could create a function in you chain_spec.rs like this: pub fn get_endowed_accounts_with_balance() -> Vec<(AccountId, u128)> { let accounts: Vec<AccountId> = vec![ ...
Bruno's user avatar
  • 8,260
4 votes
Accepted

Can we modify chain spec while running the node?

It depends on the fields. Examples: You can't modify the storage. If you do that, the genesis hash will change. Which means it will be a totally different chain. Even though you apply this to all the ...
AurevoirXavier's user avatar
4 votes
Accepted

Convert a raw chainspec to the original format

No there is no automatic way for this. It would not be impossible as long as you have the native runtime that you used to build the raw chain spec. However, no one before required this before and thus,...
bkchr's user avatar
  • 10.8k
4 votes
Accepted

adding an account

You are close. You could do something like this: // Pre-funded accounts vec![ get_account_id_from_seed::<sr25519::Public>("Alice"), get_account_id_from_seed::<...
Bruno's user avatar
  • 8,260
4 votes
Accepted

Nodes not connecting to Rococo relaychain

For any other Project having issues with connecting to the Rococo relaychain please check if you are using old relay-chain bootnodes on your collator (due to importing old polkadot). We would ...
Nico 's user avatar
  • 71
3 votes

When there is a new Chain Spec version how do we know where to add things?

There are two types of chain spec: "raw" and "human readable". Where the difference between both is that genesis entry is either hex key and values or a json that contains the ...
bkchr's user avatar
  • 10.8k
3 votes
Accepted

Do I need the chain specification file of Rococco testnet to run my local parachain node?

In order to connect your parachain to a relay chain you need its chain spec file. In the tutorial, the relay chain you want to connect is rococo. The chain spec is public: https://github.com/...
Alex Bean's user avatar
  • 5,629
3 votes
Accepted

./target/release/parachain-collator not found

I think the name should be parachain-template-node.
AurevoirXavier's user avatar
3 votes
Accepted

When are you required to change the `authoring_version` for forkless runtime upgrades?

The idea behind authoring_version was to indicate that something in the api between the runtime and the node changed that makes the node unable to build new blocks. We almost never bumped this version ...
bkchr's user avatar
  • 10.8k
3 votes
Accepted

How many collators of a registered parachain must be synchronised with the Rococo relay chain for that parachain to generate and finalize blocks?

You only need 1 collator being synchronized to start building blocks. You also don't need n + 1 validators on the relay chain where n is the number of Parachains. That was the case for Parachains V0 ...
bkchr's user avatar
  • 10.8k
3 votes
Accepted

Is it possible to specify parachains in the Polkadot chain specification for local testing?

You can add the parachains to the paras field in your chain-spec. For doing this you can follow this steps: Create the chain-spec in plain text `polkadot build-spec --chain rococo-local --disable-...
pepoviola's user avatar
  • 782
3 votes
Accepted

How to inject session key in raw chain specs?

Yep. That's possible. For example: QueuedKeys /// The queued keys for the next session. When the next session begins, these keys /// will be used to determine the validator's session keys. #[pallet::...
AurevoirXavier's user avatar
3 votes
Accepted

What are the best practices for keeping chain specifications for Devnet, Testnet, and Mainnet environments?

I would say the approach you can find in the polkadot repo works nicely. Though, you have to find what fits best for your needs. About your concerns of having one binary that may present problems ...
Alejandro Martínez's user avatar
3 votes

What's the difference b/w ChainType::Development vs Local?

I can't answer your question perfectly. It's a marker/property, which means it's hard to find out all usage of it. We don't how many apps use this marker/property. For example, if your chain type is ...
AurevoirXavier's user avatar
2 votes

SessionsPerEra doesn't seem to be affecting sessions per era

If you are updating your runtime, currently you compile it twice for native and for wasm. When both are exactly the same you should use the same spec_version. In your case here, you updated the native ...
bkchr's user avatar
  • 10.8k
2 votes

How to overwrite endowed account balances using additional accounts and balances from a JSON file for genesis block inclusion?

I modified my code in this commit here to incorporate the following parts from Bruno's answer here: Initially I adopted Bruno's approach and got it to work in the DataHighway-Parachain codebase using ...
Luke Schoen's user avatar
  • 2,312
2 votes

Where to find the path for my relay chain when starting a parachain?

Check the previous section. The tutorial is using this spec. You could download this directly. Or, build it yourself: git clone https://github.com/paritytech/polkadot.git && cd polkadot cargo ...
AurevoirXavier's user avatar
2 votes

is there any api for get substrate api client verison?

How are you running sidecar? If you have it installed in your project you can query the version using the CLI: node_modules/.bin/substrate-api-sidecar --version If you have installed it globally: ...
Alex Bean's user avatar
  • 5,629
2 votes

Error generating Raw Chainspec from Plain Chainspec in Substrate

I think one of the node or the spec file is outdated. The node can not parse the spec file correctly. You could try generating a new spec file using the node. Or go to the spec file line 201, and ...
AurevoirXavier's user avatar
2 votes

Unable to sync after runtime upgrade

Bootnode with peer id 12D.. is on a different chain (our genesis: 0x40b7…db79 theirs: 0xa82a…1bc2) The above error occurs when you are trying to connect to your node with a node that has a different ...
Shubham Gupta's user avatar
2 votes
Accepted

How to retrieve number of decimals for custom token (not DOT)?

You can query the asset metadata like this: let asset = await api.query.assets.metadata(0 /* Asset Id */); console.log("Asset has", asset.decimals, "decimals");
Oliver Tale-Yazdi's user avatar
2 votes

Building a chain specification with --raw, gives me "wasm call error Other: Exported method GenesisBuilder_create_default_config is not found"

[edit] I found the real reason, the impl_runtime_apis! macro in the runtime lib.rs file, have a new trait implementation exposing the missing method. impl sp_genesis_builder::GenesisBuilder<Block&...
Alexandre Ribeiro's user avatar
2 votes

Genesis chainspec size limit

There is no real limitation on the amount of data in the chaispec. Nothing prevents you from putting there gigabytes of data. You will only get some sort of "usability" issue by requiring to ...
bkchr's user avatar
  • 10.8k
1 vote

Is it possible to specify parachains in the Polkadot chain specification for local testing?

If you want to setup a Relay chain with parachain(s) locally I recommend you start here: https://docs.substrate.io/tutorials/build-a-parachain Once you are comfortable with how to setup a test ...
Bruno's user avatar
  • 8,260
1 vote
Accepted

Should I set validator or rpc nodes in chainspec bootnodes?

They are all connected with p2p, but is there a reason to privilege some over the other for network discovery? No, not really. Having dedicated nodes as boot nodes would be more "clean", ...
bkchr's user avatar
  • 10.8k

Only top scored, non community-wiki answers of a minimum length are eligible