5

I'm running a chainlink node on mainnet. My chainlink node has an ether balance I would like to withdraw, but I'm not sure how to find the private key for the node wallet.

I know that the tempkeys folder generated in ~/.chainlink is important, but even after reading the contents (using sudo vim), I still cannot understand where the private key is.

Thanks!

4 Answers 4

4
  1. Go to your tempkeys folder. You'll need to be root, become root with sudo su - and when you're done with all the steps, logout with logout
  2. The file in there is known as your keystore.json, copy that file. This is an encrypted version of your nodes private key.
  3. Import it into your wallet of choice, and you can unlock it with the password you locked it with. Here is a tutorial from MyCrypto.

With Metamask, you can just go to import wallet choose json file and use the password you used to encrypt it.

1
  • 2
    I can confirm that it worked here. Thanks @patrick-collins! Jan 13, 2021 at 10:03
2

To my knowledge, there's no implementation of withdrawing your Ethers out of the Chainlink Node's wallet, but the accounts are generated with Geth's Go library [1], so in theory you could copy that folder and import the accounts using a local Geth node[2]. There you would have full access to your funds.

Also, the geth's library is used to encrypt the files at ~/.chainlink folder (which by the way is the reason why you can't simply read the private key when opening with Vim). [3]

0

I was able to export the keystore from the database then import the keystore using the keystore password into metamask.

Grab the keystore JSON blob from the DB

select json from keys limit 1;
0

The current version of the Chainlink node (1.3.0) stores the keys in the PostgreSQL database. To read them, execute the following query:

select encrypted_keys from encrypted_key_rings;

To decrypt the ciphertext, use the password you set for the key store of your Chainlink node and prefix it with master-password-. This is required because this is what Chainlink does when encrypting your keys

Unfortunately, Chainlink seems to use a custom storage format for these keys. They seem to store the key in V2 format in the ciphertext. You can see how to decode it in their code here: https://github.com/smartcontractkit/chainlink/blob/b1d8c8600d33d4e56e31bb3ed766db019a83f434/core/services/keystore/keys/ethkey/key_v2.go#L17

Looks to me like there is no way to decode this with off-the-shelf tools.

Your Answer

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

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