2

I've compiled a version of geth where I modified CalcDifficulty() in core/block_validator.go to make mining difficulty constant, see reference. Starting up the private chain, creating accounts and mining works fine.

If I try via the javascript console to unlock an account, it works, and returns true.

personal.unlockAccount(eth.accounts[0])

But when I try to send a transaction:

personal.sendTransaction({from:eth.accounts[0], to: eth.accounts[1], value: 20000000})

I get the following:

Error: could not decrypt key with given passphrase
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:1
smuseus
  • 23
  • 2

1 Answers1

3

The personal.sendTransaction method expects a second argument, the password to ephemerally unlock the account with and send the transaction in one go. If you don't provide a password, this endpoint defaults to the empty password, resulting in your issue.

If you want to use an already unlocked account to send a transaction (instead of the ephemeral unlock-and-send), you can do so with eth.sendTransaction.

Péter Szilágyi
  • 10,436
  • 39
  • 42