# Account Management

## What is an Account?

An account is a locally encrypted file containing a private key. It is encrypted with a passphrase provided by the administration of the compute hosting the `Elld` client. To start, an `Elld` client, the administrator must specify an account that will be used to identity the node, sign blocks/transactions and more.&#x20;

## Create an Account

You can use the `Elld` executable to create as many accounts as you want. Use the `create` sub-command to create new accounts.

```bash
elld account create
```

After running the command above, you will be prompted to  enter your passphrase which will be used to encrypt your account on disk.&#x20;

{% hint style="danger" %}
Do not forget your passphrase to an account. It is impossible to unlock your account if you forget your passphrase.&#x20;
{% endhint %}

After entering your passphrase and repeated the passphrase, your account will be created and your address displayed to you.

```
New account created, encrypted and stored
Address: eGH15FVreezMwyVqXTmeLx1iKouqqibnCi
```

If you want to create an account and directly provide a passphrase without being forced to do so interactively, use `--pwd` flag; The `--pwd` flag can take a passphrase or a path to a file that contains your passphrase.&#x20;

## List all Accounts

To list all accounts that exists on the host running `Elld`, use the `list` sub-command.&#x20;

```
elld account list
```

This will output a list of address similar to this:

```
	Address                                Date Created
[0]	e449uo25WiXxwwbwYG41EMjCRAzAEVZKY6     1 month ago	[default]
[1]	eLRVae1i58mjHbcCQn3698DQsG3ec73aEv     2 weeks ago
[2]	e2KBuPhZbVnKZ4Z7cNXRZ6wNjQqf1RGchg     2 weeks ago
```

{% hint style="info" %}
The first account; The one with 0 index is always considered the default account. The 0-indexed account is also the oldest account.&#x20;
{% endhint %}

## Import a Private Key

If you already have an Ellcrys private key that you intend to import, the `import` sub-command allows you to create an account from an existing private key.&#x20;

First, you must store the private key in a file. Next you provide the path to the file as an argument to the `import` command.&#x20;

{% tabs %}
{% tab title="import.sh" %}

```bash
elld account import "private_key.txt"
```

{% endtab %}

{% tab title="private\_key.txt" %}

```
wKSAjVeUSRZZA3esRirDUzvA4vjV761bsMQY4rWL8gcbUgB1vXGiBS32dtLtoNY2djZ7Ugzvax8YYPVUCz5qRxGFt6GHz8
```

{% endtab %}
{% endtabs %}

After running the command above, an interactive prompt is started to collect your passphrase to be used to encrypt your imported account on disk. If you do not want to go through an interactive session to provide your passphrase, use `--pwd` to directly specify a passphrase.&#x20;

{% hint style="info" %}
The `--pwd` flag accepts a string for a passphrase or a path to a file containing your passphrase.
{% endhint %}

## Update an Account's Passphrase

When you need to update the passphrase of an account, you can use `update` sub-command. The sub-command takes the address of the account whose password you wish to update.

```bash
elld account update "e449uo25WiXxwwbwYG41EMjCRAzAEVZKY6"
```

Upon execution of the command, an interactive session is started to collect the old passphrase which is used to unlock the account and the new passphrase which replaces the old one.&#x20;

{% hint style="danger" %}
Do not forget your passphrase. It is impossible to unlock your account if you forget your passphrase.&#x20;
{% endhint %}

## Reveal an Account

You may need to copy a private key encrypted and associated with an account. When the need arises, use the `reveal` sub-command to display the content of an account.&#x20;

```bash
elld account reveal e449uo25WiXxwwbwYG41EMjCRAzAEVZKY6
```

Similar to other sub-commands, you will be prompted to enter your passphrase before the private key is outputted.&#x20;

```
Private Key: wKSAjVeUSRZZA3esRirDUzvA4vjV761bsMQY4rWL8gcbUgB1vXGiBS32dtLtoNY2djZ7Ugzvax8YYPVUCz5qRxGFt6GHz8
```

## Create an Address

To create an address without creating an account, use the `address` command.&#x20;

```bash
elld address create
```

Output:

```
Address:     e6FxKEM8kE9yQTpMBxk3cGMGJ3ypPwJ1Wk
Public Key:  47wViJQE1k2MbwYfhPR4Vwpy3LK81B8kkZ8Wu32JUXFPJFZXfbX
Private Key: wT18i4RRrDHkmfverURQSHGPukEUv3QmhVZG5wQEVJQsyVx8s2icYXraUYW2poohwaqaHW7WtQdoEstjMU6ZX7YmF4jdYA
Peer ID:     12D3KooWBEUcKwxM55q3xgCqSnEP3GWjUXpWcusDHxgdeHptHPu8
```
