I successfully installed substrate and followed Trying out Substrate Node the README, creating my own chainspec.
Now my chainspec.json contains
"authorities": [
"0x82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5",
"0x4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7",
"0x063d7787ebca768b7445dfebe7d62cbb1625ff4dba288ea34488da266dd6dca5",
"0x8101764f45778d4980dadaceee6e8af2517d3ab91ac9bec9cd1714fa5994081c"
],
[...]
intentions": [
"0x82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5",
"0x4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7",
"0x063d7787ebca768b7445dfebe7d62cbb1625ff4dba288ea34488da266dd6dca5",
"0x8101764f45778d4980dadaceee6e8af2517d3ab91ac9bec9cd1714fa5994081c"
],
[...]
"validators": [
"0x82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5",
"0x4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7",
"0x063d7787ebca768b7445dfebe7d62cbb1625ff4dba288ea34488da266dd6dca5",
"0x8101764f45778d4980dadaceee6e8af2517d3ab91ac9bec9cd1714fa5994081c"
],
I guess those are public keys, but I am not sure. Now the README suggests to produce procls using
substrate --chain ~/mychain.json --validator --key ...
But what do I put as there --key argument here? There are some examples with --key Alice. But for every value I tried, a different "authority key" is created and no blocks are generated. The substrate --help entry for --key did not help me as well.
first : you produce a seed , by https://polkadot.js.org/apps/next/#/accounts (Raw seed), or use the subkey. seed likes: 0xa09bdb4ae87608207f796348ae7bef50c1ab74b08dd2883b41e018baf3de14e7, and get an address : 7swb4ToBfdjxW3wzrJcxJb2TxpdCQ8Ww6sVTu4ettYVnwLxQ;
2#: decode this address (7swb4ToBfdjxW3wzrJcxJb2TxpdCQ8Ww6sVTu4ettYVnwLxQ) by https://incoherency.co.uk/base58/,get: 44ef46d23dee6b96a9bdb6980dadbc9b0baee0b500dc5265b7ae05ace68d72ba3f8e39;
3#: 44ef46d23dee6b96a9bdb6980dadbc9b0baee0b500dc5265b7ae05ace68d72ba3f8e39, 1st byte is a network identifier 0x2a for krummelanke and 0x44 for bbqbirch. The 2 trailing bytes are the left 2bytes of the blake2b hash of the concat of the first byte and the pubkey. so.... the Public key is ef46d23dee6b96a9bdb6980dadbc9b0baee0b500dc5265b7ae05ace68d72ba3f;
4#: Edit the mychain.json, change the validators/authorities/intentions public key, likes:0xef46d23dee6b96a9bdb6980dadbc9b0baee0b500dc5265b7ae05ace68d72ba3f;
5#: $ substrate --chain ~mychain.json --validator --key 0xa09bdb4ae87608207f796348ae7bef50c1ab74b08dd2883b41e018baf3de14e7;
NOTE: DONT USE THIS SEED. JUST FOR EXPLAIN!!
@jiangfuyao Thanks a lot for all the details. Will go through it when I find the time and try to improve the README along the way. Have a nice day!
Thanks again! I managed to get the keys right. In https://gist.github.com/webmaster128/15520a805b1b162ffafb1286d243d5f0#generate-account there is a tutorial on how to setup everything you described above.
Unfortunatly, I still do not produce blocks. Are there other settings necessary in ~/chainspec.json?
$ substrate --chain ~/mychain.json --validator --key udah5sec6hoi6ohsauHaeph1bahmohje
2018-11-06 21:12:16 Substrate Node
2018-11-06 21:12:16 version 0.1.0-c69631e6-x86_64-linux-gnu
2018-11-06 21:12:16 by Parity Technologies, 2017, 2018
2018-11-06 21:12:16 Chain specification: Staging Testnet
2018-11-06 21:12:16 Node name: hospitable-flower-6987
2018-11-06 21:12:16 Roles: AUTHORITY
2018-11-06 21:12:16 Best block: #0
2018-11-06 21:12:16 Local node address is: /ip4/0.0.0.0/tcp/30333/p2p/QmNQjQWuUF4u4fdKnL74DQtrxbfYt2wEYpDaicKJdRgej3
2018-11-06 21:12:16 Using authority key 5GRRjhCeq8gvodQxqth9bSepeYTwQMqN57ZR8pqdjQ1ABGGt
2018-11-06 21:12:17 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:21 Random Kademlia request has yielded empty results
2018-11-06 21:12:21 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:26 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:31 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:36 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:41 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:46 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:51 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:12:56 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:01 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:06 Random Kademlia request has yielded empty results
2018-11-06 21:13:06 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:11 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:16 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:21 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-06 21:13:26 Idle (0 peers), best: #0 (0xd556…2b96)
Your echo: 2018-11-06 21:12:21 Random Kademlia request has yielded empty results.
Please update your substrate.
I use the new release, is ok:
threebody@deepin:~$ substrate --chain ~/mychain.json -d /tmp/test1 --validator --key udah5sec6hoi6ohsauHaeph1bahmohje
2018-11-07 11:17:25 Substrate Node
2018-11-07 11:17:25 version 0.1.0-d3c0b508-x86_64-linux-gnu
2018-11-07 11:17:25 by Parity Technologies, 2017, 2018
2018-11-07 11:17:25 Chain specification: Staging Testnet
2018-11-07 11:17:25 Node name: kaput-friction-8395
2018-11-07 11:17:25 Roles: AUTHORITY
2018-11-07 11:17:26 Initialising Genesis block/state (state: 0x91bc…dc3c, header-hash: 0x5680…0ed8)
2018-11-07 11:17:26 Best block: #0
2018-11-07 11:17:26 Local node address is: /ip4/0.0.0.0/tcp/30333/p2p/QmQfhZBnQfiMzRtMrjBJ26EfmVDZbYbMt9JtwmcWCW6cvX
2018-11-07 11:17:26 Using authority key 5GRRjhCeq8gvodQxqth9bSepeYTwQMqN57ZR8pqdjQ1ABGGt
2018-11-07 11:17:26 Idle (0 peers), best: #0 (0x5680…0ed8)
2018-11-07 11:17:31 Random Kademlia request has yielded empty results
2018-11-07 11:17:31 Idle (0 peers), best: #0 (0x5680…0ed8)
2018-11-07 11:17:36 Starting consensus session on top of parent 0x5680025adc73cd3707fba42a906580702c2d65e6dded20eb602de624e4250ed8
2018-11-07 11:17:36 Proposing block [number: 1; hash: 0x63c8…258e; parent_hash: 0x5680…0ed8; extrinsics: [0x3f8c…de9f, 0x7b4e…2d59]]
2018-11-07 11:17:36 Imported #1 (0x0dfc…a293)
2018-11-07 11:17:36 Idle (0 peers), best: #1 (0x0dfc…a293)
2018-11-07 11:17:41 Idle (0 peers), best: #1 (0x0dfc…a293)
2018-11-07 11:17:46 Idle (0 peers), best: #1 (0x0dfc…a293)
2018-11-07 11:17:51 Idle (0 peers), best: #1 (0x0dfc…a293)
2018-11-07 11:17:56 Idle (0 peers), best: #1 (0x0dfc…a293)
2018-11-07 11:18:00 Starting consensus session on top of parent 0x0dfce787a6db53713ffa83e081d690bcaaba7ea7be0fd8746292897f2077a293
2018-11-07 11:18:00 Proposing block [number: 2; hash: 0x3904…53d3; parent_hash: 0x0dfc…a293; extrinsics: [0x9689…5bf1, 0x7b4e…2d59]]
2018-11-07 11:18:00 Imported #2 (0xaebb…aac3)
2018-11-07 11:18:01 Idle (0 peers), best: #2 (0xaebb…aac3)
2018-11-07 11:18:06 Idle (0 peers), best: #2 (0xaebb…aac3)
2018-11-07 11:18:11 Idle (0 peers), best: #2 (0xaebb…aac3)
2018-11-07 11:18:16 Random Kademlia request has yielded empty results
2018-11-07 11:18:16 Idle (0 peers), best: #2 (0xaebb…aac3)
2018-11-07 11:18:21 Idle (0 peers), best: #2 (0xaebb…aac3)
2018-11-07 11:18:24 Starting consensus session on top of parent 0xaebbadb7d840c0c5f0a37e6d81702c961effcc1ab9ee87d20ab897055026aac3
2018-11-07 11:18:24 Proposing block [number: 3; hash: 0x59bd…1e87; parent_hash: 0xaebb…aac3; extrinsics: [0xf08d…67e9, 0x7b4e…2d59]]
2018-11-07 11:18:24 Imported #3 (0x2c51…3026)
Got it! But is was not the substrate update, it was the missing -d: Same version and same config as above. When I set -d /tmp/test1 I get blocks, otherwise output as above.
Reading the help -d, --base-path <PATH> Specify custom base path I don't understand why the default base path does not work. Which one is the default base path?
Upgrading substrate did not help the situation with default base path:
$ substrate --chain ~/mychain.json --validator --key udah5sec6hoi6ohsauHaeph1bahmohje
2018-11-08 00:44:02 Substrate Node
2018-11-08 00:44:02 version 0.1.0-c69631e6-x86_64-linux-gnu
2018-11-08 00:44:02 by Parity Technologies, 2017, 2018
2018-11-08 00:44:02 Chain specification: Staging Testnet
2018-11-08 00:44:02 Node name: upset-snow-5313
2018-11-08 00:44:02 Roles: AUTHORITY
2018-11-08 00:44:02 Best block: #0
2018-11-08 00:44:02 Local node address is: /ip4/0.0.0.0/tcp/30333/p2p/QmNQjQWuUF4u4fdKnL74DQtrxbfYt2wEYpDaicKJdRgej3
2018-11-08 00:44:02 Using authority key 5GRRjhCeq8gvodQxqth9bSepeYTwQMqN57ZR8pqdjQ1ABGGt
2018-11-08 00:44:02 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:07 Random Kademlia request has yielded empty results
2018-11-08 00:44:07 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:12 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:17 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:22 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:27 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:32 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:37 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:42 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:47 Idle (0 peers), best: #0 (0xd556…2b96)
2018-11-08 00:44:52 Random Kademlia request has yielded empty results
2018-11-08 00:44:52 Idle (0 peers), best: #0 (0xd556…2b96)
After pulling latest substrate master if it's not producing blocks,./target/debug/substrate purge-chain --chain YOUR_CHAIN then ./target/debug/build-spec, will help, though it's a pain in the butt.
@webmaster128 Because your default block-db path was used by the default substrate-node-sapce, if you change the chain-space.json , need delete the defult block-db,or use -d /tmp/test-path :)
Because your default block-db path was used by the default substrate-node-sapce, if you change the chain-space.json , need delete the defult block-db,or use -d /tmp/test-path :)
Makes sense, thanks! Could we add a check that the given --chain file matches the content in the base path -d to avoid this kind of mistakes?
At each start time, use a new /tmp/path.
Or you can check your defult block db path
OK, now close this issue?
heyho @jiangfuyao,
my personal problems are solved but the next stranger from the internet will have the same onboarding issues. I see 2 points to improve here:
I can send a PR for 1 but don't know what's the best approach for 2.
Closing now that we have an issue to track this (#1105).