Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

[docs] cleos doc-a-thon feedback #9925

Merged
merged 2 commits into from
Jan 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions docs/02_cleos/02_how-to-guides/how-to-create-key-pairs.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
## Goal
Create a keypair consisting of a public and a private key for signing transactions in the EOSIO blockchain.

## Before you begin
Before you follow the steps to create a new key pair, make sure the following items are fulfilled:


* Install the currently supported version of `cleos`

* Understand the following:
* What is a public and private key pair
[[info | Note]]
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.

* Acquire functional understanding of asymmetric cryptography (public and private keypair) in the context of blockchain

## Steps

To output the key pair to the console
To create a keypair and print the result to the console:

```sh
cleos create key --to-console
```

**Example Output**

```sh
cleos create key --to-console
Private key: 5KPzrqNMJdr6AX6abKg*******************************cH
Public key: EOS4wSiQ2jbYGrqiiKCm8oWR88NYoqnmK4nNL1RCtSQeSFkGtqsNc
```

To save the key pair to file

To create a keypair and save it to a file:

```sh
cleos create key --file FILE_TO_SAVEKEY
```
```
Where: FILE_TO_SAVEKEY = name of the file

**Example Output**
```sh
cleos create key --file pw.txt
saving keys to pw.txt
```

To view the saved keypair in the file:
```sh
cat pw.txt
Private key: 5K7************************************************
Public key: EOS71k3WdpLDeqeyqVRAAxwpz6TqXwDo9Brik5dQhdvvpeTKdNT59
```