# Keypair

```javascript
const fs = require('fs');
const { Keypair } = require('@solana/web3.js');
const bs58 = require('bs58');

const base58PrivateKey = 'private key as string here...';
const uint8ArrayPrivateKey = bs58.decode(base58PrivateKey);

// Create a Keypair from the Uint8Array
const keypair = Keypair.fromSecretKey(uint8ArrayPrivateKey);

// Write the keypair to a JSON file in same directory
const keypairPath = './keypair.json';
fs.writeFileSync(keypairPath, `[${Array.from(keypair.secretKey)}]`);

```


---

# 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://rude-bot-org.gitbook.io/rude-solana-arbitrage-bot/bot-setup-instructions/keypair.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.
