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

# Wallets

> Creating and generating EVM-compatible wallets with CosmJS.

## Creating a Wallet

Use `DirectEthSecp256k1HdWallet` for EVM chains. It defaults to the Ethereum HD
path `m/44'/60'/0'/0/0` and uses Keccak-256 for address derivation and signing.

```typescript theme={"system"}
import { DirectEthSecp256k1HdWallet } from "@cosmjs/proto-signing";

const wallet = await DirectEthSecp256k1HdWallet.fromMnemonic(
  "your mnemonic here ...",
  { prefix: "cosmos" },
);
const [{ address }] = await wallet.getAccounts();
```

For a single private key (no mnemonic), use `DirectEthSecp256k1Wallet`:

```typescript theme={"system"}
import { DirectEthSecp256k1Wallet } from "@cosmjs/proto-signing";

const wallet = await DirectEthSecp256k1Wallet.fromKey(privkeyBytes, "cosmos");
```

Both wallets report `algo: "eth_secp256k1"` in their `AccountData`, which tells
the signing client to use EVM-compatible pubkey encoding.

## Generating a New Wallet

To generate a fresh mnemonic for an EVM chain:

```typescript theme={"system"}
import { DirectEthSecp256k1HdWallet } from "@cosmjs/proto-signing";

const wallet = await DirectEthSecp256k1HdWallet.generate(24, {
  prefix: "cosmos",
});
console.info("Mnemonic:", wallet.mnemonic);

const [{ address }] = await wallet.getAccounts();
console.info("Address:", address);
```

The default options derive from `m/44'/60'/0'/0/0`. You can customize the HD
path and prefix:

```typescript theme={"system"}
import { stringToPath } from "@cosmjs/crypto";

const wallet = await DirectEthSecp256k1HdWallet.fromMnemonic(mnemonic, {
  prefix: "evmos",
  hdPaths: [stringToPath("m/44'/60'/0'/0/0")],
});
```
