# generateWallet

## Description

The `generateWallet` function generates a new key pair using the Ed25519 cryptographic algorithm.&#x20;

It then returns the public key, private key, and account hash for the newly generated wallet

## Parameters

This function does not take any parameters.

## Response

<table><thead><tr><th>Name</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>privateKey</code></td><td>string</td><td>The private key of the newly generated wallet</td></tr><tr><td><code>publicKey</code></td><td>string</td><td>The public key of the newly generated wallet</td></tr><tr><td><code>accountHash</code></td><td>string</td><td>The account hash of the newly generated wallet on the specified blockchain network</td></tr></tbody></table>

## Example Request and Response

### Prerequisites

Before making requests with Volary SDK, you must have it installed.

You can install Volary SDK using either **`npm`** or **`yarn`**. Use the following commands to install Volary SDK:

```sh
npm install @nest25/casper-lib
OR
yarn add @nest25/casper-lib
```

### Request

Here is an example of how to make a `generateWallet` request using the Volary SDK:

```javascript
// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();

async function main() {
  // generate a new wallet
  let wallet = await casper.generateWallet();
  console.log({ wallet });
}

main();

```

### Response

```sh
{
        wallet: {
          privateKey: '5PjVtasdHeiRVvKaRyhG7qKfWxZnzwez9FbNS9Qx8hALSiAWoE6C6HFSoctqxaZbErNNk9yYyfPwQ9pKiuSbyoi',
          publicKey: '01442e4e84C5Da665eCcFbf766400E9C6B21A0000f8cdc202E35133dA4A41A3715',
          accountHash: 'account-hash-26d819b30dafeb95f3bd333f1ba27ecab71b5a3637ea8e63725b8374abbe3875'
        }
      }
```

## Use Cases

* **Decentralized Applications:** The function can be used by decentralized applications to generate new public-private key pairs for user accounts and facilitate transactions on blockchain networks.
* **Blockchain Development:** The function can be used by developers to quickly generate test accounts and keys for development and testing purposes.
* **Blockchain Education:** The function can be used by educators and students to demonstrate and learn about public-private key pairs and their role in blockchain transactions.


---

# 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.volary.io/sdks-guide/blockchain-sdks/casper-sdk/generatewallet.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.
