-
Notifications
You must be signed in to change notification settings - Fork 299
Cannot read property 'kdf' of undefined #23
Comments
Could you paste the whole error stack trace below |
TypeError: Cannot read property 'kdf' of undefined |
Ah, just remembered, the current release of this library is pretty outdated (>1yo). We really have to do a new release on this, lot of PRs were merged in between. Please try again and let's eventually investigate further once this new release is out. If you need this urgently you might have to manually install/update to the |
Cool. Thanks @holgerd77 . Not urgent for now as the following is working |
works with setting nonStrict to true i.e. wallet.fromV3(input,password, true) |
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.
The text was updated successfully, but these errors were encountered: