# @ethereumjs/wallet

> Utilities for handling Ethereum keys

Latest version **10.0.0** (published 2025-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ethereumjs/wallet
pnpm add @ethereumjs/wallet
yarn add @ethereumjs/wallet
bun add @ethereumjs/wallet
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 10.0.0 |
| Published | 2025-04-29 |
| First published | 2023-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 5 |
| Unpacked size | 242.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2756 |
| Author | Alex Beregszaszi |
| Maintainers | axic, holgerd77, acolytec3, g11tech |
| Keywords | ethereum, wallets, keys |

## Links

- npm: https://www.npmjs.com/package/@ethereumjs/wallet
- Repository: https://github.com/ethereumjs/ethereumjs-monorepo
- Homepage: https://github.com/ethereumjs/ethereumjs-monorepo/packages/wallet
- Issues: https://github.com/ethereumjs/ethereumjs-monorepo/issues
- npm.io page: https://npm.io/package/@ethereumjs/wallet

## Dependencies (5)

- [uuid](https://npm.io/package/uuid.md) ^11.1.0
- [js-md5](https://npm.io/package/js-md5.md) ^0.8.3
- [@scure/base](https://npm.io/package/@scure/base.md) ^1.2.4
- [@ethereumjs/util](https://npm.io/package/@ethereumjs/util.md) ^10.0.0
- [ethereum-cryptography](https://npm.io/package/ethereum-cryptography.md) ^3.2.0

## Recent versions

- 10.0.0 (latest) — 2025-04-29
- 10.0.0-rc.1 (rc) — 2025-03-24
- 3.0.0-alpha.1 (alpha) — 2024-10-17
- 2.0.4 — 2024-08-15
- 2.0.3 — 2024-03-18
- 2.0.2 — 2024-02-08
- 2.0.1 — 2023-11-02
- 2.0.0 — 2023-08-09
- 2.0.0-rc.1 — 2023-07-17

## README

# @ethereumjs/wallet `v10`

[![NPM Package][npm-badge]][npm-link]
[![Actions Status][actions-badge]][actions-link]
[![Coverage Status][coverage-badge]][coverage-link]
[![Discord][discord-badge]][discord-link]

A lightweight wallet implementation. At the moment it supports key creation and conversion between various formats.

It is complemented by the following packages:

- [@ethereumjs/tx](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx) to sign transactions
- [ethereumjs-icap](https://github.com/ethereumjs/ethereumjs-icap) to manipulate ICAP addresses
- [store.js](https://github.com/marcuswestin/store.js) to use browser storage

Motivations are:

- be lightweight
- work in a browser
- use a single, maintained version of crypto library (and that should be in line with [`@ethereumjs/util`](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) and `@ethereumjs/tx`)
- support import/export between various wallet formats
- support BIP32 HD keys

Features not supported:

- signing transactions
- managing storage (neither in node.js or the browser)

## Table of Contents

- [Installation](#installation)
- [Wallet API](#wallet-api)
- [Thirdparty API](#thirdparty-api)
- [HD Wallet API](#hd-wallet-api)
- [Special Topics](#special-topics)
- [EthereumJS](#ethereumjs)
- [License](#license)

## Wallet API

For information about the Wallet's API, please go to [./docs/classes/wallet.md](./docs/classes/wallet.md).

You can import the `Wallet` class like this

Node.js / ES6:

```js
// ./examples/wallet.cjs

const { Wallet } = require('@ethereumjs/wallet')

const wallet = Wallet.generate()
console.log(wallet.getAddressString()) // should output an Ethereum address
```

ESM / TypeScript:

```ts
// ./examples/wallet.ts

import { Wallet } from '@ethereumjs/wallet'

const wallet = Wallet.generate()
console.log(wallet.getAddressString()) // should output an Ethereum address
```

## Thirdparty API

Importing various third party wallets is possible through the `thirdparty` submodule:

Node.js / ES5:

```js
// ./examples/thirdparty.cjs

const { thirdparty } = require('@ethereumjs/wallet')

const wallet = thirdparty.fromQuorumWallet('mySecretQuorumWalletPassphrase', 'myPublicQuorumUserId')
console.log(wallet.getAddressString()) // An Ethereum address
```

ESM / TypeScript:

```ts
// ./examples/thirdparty.ts

import { thirdparty } from '@ethereumjs/wallet'

const wallet = thirdparty.fromQuorumWallet('mySecretQuorumWalletPassphrase', 'myPublicQuorumUserId')
console.log(wallet.getAddressString()) // An Ethereum address
```

Please go to [./docs/README.md](./docs/README.md) for more info.

## HD Wallet API

To use BIP32 HD wallets, first include the `hdkey` submodule:

Node.js / ES5:

```js
// ./examples/hdKey.cjs

const { hdkey } = require('@ethereumjs/wallet')

const wallet = hdkey.EthereumHDKey.fromMnemonic(
  'clown galaxy face oxygen birth round modify fame correct stumble kind excess',
)
console.log(wallet.getWallet().getAddressString()) // Should print an Ethereum address
```

ESM / TypeScript:

```ts
// ./examples/hdKey.ts

import { hdkey } from '@ethereumjs/wallet'

const wallet = hdkey.EthereumHDKey.fromMnemonic(
  'clown galaxy face oxygen birth round modify fame correct stumble kind excess',
)
console.log(wallet.getWallet().getAddressString()) // Should print an Ethereum address
```

Please go to [./docs/classes/ethereumhdkey.md](./docs/classes/ethereumhdkey.md) for more info.

## Special Topics

### Remarks about `toV3`

The `options` is an optional object hash, where all the serialization parameters can be fine tuned:

- uuid - UUID. One is randomly generated.
- salt - Random salt for the `kdf`. Size must match the requirements of the KDF (key derivation function). Random number generated via `crypto.getRandomBytes` if nothing is supplied.
- iv - Initialization vector for the `cipher`. Size must match the requirements of the cipher. Random number generated via `crypto.getRandomBytes` if nothing is supplied.
- kdf - The key derivation function, see below.
- dklen - Derived key length. For certain `cipher` settings, this must match the block sizes of those.
- cipher - The cipher to use. Names must match those of supported by `OpenSSL`, e.g. `aes-128-ctr` or `aes-128-cbc`.

Depending on the `kdf` selected, the following options are available too.

For `pbkdf2`:

- `c` - Number of iterations. Defaults to 262144.
- `prf` - The only supported (and default) value is `hmac-sha256`. So no point changing it.

For `scrypt`:

- `n` - Iteration count. Defaults to 262144.
- `r` - Block size for the underlying hash. Defaults to 8.
- `p` - Parallelization factor. Defaults to 1.

The following settings are favoured by the Go Ethereum implementation and we default to the same:

- `kdf`: `scrypt`
- `dklen`: `32`
- `n`: `262144`
- `r`: `8`
- `p`: `1`
- `cipher`: `aes-128-ctr`

## EthereumJS

See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices.

If you want to join for work or do improvements on the libraries have a look at our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html).

## License

MIT License

Copyright (C) 2016 Alex Beregszaszi

[actions-badge]: https://github.com/ethereumjs/ethereumjs-monorepo/workflows/Build/badge.svg
[actions-link]: https://github.com/ethereumjs/ethereumjs-monorepo/actions
[coverage-badge]: https://img.shields.io/coveralls/ethereumjs/ethereumjs-wallet.svg
[coverage-link]: https://coveralls.io/r/ethereumjs/ethereumjs-wallet
[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue
[discord-link]: https://discord.gg/TNwARpR
[npm-badge]: https://img.shields.io/npm/v/ethereumjs-wallet.svg
[npm-link]: https://www.npmjs.org/package/@ethereumjs/wallet

---
_Source: https://npm.io/package/@ethereumjs/wallet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
