Files
pezkuwi-subxt/substrate/bin/utils/subkey
Hernando Castano ea1eb4e57f Use Subscription Manager from jsonrpc-pubsub (#6208)
* Bump jsonrpc pubsub, core, http, and ws

Right now these are the packages which _need_ to be updated
so I can just the latest `jsonrpc-pubsub` code. Once a release
it cut upstream the rest of the dependencies should be updated
as well.

* Use jsonrpc-pubsub's SubscriptionManager

This places sc-rpc-api::Subscriptions

* Bump jsonrpc-core outside of sc-rpc-*

* Update client/rpc tests

Right now one of the `author` tests is failing, I
need to think a bit about how best to fix it.

* Remove Subscriptions manager

There's no need for this implementation since we're
using the one from `jsonrpc-pubsub` now

* Fix author RPC test

This test used to check for a numerial subscription ID,
whereas now it uses a string based ID which is the default
provided by `jsonrpc-pubsub`'s subscription manager.

* Remove unused NumericIdProvider

* Add missing bracket

Removed one too many with that last one, lol

* Bump `jsonrpc` to v14.2

There's an exception though. `jsonrpc-derive` cannot be bumped
past v14.0.5 just yet since it has a dependency on `quote` pinned
to v1.0.1. This means that at the moment it won't build on Substrate
since it's using v1.0.3.

* Track `jsonrpc-derive` master branch

* Bump `quote` version to v1.0.6

* Bump `jsonrpc-derive` to v14.2.1

This includes support for `quote` v1.0.6
2020-06-04 09:50:22 +01:00
..
2020-05-27 13:11:09 +02:00

= Subkey

Subkey is a commandline utility included with Substrate that generates or restores Substrate keys. 

`subkey` will use the http://wiki.polkadot.network/en/latest/polkadot/learn/cryptography/#keypairs-and-signing[sr25519] cryptography by default. If you need to use the older ed25519 cryptography to generate or restore your key pass the `--ed25519` flag to any of the commands.

== Usage

=== Generate a random account

```bash
subkey generate
```

Will output a mnemonic phrase and give you the seed, public key, and address of a new account. DO NOT SHARE your mnemonic or seed with ANYONE it will give them access to your funds. If someone is making a transfer to you they will only need your **Address**.

=== Inspecting a key

You can inspect a given URI (mnemonic, seed, public key, or address) and recover the public key and the address.

```bash
subkey inspect <mnemonic,seed,pubkey,address>

OUTPUT:
  Public key (hex): 0x461edcf1ba99e43f50dec4bdeb3d1a2cf521ad7c3cd0eeee5cd3314e50fd424c
  Address (SS58): 5DeeNqcAcaHDSed2HYnqMDK7JHcvxZ5QUE9EKmjc5snvU6wF
```

=== Signing

`subkey` expects a message to come in on STDIN, one way to sign a message would look like this:

```bash
echo -n <msg> | subkey sign <seed,mnemonic>

OUTPUT:
a69da4a6ccbf81dbbbfad235fa12cf8528c18012b991ae89214de8d20d29c1280576ced6eb38b7406d1b7e03231df6dd4a5257546ddad13259356e1c3adfb509
```

=== Verifying a signature

```bash
echo -n <msg> | subkey verify <sig> <address>

OUTPUT:
Signature verifies correctly.
```

=== Using the vanity generator

You can use the included vanity generator to find a seed that provides an address which includes the desired pattern. Be warned, depending on your hardware this may take a while.

```bash
subkey vanity 1337
```

=== Signing a transaction

Sign a transaction from an encoded `Call`.

```bash
subkey sign-transaction \
	--call <call-as-hex> \
	--nonce 0 \
	--suri <secret-uri> \
	--password <password> \
	--prior-block-hash <prior-block-hash-as-hex>
```

Will output a signed and encoded `UncheckedMortalCompactExtrinsic` as hex.

=== Inspecting a module ID

```bash
subkey --network kusama moduleid "py/trsry"

OUTPUT:
Public Key URI `F3opxRbN5ZbjJNU511Kj2TLuzFcDq9BGduA9TgiECafpg29` is account:
  Network ID/version: kusama
  Public key (hex):   0x6d6f646c70792f74727372790000000000000000000000000000000000000000
  Account ID:         0x6d6f646c70792f74727372790000000000000000000000000000000000000000
  SS58 Address:       F3opxRbN5ZbjJNU511Kj2TLuzFcDq9BGduA9TgiECafpg29
```