Answer the question
In order to leave comments, you need to log in
How to import an account into web3 v1.xx knowing the private key?
I am using ganache-gui. He offers me many accounts where 100eth lies, private keys for these wallets and mnemonics.
I connect to the blockchain through nodejs and web3 v1. How can I use some blockchain wallet knowing its key? I tried to use web3.eth.accounts.privateKeyToAccount(privateKey)
But then web3 creates a NEW account instead of importing the existing one by key.
And if you connect to the same test network via metamask and import the account key from ganache into it, then metamask will successfully import the account with ether on the account. How to achieve this through nodejs?
Additional question: can I import all accounts using ganache mnemonics or do I need something else?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question