• Stars
    star
    966
  • Rank 45,474 (Top 1.0 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Utilities for handling Ethereum keys

ethereumjs-wallet

NPM Package Actions Status Coverage Status Discord

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

It is complemented by the following packages:

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 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)

Wallet API

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

You can import the Wallet class like this

Node.js / ES6:

const Wallet = require('ethereumjs-wallet').default

ESM / TypeScript:

import Wallet from 'ethereumjs-wallet'

Thirdparty API

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

Node.js / ES5:

const { thirdparty } = require('ethereumjs-wallet')

ESM / TypeScript:

import { thirdparty } from 'ethereumjs-wallet'

Please go to ./docs/README.md for more info.

HD Wallet API

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

Node.js / ES5:

const { hdkey } = require('ethereumjs-wallet')

ESM / TypeScript:

import { hdkey } from 'ethereumjs-wallet'

Please go to ./docs/classes/ethereumhdkey.md for more info.

Provider Engine

Provider Engine is not very actively maintained and support has been removed along v1.0.0 release, see issue #115 for context.

You can use the the old src/provider-engine.ts code (see associated PR) as some boilerplate for your own integration if needed.

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 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.

License

MIT License

Copyright (C) 2016 Alex Beregszaszi

More Repositories

1

ethereumjs-monorepo

Monorepo for the Ethereum VM TypeScript Implementation
TypeScript
2,397
star
2

ethereumjs-tx

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
779
star
3

keythereum

Create, import and export Ethereum keys
JavaScript
602
star
4

ethereumjs-util

Project is in active development and has been moved to the EthereumJS monorepo.
TypeScript
601
star
5

ethereumjs-lib

[DEPRECATED] A JavaScript library of core Ethereum functions
442
star
6

merkle-patricia-tree

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
305
star
7

ethereumjs-abi

[DEPRECATED] Decoder and encoder for the Ethereum ABI
JavaScript
294
star
8

ethereumjs-client

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
192
star
9

ethereumjs-devp2p

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
140
star
10

ethereumjs-blockchain

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
120
star
11

rlp

Project is in active development and has been moved to the EthereumJS monorepo.
TypeScript
120
star
12

ethrpc

Maximal RPC wrapper
JavaScript
109
star
13

ultralight

Ethereum Portal Network TypeScript implementation
HTML
87
star
14

ethereumjs-blockstream

Reliable stream of Ethereum blocks
TypeScript
80
star
15

helpeth

Help (with) Ethereum. Purists' commandline tool for key and transaction management.
JavaScript
75
star
16

browser-builds

[DEPRECATED] Browser builds of ethereumjs libraries.
JavaScript
59
star
17

node-blockchain-server

[DEPRECATED] A simple blockchain server (downloads block and serves them, doesn't do state transitions)
57
star
18

ethashjs

Project is in active development and has been moved to the EthereumJS VM monorepo.
JavaScript
56
star
19

ethereumjs-account

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
44
star
20

geth.js

Start and stop geth from Node.js
JavaScript
44
star
21

ethereumjs-block

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
42
star
22

ethereumjs-units

Ethereum unit conversion.
JavaScript
41
star
23

ethereumjs-connect

[DEPRECATED] Basic Ethereum connection tasks
JavaScript
36
star
24

eth-query

minimal rpc wrapper
JavaScript
28
star
25

node-devp2p

[DEPRECATED] A node.js implementation of the RLPx transport
28
star
26

ethereumjs-common

Project is in active development and has been moved to the EthereumJS VM monorepo.
TypeScript
26
star
27

rustbn.js

Rust to Javascript/Webassembly compilation of ethereum-bn128.rs.
HTML
19
star
28

node-devp2p-dpt

[DEPRECATED] Ethereum Distubted Peer Table Implementation
15
star
29

ethereumjs-ledger

[DEPRECATED] A wrapper library around the Ledger line of devices that attempts to simplify usage and handle various failure modes/problems.
TypeScript
14
star
30

ethereumjs-icap

Utilities for handling ICAP (Ethereum in IBAN) encoding
JavaScript
14
star
31

eth-bin-to-ops

[DEPRECATED] Simple utility for parsing binary evm code into opcodes
JavaScript
13
star
32

ethereum-verified-contracts

[DEPRECATED] Ethereum Verified Contracts
JavaScript
12
star
33

organization

A repo for discussions and other non-code organizing stuff
11
star
34

ethereumjs-testing

This utility library has been moved to the EthereumJS VM monorepo.
JavaScript
11
star
35

ethereumjs.github.io

Website for an intro to the EthereumJS ecosystem
CSS
10
star
36

ethereumjs-stub-rpc-server

Stub Ethereum JSON-RPC Server
JavaScript
9
star
37

node-ethash

Node bindings for the C++ Ethash implementation.
C++
7
star
38

fixed-bn.js

a bn.js wrapper that constrains numbers to a fixed width
TypeScript
7
star
39

ethereumjs-config

[DEPRECATED] Configuration is now added within a config folder of the EthereumJS monorepo
Shell
4
star
40

node-devp2p-eth

[DEPRECATED] Ethereum wire protocol implementation
3
star
41

sharding

Serenity phase 2 shard-chain PoC
WebAssembly
2
star
42

eth-bin-to-method-ids

[DEPRECATED] Extract the four byte method ids from evm byte code
JavaScript
2
star
43

rustbn-wasm

TypeScript
1
star
44

ethereumjs-collation

[DEPRECATED] Implementation of an Ethereum sharding collation
JavaScript
1
star
45

node-devp2p-rlpx

[DEPRECATED] Implements RLPx
1
star