Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Utilities for handling Ethereum keys

License

NotificationsYou must be signed in to change notification settings

ethereumjs/ethereumjs-wallet

Repository files navigation

Warning

The repository has been merged intoethereumjs-monorepo. Please head to the new repo for updates.


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 theWallet class like this

Node.js / ES6:

constWallet=require('ethereumjs-wallet').default

ESM / TypeScript:

importWalletfrom'ethereumjs-wallet'

Thirdparty API

Importing various third party wallets is possible through thethirdparty 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 thehdkey 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 isnot very actively maintainedand support has been removed alongv1.0.0 release, seeissue#115 for context.

You can use the the oldsrc/provider-engine.ts code (see associated PR) as some boilerplatefor your own integration if needed.

Remarks abouttoV3

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

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

Depending on thekdf selected, the following options are available too.

Forpbkdf2:

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

Forscrypt:

  • 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 organizationaldocumentation for an introduction toEthereumJS 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 ourcontribution guidelines.

License

MIT License

Copyright (C) 2016 Alex Beregszaszi


[8]ページ先頭

©2009-2025 Movatter.jp