# New account

## Create a new account

The first time you launch the example, you might want to generate a new account that will then be used.  There are two ways to do so: from the Unix example we provide or using Algorand's `algokey` tool.

Both ways will use the same format to store the keys using two files:

1. `private_key.bin` for the private key, stored in binary format;
2. `public_b32.txt` for the account address in plain text (base-32 format).

{% hint style="info" %}
In any case, you will then be asked to [fund your account](https://bank.testnet.algorand.network/) in order to execute new transactions.
{% endhint %}

### Using the Unix example

```
./examples/unix/unix_example [-n]
```

Use the flag `-n` to allow `unix_example` to generate a new random account. The account is then stored inside a binary file where the private and public keys are concatenated in binary format.

Below is the example running:

```
$ ./examples/unix/unix_example -n
🟢 [examples/unix/main.c:217] 😎 Vertices SDK running on Unix-based OS
🟢 [examples/unix/main.c:137] 🔑 Loading private key from: /path/to/c-vertices-sdk/examples/unix/config/private_key.bin
🟠 [examples/unix/main.c:145] 🧾 Creating new random account and storing it (path /path/to/c-vertices-sdk/examples/unix/config/)
🟢 [examples/unix/main.c:194] 💳 Alice's account IZV2H3YRLCPOTUL5ATG5T3TRMUEXKLOGFWYO34NVKRMTXKZO2OOAJ34IWI
🟢 [examples/unix/main.c:250] 🏎 Running on testnet-v1.0 v.2.5.0
🟢 [src/account.c:42] 👛 Added account to wallet: #0
🟢 [src/account.c:42] 👛 Added account to wallet: #1
🟢 [examples/unix/main.c:263] 🤑 0.000000 Algos on Alice's account (IZV2H3YRLCPOTUL5ATG5T3TRMUEXKLOGFWYO34NVKRMTXKZO2OOAJ34IWI)
🔴 [examples/unix/main.c:268] 🙄 Amount available on account is too low to pass a transaction, consider adding Algos
🟢 [examples/unix/main.c:270] 👉 Go to https://bank.testnet.algorand.network/, dispense Algos to: IZV2H3YRLCPOTUL5ATG5T3TRMUEXKLOGFWYO34NVKRMTXKZO2OOAJ34IWI
🟢 [examples/unix/main.c:271] 😎 Then wait for a few seconds for transaction to pass...
```

Taking a look at the log, you will see that:

1. The path to the file storing the keys is displayed `/path/to/c-vertices-sdk/examples/unix/config/`.&#x20;
2. The created account is also displayed in base-32 format: `IZV2H3YRLCPOTUL5ATG5T3TRMUEXKLOGFWYO34NVKRMTXKZO2OOAJ34IWI`.
3. Following the last two lines, you then need to go to <https://bank.testnet.algorand.network/> to fund the freshly generated account: `IZV2H3YRLCPOTUL5ATG5T3TRMUEXKLOGFWYO34NVKRMTXKZO2OOAJ34IWI`.

Once you have dispensed money on the account, you can go to the next step! 🙂

{% hint style="info" %}
You can use `-n` flag whenever you want to create a new account but make sure to have copied the generated files somewhere else if you want to keep the account otherwise, it will be overwritten and forever lost.
{% endhint %}

### Using Algokey

You can also choose to generate a new account using the tool provided with the Algorand node: [`algokey`](https://developer.algorand.org/docs/reference/cli/algokey/algokey/):

```bash
./algokey generate -f path_to/examples/unix/config/private_key.bin -p path_to/examples/unix/config/public_b32.txt

# to get the account public address:
cat path_to/examples/unix/config/public_b32.txt 
```

In order to use the account, you need to store the files in the example `config` folder. The example program will then be ready to use, as soon as you [dispense money on the account](https://bank.testnet.algorand.network/). You will find the public key in `public_b32.txt`.

You are now ready to send your first transaction 😎.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vertices.network/vertices-sdk/quickstart/unix/new-account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
