substrate-node-template | A new SRML-based Substrate node | Runtime Evironment library
kandi X-RAY | substrate-node-template Summary
kandi X-RAY | substrate-node-template Summary
A new SRML-based Substrate node, ready for hacking
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of substrate-node-template
substrate-node-template Key Features
substrate-node-template Examples and Code Snippets
Community Discussions
Trending Discussions on substrate-node-template
QUESTION
I want to try "Runtime Upgrade" and "Storage Migration". I tried by steps as following,but "on_runtime_upgrade" function did not work. Unable to verify that the "on_runtime_upgrade" function is called. The implemented debug log is not output.
- Download "substrate-node-template 3.0".
- Compile it.
- I ran the node with the following command. "target/release/node-template --dev -l runtime = debug".
- Implement "on_runtime_upgrade" in "palet-template".The program I tried "substrate-node-template/pallets/template/lib.rs" is listed below.
- Compile it by "cargo build --release -p node-template-runtime" command.
- Upload "node_template_runtime.compact.wasm" by using "sudo" & "setcode" command.
- I checked the execution log of the node, but I couldn't check the log set to "on_runtime_upgrade".
--lib.rs--
...ANSWER
Answered 2021-Apr-13 at 11:38This Code works. But "debug::info!" does not work. The value of "Something" would be "32".
QUESTION
In substrate 2.0.1, its has following code:
...ANSWER
Answered 2021-Mar-22 at 18:33In Substrate 3.0 you use the same construct_runtime!
macro in tests that you use in the full runtime. You can see an example of how to test events the new way in the Substrate repository itself.
QUESTION
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 done but over the internet and on different machines. So I execute the bootnode on my PC and the other node on my Laptop. I compiled both from the same code and also forwarded the ports in my router. So now I expect the same behavior as when I am running both on my local machine. So when I execute them I see network traffic printed in both consoles but the bob node prints a warning: Bootnode with peer id '12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp' is on a different chain (our genesis: 0xbfbd…3144 theirs: 0x8859…14c4)
and they are not connected (Idle 0 peers
).
So from the warning I conclude they have not the same genesis blocks which is obviously necessary to run as a blockchain. But from my understanding the joining node should copy the current state of the chain from the bootnode. How can I change bobs part to use alices state of the chain?
Both machines are running rust version 1.50.0
Thanks for your help!
...ANSWER
Answered 2021-Mar-09 at 21:53Rust compilations are not deterministic, thus the exact same code for the exact same blockchain compiled on two computers will unfortunately not have the same genesis hash. (Specifically because part of the genesis of that chain is the Wasm Runtime blob, which is compiled non-deterministically with Rust).
You need to create a chainspec file to use for all other nodes. Note that you want to generate this on one computer, and pass the file to other nodes (don't re-generate it, as the genesis code will differ, as you ran into) before you then start other nodes using the correct chainspec and manually specifying boot nodes.
QUESTION
gh@ubuntu:~/substrate-node-template$ CARGO_HTTP_MULTIPLEXING=false cargo build --release
Updating crates.io index
warning: spurious network error (2 tries remaining): [7] Couldn't connect to server (Failed to connect to github.com port 443: Connection refused); class=Net (12)
warning: spurious network error (1 tries remaining): [35] SSL connect error (OpenSSL SSL_connect: Connection reset by peer in connection to github.com:443 ); class=Net (12)
error: failed to get `frame-benchmarking` as a dependency of package `node-template v3.0.0 (/home/gh/substrate-node-template/node)`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
[28] Timeout was reached (Operation timed out after 30001 milliseconds with 0 out of 0 bytes received); class=Net (12)
...ANSWER
Answered 2021-Mar-01 at 06:10This is not a substrate question.
Try to use a VPN. Or use a mirror source.
QUESTION
I'm testing the substrate off-chain worker, what I want to do is receive the current block number, and then do some calculation, just like the below code if (get_block / 10 == 0)
, and I get some error. How can I convert the block number into the Integer type?
ANSWER
Answered 2020-Dec-22 at 07:32@kmdreko is right. You do not want to convert the block number to an integer, but convert the integer into a block number and then do the math.
So replace:
QUESTION
I followed the tutorialenter link description here to this step,
...ANSWER
Answered 2020-Dec-14 at 05:35The compile is not stuck in compilation, it is just taking a while due to the 800+ dependencies. From @gnunicorn on this github issue:
Rust isn't particular quick with the compiling at the moment and opaque to the person in front, at this step (when compiling
node-template-runtime
) we are actually building the project twice: once natively and once in wasm. So at some step in between it appears as if nothing happens and that can take up to half the total build time – if the other part took e.g. 10minutes then this process might take another 10min without any indicator of process (other than the CPU pumping hard).
You are doing a release build (cargo build --release
) which enables optimizations. For development purposes, a regular build or just a cargo check
will be substantially faster.
Some comments in the linked GitHub issue mentioned that running a cargo clean
and rebuilding helped speed up compile times, so you can try that as well.
QUESTION
Scenario: You want to submit an extrinsic to your custom Substrate node based on the substrate-node-template by using the Polkadot/Substrate frontend. You have renamed the Substrate node either manually by carefully searching and replacing all occurences of substarte-node-template or by using danforbes renaming script
Problem: When you try to submit an extrinsic to your Substrate node using the Polkadot/Substrate frontend, you receive an error message in the frontend:
...1002: Verification Error: Execution: Could not convert parameter
tx
between node and runtime: No such variant in enum MultiSignature: RuntimeApi, Execution: Could not convert parametertx
between node and runtime: No such variant in enum MultiSignature
ANSWER
Answered 2020-Oct-30 at 13:14Solution: as JoshOrndorff stated in a Github issue:
[...] The problem now is because the UI needs to know the types your node uses. When you use the node template, the UI detects it, and uses the appropriate types for you. Sine you have renamed your template, the UI cannot tell that it is still basically the node template, so you need to add your own custom types. In the Apps UI, go the the developer settings, and enter:
QUESTION
I cloned fresh https://github.com/substrate-developer-hub/substrate-node-template repository (sometime ago it was working fine) I have executed:
...ANSWER
Answered 2020-Aug-18 at 19:07I (thanks to Dan) solved it by execution:
QUESTION
I cloned this template. There is a code like this:
...ANSWER
Answered 2020-Aug-06 at 08:30Apparently this macro accepts custom syntax, as documented in https://substrate.dev/rustdocs/v2.0.0-rc5/frame_support/macro.decl_storage.html:
Basic storage can be extended as such:
#vis #name get(fn #getter) config(#field_name) build(#closure): #type = #default;
- #vis: Set the visibility of the structure. pub or nothing.
- #name: Name of the storage item, used as a prefix in storage.
- [optional] get(fn #getter): Implements the function #getter to Module.
- [optional] config(#field_name): field_name is optional if get is set. Will include the item in GenesisConfig.
- [optional] build(#closure): Closure called with storage overlays.
- #type: Storage type.
- [optional] #default: Value returned when none.
So in your Something
is the name of the storage item, used as a prefix in storage.
QUESTION
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:
...ANSWER
Answered 2020-Mar-17 at 18:13You should be using a hash of known size, so do something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install substrate-node-template
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page