In my previous post I got answer but still I need some clarifications let say when deploying contract with node js we have this line

 try {
    web3.personal.unlockAccount(web3.eth.coinbase, password);
} catch(e) {

which is unlocking account to make transaction for contract creation .

What if account is created with this way


And I have private key encyrpted somewhere on the system how I shall use it to unlock (or jsut use account) account let say after a week from it's creation ?

Also can u give details on what does entropy do ?

Is it like password in case of personal account ?

Thanks and sorry if questions are similar , there are not much resources to get more detailed info


1 Answer 1


Having a private key you can create a new account with web3.eth.accounts.wallet.add(account|privateKey)

You can use your account normally after.

// Create account
var account = web3.eth.accounts.create([entropy]);

// Load account

// Set the account as the default
web3.eth.defaultAccount = account.address;

// Use it normally
web3.eth.signTransaction(transactionObject, address [, callback])

In the transactionObject you can omit the from parameter and the default account will be used.

Make sure to read the documentation

  • That is not he answer to my question . ? I know about personal and tx , please read question again .
    – Albert
    Commented Apr 9, 2018 at 5:57
  • Correct typos and rephrase to make it more clear. Ask less questions. I will read your question after Commented Apr 9, 2018 at 9:54
  • Sure I will rephrase the question
    – Albert
    Commented Apr 9, 2018 at 12:47
  • if you import a geth V3 wallet to web3, how do you make it the default address? I can't get web3 to successfully sign txns when using web3.eth.accounts.wallet.decrypt. I try to set web3.eth.accounts.wallet[0]['address'] to default after decrypting. Thanks a bunch. Commented Jun 1, 2018 at 1:10
  • I think I should be using web3.eth.accounts.decrypt perhaps instead of the wallet methods, but there's no clear explanation on this. Commented Jun 1, 2018 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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