# 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 NO.AI SDK, you must have it installed.

You can install NO.AI SDK using either **`npm`** or **`yarn`**. Use the following commands to install NO.AI 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 NO.AI 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.
