I tried to initiate a testrpc account and passing my account with value to test the transactions but when I keyed in my key 0x94fd019eeb92780477b01ce5555513d3755b5193 it says that the key is invalid.

Why is it invalid even though its my key?

EDIT: full log of error down below

C:\Users\user>testrpc --account="0x94fd019eeb92780477b01ce5555513d3755b5193,1000" C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:74143 var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WOR

RangeError: private key length is invalid at Object.exports.isBufferLength (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:60654:39) at Object.publicKeyCreate (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:60446:14) at Object.exports.privateToPublic (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:7065:20) at StateManager.createAccount (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:90434:25) at Array.map () at StateManager.initialize (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:90342:33) at new GethApiDouble (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:89816:14) at new Provider (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:28446:23) at Object.create (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:105938:20) at Object.server (C:\Users\user\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:59272:19)

  • Can you provide the full error and the steps to reproduce it please? – Florian Castelain Jan 18 '18 at 3:39
  • @Andromelus I typed in testrpc --account="0x94fd019eeb92780477b01ce5555513d3755b5193,1000" but it gave me invalid key – ethereumnoob Jan 18 '18 at 3:54
  • Shot in the dark, but try dropping the quotes? I helped with an issue earlier relating to that, though frankly I don't think it's likely to be your issue. – user19510 Jan 18 '18 at 6:33

You need to use a private key here, which is 0x + 64 hex characters.

0x94fd019eeb92780477b01ce5555513d3755b5193 is only 40 hex characters and looks like an account address rather than a private key.

If you have the private key for this account, then try that. Depending on how you generated the account, you may not have easy access to the private key. If you have a UTC style key file, then you can use MyEtherWallet's View Wallet Info facility to see it.

  • I tried that as well but it was invalid, I have another testrpc running while doing this though, is that the reason why? – ethereumnoob Jan 18 '18 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.