Coder Social home page Coder Social logo

ethereumjs-wallet's Introduction

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

ethereumjs-wallet's People

Contributors

acolytec3 avatar alcuadrado avatar arachnid avatar axic avatar chaitanyapotti avatar dadepo avatar dmihal avatar evertonfraga avatar holgerd77 avatar jwasinger avatar jwerle avatar lucidsamuel avatar michaelsbradleyjr avatar nebojsa94 avatar paulmillr avatar ryanio avatar the-jackalope avatar vipyne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereumjs-wallet's Issues

Incorrect instructions in README.md

The integration to provider-engine usage should be
<engine>.addProvider(new WalletSubprovider(<wallet instance>,{}))
instead of
<engine>.addProvider(new WalletSubprovider(<wallet instance>))

otherwise issue from #48 will happen.

Private Key Must Be 32 Bytes

Following the instructions to create an HD wallet here throws the error that the private key must be 32 bytes. Using bip39 to generate the mnemonic and the mnemonicToSeedHex to get the seed from the mnemonic doesn't seem to work. How can I generate a seed that is 32 bytes?

const mnemonic = bip39.generateMnemonic();
console.log(bip39.mnemonicToSeedHex(mnemonic).toString());
const newAccount = bip44hdkey.fromMasterSeed(mnemonic);    //doesn't work with mnemonicToSeedHex
const keynode = newAccount.derivePath("m/44'/60'/0'/0");
const address = keynode.deriveChild(0);

getAddress() fails in Firefox

Code:

import Wallet from 'ethereumjs-wallet'
export class Test {
    constructor() {
        this.wallet = Wallet.generate()
        let addr = this.wallet.getAddress()
        console.log(JSON.stringify(addr))
    }
}

Error in browser console:

Message: false == true
Inner Error Stack:
exports.publicToAddress@http://localhost:9000/jspm_packages/npm/[email protected]/index.js:148:5
Wallet.prototype.getAddress@http://localhost:9000/jspm_packages/npm/[email protected]/index.js:64:12
Test@http://localhost:9000/dist/test.js:22:28

It's this line:
assert(pubKey.length === 64);
here: https://github.com/ethereumjs/ethereumjs-util/blob/v4.5.0/index.js#L342

I stepped through it once in debugger. pubKey.length is 65.

Tested on Firefox 49.0.2 and 51.0a2 (dev) on Linux 64bit.
On current Chromium it works fine.

I'm not sure if the issue is in ethereumjs-wallet or in ethereumjs-util (or even a in dependency below).

Unable to Generate Same Account from MetaMask Mnemonic

Hello -
I've been unable to generate the account I see in MetaMask from the same Mnemonic.
Due to the lack of documentation, I may be misunderstanding how to do so.
I have tried running the following in a Truffle Node console in my Terminal:

var seed = bip39.mnemonicToSeed(mnemonic)
var wallet_test = hdkey.fromMasterSeed(seed)
wallet_test.derivePath("m/44'/60'/0'/0/0")
wallet_test.derivePath("m/44'/60'/0'/0")

var seed = bip39.mnemonicToSeedHex(mnemonic)
var wallet_test = hdkey.fromMasterSeed(seed)
wallet_test.derivePath("m/44'/60'/0'/0/0")
wallet_test.derivePath("m/44'/60'/0'/0")

But none of them have outputted the same account I have in MetaMask.
Can anyone point out why this doesn't work please?

If it helps, this does work with truffle-hd-wallet-provider

Generate address

Hi all. Is there a way to generate addresses from private key ? I think I need to generate pair keys from private key (public and private) , than using public key generate addresses. Is this possible ?

Update dependencies before new release

Dependencies on this library are pretty outdated and should be updated and tested before a new release.

Short dependency analysis:

Name Installed (noted, max) Latest Notes
aes-js ^0.2.3, 0.2.3 3.1.0 Major API changes, no known security fixes
bs58check ^1.0.8, 1.3.3 2.1.1  Minor fixes, no known security fixes
ethereumjs-util ^4.4.0, 4.5.0 5.1.3  Some breaking changes, serious bug fixes
 hdkey ^0.7.0, 0.7.1 0.7.1  Still latest release (though old)
scrypt.js ^0.2.0, 0.2.0 0.2.0 Still latest release (though old)

WalletSubprovider uses a method that doesn't exist

WalletSubprovider uses a non-existent method (getAddressesString) on the Wallet type. I was able to fix it by monkey-patching the wallet type before adding the provider to the engine.

w.getAddressesString = (() => { return '0x'+w.getAddress().toString('hex'); });

Appcelerator Titanium compatible?

does anyone know if this can be used with Appcelerator mobile sdk? it's JS based and use CommonJS. I'm about to test it but wondering if anyone had tried.

Unable to transfer to ethereumjs-wallet address

Hi ,

I have generated private and public keys from ethereumjs-wallet.
Also I have started my geth node private network and opened geth console.

Now I want to do transactions from accounts created using geth console address and ethereumjs-wallet address.
It is showing error Invalid address below error.

**Error: invalid address
at web3.js:3930:15
at web3.js:3759:22
at web3.js:502

Actually I want to create an exchange where users will have private and public keys. As I am unable to create private keys In geth, I have used ethereumjs-wallet for private and public keys. Please let me know regarding this.

Thanks,
Ramesh.

getAddress doesn't support different address indices

I noticed that I can only generate one address per account (if I'm mistaken let me know!) However I think this is the case given the declaration lacks a parameter for indices.

Is there a reason why this feature is not supported by ethereumjs-wallet?

I've also noticed that many ethereum clients do not support generating multiple addresses for the same account, however since the wallet structure is BIP44, the functionality clearly exists. I could be missing something that is more related to convention than it is to utility.

Understanding Chain code

Hi all. I am trying to learn/create HD wallet based on nodejs. I have already created my HD wallet and now need to make transactions. This wallet is created from extended public key - xpub (I also have a xpriv). So when I am running console.log(wallet) there is chainCode property. I can not understand what is it ? Also I have used it to sign/confirm trasnaction but I can not understand what is it and why I need to use it to sign transaction.

To make/and sign trasnaction I am using ethereumjs-tx and give wallet._hdkey.chainCode to tx.sign().
Please help me to understand what is it and why/where I need to use it?
Any suggestions would be much appreciate.

scrypt fails to install on Azure

Have tried changing the node/npm version still getting the same error, this was installing properly on local environment, but not on Azure web app.

Please help.

[email protected] preinstall D:\home\site\wwwroot\node_modules\scrypt
node node-scrypt-preinstall.js

[email protected] install D:\home\site\wwwroot\node_modules\scrypt
node-gyp rebuild

D:\home\site\wwwroot\node_modules\scrypt>if not defined npm_config_node_gyp (node "D:\Program Files (x86)\npm\5.6.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "D:\Program Files (x86)\npm\5.6.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
D:\home\site\wwwroot\node_modules\scrypt\build..\scrypt\win\include\config.h
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
D:\home\site\wwwroot\node_modules\scrypt\build\copied_files.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
D:\home\site\wwwroot\node_modules\scrypt\build\scrypt_wrapper.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: D:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Program Files (x86)\npm\5.6.0\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "D:\Program Files (x86)\nodejs\8.11.1\node.exe" "D:\Program Files (x86)\npm\5.6.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\scrypt
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
�[37;40mnpm �[30;43mWARN [email protected] No repository field.

�[37;40mnpm �[31;40mERR! code ELIFECYCLE
�[37;40mnpm �[31;40mERR! errno 1
�[37;40mnpm �[31;40mERR! [email protected] install: node-gyp rebuild
�[37;40mnpm �[31;40mERR! Exit status 1
�[37;40mnpm �[31;40mERR!
�[37;40mnpm �[31;40mERR! Failed at the [email protected] install script.
�[37;40mnpm �[31;40mERR! This is probably not a problem with npm. There is likely additional logging output above.

�[37;40mnpm �[31;40mERR! A complete log of this run can be found in:
�[37;40mnpm �[31;40mERR! D:\local\Temp\monacositeextension\temp_logs\2018-05-16T10_51_59_087Z-debug.log

Cannot read property 'kdf' of undefined

Hi,

I am trying to use fromV3 method for deploying a smart contract.

Here is a snippet from my truffle.js.

var WalletProvider = require("truffle-wallet-provider");
var keystore = require('fs').readFileSync('./test/keystore/key.json').toString();
var pass = require('fs').readFileSync('./test/keystore/pass').toString();
var wallet = require('ethereumjs-wallet').fromV3(keystore, pass);

The execution stops and I get an error -

TypeError: Cannot read property 'kdf' of undefined

The files are being read properly when checked by doing console.log.

The key.json file has been exported from My Ether Wallet and looks something like:

Replaced actual values with some variables to post here.

{
"version":3,
"id":"myId",
"address":"myAddress",
"Crypto":{
"ciphertext":"myCiperText",
"cipherparams":{
"iv":"4d358169efe50d20f1f68f66c77b97b1"
},
"cipher":"aes-128-ctr",
"kdf":"scrypt",
"kdfparams":{
"dklen":32,
"salt":"mySalt",
"n":1024,
"r":8,
"p":1
},
"mac":"myMac"
}
}

Could someone let me know if the key.json file format is incorrect ?

BTW, the following works just fine.

var WalletProvider = require("truffle-wallet-provider");
var pkey_str = require('fs').readFileSync('./test/keystore/key').toString();
var prkey_buff = new Buffer(pkey_str, 'hex')
var wallet = require('ethereumjs-wallet').fromPrivateKey(prkey_buff)

So, issue is just with fromV3()

Thanks.

dist/hdkey.js (Maintainer Update: Critical bug in v0.6.1, now fixed with v0.6.2, please update!)

With the new 0.6.1 release, this:

const hdkey = require('ethereumjs-wallet/hdkey');

Must be changed to:

const hdkey = require('ethereumjs-wallet/dist/hdkey');

Maybe that's not what you intended? Even though your pkg.json main points at dist/, a module reference like 'ethereumjs-wallet/hdkey' only works if hdkey.js is at the top-level of the package.

In the published package, you could include an hdkey.js that's a one-liner:

module.exports = require('./dist/hdkey.js');

However, you would need to reorg the sources that get transpiled by babel under src/ and update the build:dist script accordingly.

Import from private key not working

I exported my JSON wallet account from Parity and decrypted the JSON file in MyEtherWallet.

When I tried to use .fromV3(Buffer.from('<PRIVATE_KEY>'), I get an error:

Error: Private key does not satisfy the curve requirements (ie. it is invalid)

I am not sure why this would not work, the private key should definitely be valid.

Minimal browser builds

by supplying our own more minimal version of https://github.com/crypto-browserify/crypto-browserify
we can drop the following deps:

require('diffie-hellman')
require('browserify-sign')
require('create-ecdh')
require('public-encrypt')

bc we are only using

crypto.randomBytes
crypto.pbkdf2Sync
crypto.createCipheriv
crypto.createDecipheriv

we just need to make a more minimal crypto entrypoint https://github.com/crypto-browserify/crypto-browserify/blob/master/index.js
and sub it out with the browser field https://github.com/substack/node-browserify#browser-field

Metamask account

Hi all. I am trying to make a wallet using ethereumjs-wallet lib and than import into metamask.
Here is my code

const hdkey = require('ethereumjs-wallet/hdkey');
const bip39 = require('bip39');
var seed = bip39.mnemonicToSeed('my_mnemonic_phrase','my_password');
var wallet = hdkey.fromMasterSeed(seed);
var xPriv = wallet.privateExtendedKey();
var priv = seed.toString('hex');

When trying to import account using xPriv and priv I am getting an error that the private key is invalid.

Can someone explain how can I create wallet and import into metamask?

I can’t call the HD wallet function . T

This code could work in server end . And I want to implement it on client end with html.
I have already applied the wallet and hd wallet browse build , still doesn't work.

<script type="text/javascript" src="./lib/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="./lib/web3.min0_2.js"></script> <script type="text/javascript" src="./lib/bip39.min.js"></script> <script type="text/javascript" src="./lib/hdkey.min.js"></script> <script type="text/javascript" src="./lib/ethereumjs-wallet-hd-0.6.0.js"></script> <script type="text/javascript" src="./lib/ethereumjs-wallet-0.6.0.js"></script>

var mnemonic = seed_one ;
var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));
var wallet_hdpath = "m/44'/60'/0'/0/";
var wallets = {};
var addresses = [];
var num_addresses = 5 ;
var address_index = 0 ;
console.log(hdwallet);

// generate new addres by mnemonic
for (let i = address_index ; i < address_index + num_addresses ; i++){
var wallet = hdwallet.derivePath(wallet_hdpath + i).getWallet();
var addr = '0x' + wallet.getAddress().toString('hex');
addresses.push(addr);
wallets[addr] = wallet;
}

Uncaught TypeError: hdwallet.derivePath is not a function

Private key security issue

After call .fromV3() or .fromMasterSeed() all private key will be decrypted/generated and store on memory, that's insecure. Could we store private key in encrypted form or defined a method to clear private key in memory?.

Import account into Metamask

Hi all. I am trying to make a wallet using ethereumjs-wallet lib and than import into metamask.
Here is my code

const hdkey = require('ethereumjs-wallet/hdkey');
const bip39 = require('bip39');
var seed = bip39.mnemonicToSeed('my_mnemonic_phrase','my_password');
var wallet = hdkey.fromMasterSeed(seed);
var xPriv = wallet.privateExtendedKey();
var priv = seed.toString('hex');

When trying to import account using xPriv and priv I am getting an error that the private key is invalid.

Can someone explain how can I create wallet and import into metamask?

getAccounts method undefined using HD key creator with getWallet

I've followed the readme closely and attempted to created a script to test compatibility of ethereumjs-wallet and web3-provider-engine with web3 v1. However, execution never reaches web3 object instantiation. My goal is to use private keys with infura, but testing with HD wallet API is more convenient. I called getWallet() before adding HD instance to provider as noted, but it does not seem to work.

Wallet {
  _privKey: <Buffer e0 0f a6 bc 51 ff 9a 74 56 51 de a0 cf cf d9 8c c7 46 27 70 02 36 b6 64 75 a6 ab 91 37 aa 97 17>,
  _pubKey: undefined }
/Users/path/node_modules/ethereumjs-wallet/provider-engine.js:11
  opts.getAccounts = function (cb) {
                   ^
TypeError: Cannot set property 'getAccounts' of undefined
const Web3 = require('web3'); //v1.0.0-beta.26
const ProviderEngine = require('web3-provider-engine');
const WalletCreator = require('ethereumjs-wallet');
const WalletSubprovider = require('ethereumjs-wallet/provider-engine');
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js');
var HdKeyCreator = require('ethereumjs-wallet/hdkey');

const fs = require('fs');

// const input = fs.readFileSync('path_to_wallet.txt', 'utf8');
// const password = 'mypass';
const seed = 'one two three four five six seven eight nine ten eleven twelve';

const myEngine = new ProviderEngine();

// const myWalletFromGeth = myWalletCreator.fromV3(input, password, true);
const myHdWallet = HdKeyCreator.fromMasterSeed(seed);
const walletInstance = myHdWallet.getWallet();

myEngine.addProvider(new WalletSubprovider(walletInstance));

const host = 'https://mainnet.infura.io/key'

myEngine.addProvider(new RpcSubprovider({
    rpcUrl: host,
  }))

const web3 = new Web3(myEngine);

console.log(web3);

What am I missing here? Many thanks.

Publish `generateVanityAddress` to NPM

Wallet.generateVanityAddress is currently not available on NPM as it was added after the current latest 0.6.0 release.

Please bump the version and publish, so it becomes available. Thanks!

Workaround in the meantime:

    // package.json
    "ethereumjs-wallet": "git://github.com/ethereumjs/ethereumjs-wallet.git#21e7127c15be4adc1fee458c669b0c6cb4f2ffcd",

Wallet.getAddressString() returns all lower case string causing checksum to fail during signing

The getAddressString() method in the Wallet object returns the public address in all lower case. This makes a subsequent call to the Web3JS sign() method fail because of a checksum capitalization check. The getAddressString() method should return the address without changing the capitalization of it.

Provided address <address> is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

The other getters that return addresses as strings should do the same.

crypto library not found in ethereumjs-wallet

I am importing ethereumjs-wallet in angular4,

import EthereumWallet from 'ethereumjs-wallet';
var wallet = EthereumWallet.generate();
const jsV3 = wallet.toV3(passwd);
the code inside the library shown as below
var privKey = crypto.randomBytes(32)
throws out an error

ERROR Error: Uncaught (in promise): TypeError: crypto.randomBytes is not a function TypeError: crypto.randomBytes is not a function TypeError: crypto.randomBytes is not a function at Function.webpackJsonp.../../../../ethereumjs-wallet/index.js.Wallet.generate

The same problem applies to

  var mnemonic = bip39.generateMnemonic();
  var privateKey = hdkey.fromMasterSeed(mnemonic)._hdkey._privateKey
  const wallet = EthereumWallet.fromPrivateKey(privateKey)

TradePageComponent.html:1 ERROR TypeError: crypto.createHmac is not a function
at Function.webpackJsonp.../../../../hdkey/lib/hdkey.js.HDKey.fromMasterSeed
(hdkey.js:162) at Function.webpackJsonp.../../../../ethereumjs-wallet/hdkey.js.EthereumHDKey.fromMasterSeed (hdkey.js:17)

how to solve the crypto library ?

fromEthSale() not working with certain password lengths

I used the function: Wallet.fromEthSale(obj,password') and when I ran that using this GitHub library, it throws an error(Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt). I tried debugging the code by removing autopadding and then, it runs the code but in the end, it doesn't generate correct eth address. I can understand this as the input object may not be the multiples, i.e why might require padding to fill remaining bits of input.

But with padding, it is throwing that error. The variables used are:
obj - JSON object
password - password linked to ethereum address

The values that came out while debugging:
encseed = <Buffer 7e cd 94 5d bd 10 cf 5d ff c2 fc 3d 8d ef e3 b9 f6 d5 f0 5f 6a cb 14 ca 54 b9 79 d3 9c 2a 4a 0f 82 54 7c ....... >
Derived Key: <Buffer 79 ab b2 5d 93 b7 00 fc cb 56 83 .........>

In decipherBuffer function where the error is coming, the values passing are:
decipher: Decipheriv {
_handle: {},
_decoder: null,
_options: undefined,
writable: true,
readable: true }
data: <Buffer f6 d5 f0 5f 6a cb 14 ca 54 b9 79 d3 9c 2a 4a 0f 82 54 7c 6f 1b e4 23 eb 25 4e 1c f6 e0 57 b7 4b c7 ........ >
Decipher update: <Buffer 45 0c a6 56 cf e6 58 92 ae e7 e3 c8 93 ff 01 44 15 cb 88 f4 6e cb ac 9c f0 35 f8 95 a5 79 fd 12 45 ........ >

These are the samples of what is getting in the function.

I am using Docker on EC2 instance to run this.

Can not install package

I am trying to install package but getting an error look like this

gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\EvenPC\AppData\Local\Programs\Python\Python36\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:276:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\EvenPC\Even\chain\node_modules\scrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\EvenPC\AppData\Roaming\npm-cache_logs\2018-10-29T13_12_57_933Z-debug.log

I have already installed python

C:\Users\EvenPC\Even\chain>python
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

How can I solve this error ?

crypto (This package has been deprecate)

ERROR in ./node_modules/ethereumjs-wallet/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/zheyi/work_energy/greenToken/weex/node_modules/ethereumjs-wallet'
@ ./node_modules/ethereumjs-wallet/index.js 2:13-30
@ ./node_modules/ethereumjs-wallet/hdkey.js

how can i solve

Help needed with using ethereumjs-util and ethereumjs-wallet for a js script

Recently, a relative of mine, someone around 70 years of age and not very tech savvy, approached me to help him with his ethereum wallet. He was unable to access it and send some tokens. I soon realised that there was something wrong with his private key, as there were only 61 characters instead of 64. It was very unfortunate, as a lot of tokens were stuck in that wallet.

But I do believe that there is a way to bruteforce the private key out, since only 3 characters were missing. That was when I found a support article on missing characters of private key(linked below), as well as the javascript which was kindly shared with the public.

https://support.mycrypto.com/private-keys-passwords/missing-characters-of-private-key.html
https://gist.github.com/tayvano/7755e3e8d8b64581d5ff2865087b93f8

However I believe there's some issue with the ethereumjs-util or wallet? I am not very experienced or tech savvy so I can't figure out what is wrong. But I have attached a screenshot as well

1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.