> ## Documentation Index
> Fetch the complete documentation index at: https://docs.validationcloud.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting up a Wallet

> Initializing an ethers.js wallet constructed from a private Ethereum key.

The code snippet below returns an ethers wallet constructed from a private Ethereum key.

Note: For secure production environments, we recommend utilizing a secrets manager or vault to invoke the private key, instead of a plain-text environment variable.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
function getWallet() {
  const privateKey = process.env.PRIVATE_KEY;
  if (!privateKey) {
    throw 'PRIVATE_KEY environment variable must be defined';
  }

  return new ethers.Wallet(privateKey);
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.