Show the available key management RPC calls in README (#3474)

* Show the available key management RPC calls in README

* minor fixes
This commit is contained in:
Bastian Köcher
2019-08-24 11:53:44 +02:00
committed by Gavin Wood
parent 7df089241c
commit bdd6bba20a
2 changed files with 38 additions and 2 deletions
+33 -1
View File
@@ -160,7 +160,7 @@ It won't do much until you start producing blocks though, so to do that you'll n
[source, shell]
----
substrate --chain ~/mychain.json --validator --key ...
substrate --chain ~/mychain.json --validator
----
You can distribute `mychain.json` so that everyone can synchronize and (depending on your authorities list) validate on your chain.
@@ -378,6 +378,38 @@ git checkout -b v1.0 origin/v1.0
You can then follow the same steps for building and running as described above in <<flaming-fir>>.
== Key management
Keys in Substrate are stored in the keystore in the file system. To store keys into this keystore,
you need to use one of the two provided RPC calls. If your keys are encrypted or should be encrypted
by the keystore, you need to provide the key using one of the cli arguments `--password`,
`--password-interactive` or `--password-filename`.
=== Recommended RPC call
For most users who want to run a validator node, the `author_rotateKeys` RPC call is sufficient.
The RPC call will generate `N` Session keys for you and return their public keys. `N` is the number
of session keys configured in the runtime. The output of the RPC call can be used as input for the
`session::set_keys` transaction.
```
curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_rotateKeys", "id":1 }' localhost:9933
```
=== Advanced RPC call
If the Session keys need to match a fixed seed, they can be set individually key by key. The RPC call
expects the key seed and the key type. The key types supported by default in Substrate are listed
https://github.com/paritytech/substrate/blob/master/core/primitives/src/crypto.rs#L767[here], but the
user can declare any key type.
```
curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["KEY_TYPE", "SEED"],"id":1 }' localhost:9933
```
`KEY_TYPE` - needs to be replaced with the 4-character key type identifier.
`SEEED` - is the seed of the key.
== Documentation
=== Viewing documentation for Substrate packages
+5 -1
View File
@@ -441,7 +441,11 @@ lazy_static::lazy_static! {
/// The Cli values for all test accounts.
static ref TEST_ACCOUNTS_CLI_VALUES: Vec<KeyringTestAccountCliValues> = {
keyring::Sr25519Keyring::iter().map(|a| {
let help = format!("Shortcut for `--key //{} --name {}`.", a, a);
let help = format!(
"Shortcut for `--name {} --validator` with session keys for `{}` added to keystore.",
a,
a,
);
let conflicts_with = keyring::Sr25519Keyring::iter()
.filter(|b| a != *b)
.map(|b| b.to_string().to_lowercase())