1

I am using GETH console to unlock the account but i have been consistently getting error "Error: no key for given address or file". I looked into "C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore" and see two files present. could you please guide me if i am doing anything wrong. below is result

of command I executed.


-------------------------------------------------------------------
**List of account on testnet using Geth**

C:\Data\geth-alltools>geth --testnet account list
INFO [07-27|14:05:40.873] Maximum peer count                       ETH=25 LES=0 total=25
Account #0: {407c9c2b699f2380561c2bb13a400e1ea9149930} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T16-37-59.248164300Z--407c9c2b699f2380561c2bb13a400e1ea9149930
Account #1: {2b45bdd81e75be0502469ac81b1089d39cf5c051} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T17-09-09.768503000Z--2b45bdd81e75be0502469ac81b1089d39cf5c051

-------------------------------------------------------------------
**Trying to Unlock the account**



C:\Data\geth-alltools>geth --testnet attach http://localhost:8545
Welcome to the Geth JavaScript console!

instance: Geth/node1/v1.8.12-stable-37685930/windows-amd64/go1.10.3 modules: admin:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0

personal.unlockAccount("2b45bdd81e75be0502469ac81b1089d39cf5c051") Unlock account 2b45bdd81e75be0502469ac81b1089d39cf5c051 Passphrase: Error: no key for given address or file

Update:

Created a new account by using GETH in testnet and searched for the key but still getting the same issue

C:\Data\geth-alltools>geth --testnet account new INFO [07-27|15:31:13.992] Maximum peer count ETH=25 LES=0 total=25 Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {04db25008887fb28e0b8562b9c27f7d6ba0c751f}

file got created in C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore

C:\Data\geth-alltools>Geth --testnet account list INFO [07-27|15:33:20.217] Maximum peer count ETH=25 LES=0 total=25 Account #0: {407c9c2b699f2380561c2bb13a400e1ea9149930} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T16-37-59.248164300Z--407c9c2b699f2380561c2bb13a400e1ea9149930 Account #1: {2b45bdd81e75be0502469ac81b1089d39cf5c051} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T17-09-09.768503000Z--2b45bdd81e75be0502469ac81b1089d39cf5c051 Account #2: {04db25008887fb28e0b8562b9c27f7d6ba0c751f} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T19-31-23.029658500Z--04db25008887fb28e0b8562b9c27f7d6ba0c751f

Following Command was run on geth console

personal.unlockAccount("04db25008887fb28e0b8562b9c27f7d6ba0c751f", "Password",300) Error: no key for given address or file

userid2018
  • 11
  • 3
  • copy the address from eth.accounts as it appears in the list – Nulik Jul 27 '18 at 18:36
  • I just ran the command in console. here is what i get eth.accounts [] – userid2018 Jul 27 '18 at 19:01
  • check https://ethereum.stackexchange.com/questions/8684/error-no-key-for-given-address-or-file-when-unlocking-coinbase-account – Badr Bellaj Jul 27 '18 at 19:20
  • @userid2018 then geth uses another data directory and keystore directory in that data directory doesn't have any accounts – Nulik Jul 27 '18 at 19:26
  • to discover which is the data directory used by your geth create a new account and then search for the address (without 0x) on your disk. The address string is part of the file name. – Nulik Jul 27 '18 at 19:28
  • @BadrBellaj I have seen the thread which you suggested out already and after follwoing the thread I had looked into the keystore but the file was already present in the store – userid2018 Jul 27 '18 at 19:36
  • @Nulik I tried out what you suggested but still same error. Edited main post to include the result. – userid2018 Jul 27 '18 at 19:41
  • use personal.newAccount("whatever") from console , it is going to create the account in the correct data directory, then you just search for the address on your disk, and this is how you discover the correct location of the keystore directory. Move your own accounts there, remove this newly created account, restart geth and that's it. – Nulik Jul 27 '18 at 19:48
  • @Nulik : Thanks for the help. It worked. Geth was creating the key files in the datadir specified while running Geth – userid2018 Jul 30 '18 at 12:25

2 Answers2

0

you don't define the account's password : it should be somthing like this :

personal.unlockAccount("2b45bdd81e75be0502469ac81b1089d39cf5c051", "mypassword")

check unlockAccount definition :

personal.unlockAccount(address, passphrase, duration)
Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75
  • just tried personal.unlockAccount("2b45bdd81e75be0502469ac81b1089d39cf5c051", "mypassword",300). still get the same error. – userid2018 Jul 27 '18 at 19:05
0

there are 2 ways

  1. unlockAccount by this command

personal.unlockAccount(address, passphrase, duration)

  1. unlockAccount when starting up your node

geth --unlock "YOUR_ACCOUNT_ADDRESS" --password "YOUR_PASSWORD"