0

I want to sign message in remix, interacting with ethereum contract.

But I can't find private key.

enter image description here

Long Luong
  • 764
  • 2
  • 14
  • 28
silva
  • 405
  • 4
  • 8
  • You can't get private key on Remix. There is only one way to test with private key, the solution is use web3 provider and use your private key but it's only for test code. – Fullstack Developer Nov 13 '20 at 02:14
  • here you can find the list of private keys of remix accounts. [https://ethereum.stackexchange.com/questions/78040/is-there-a-way-to-view-the-private-key-of-test-account-in-remix-javascript-vm](https://ethereum.stackexchange.com/questions/78040/is-there-a-way-to-view-the-private-key-of-test-account-in-remix-javascript-vm) – Umar Raza Sep 07 '22 at 15:23

1 Answers1

1

You can't get the private key from the embedded accounts in the "JavaScript VM" environment in Remix. What you need to do is download and run Ganache and switch the environment over to "Web3 Provider".

When you start Ganache, you'll see a summary of accounts and private keys like the following:

Available Accounts ================== (0) 0x9a6d82ef3912d5ab60473124bccd2f2a640769d7 (1) 0x65463bf6268e5cc409b6501ec846487b935a1446 (2) 0xb98e575977160c29301f8f9444710048c5bb9a1c (3) 0x1655e4b2e19d5934d9336f8b1dd351e14ce466ba (4) 0x40ade79c474c47991fcb1b62308a4e755864e24d (5) 0x4888ba85dd44fd3416a0788ab9bde63290a6c8e2

Private Keys ================== (0) 70f1384b24df3d2cdaca7974552ec28f055812ca5e4da7a0ccd0ac0f8a4a9b00 (1) ad0352cfc09aa0128db4e135fcea276523c400163dcc762a11ecba29d5f0a34a (2) 85fa10d6fc72b1b86e0b876167507297b21aae5f4bcd7d518c11c837c6229b3f (3) c49f807bc5e8d332df558f77fdd48f10b112a8f2c2ce50a32d09def7d7d1ef16 (4) d38e9c788f4c6d09f0da1ff8140bf8600aacca559ba3b82ff7cd76e450f3c5f4 (5) d8acd90819cee0299336324ff56b87524c165e8ad7fd6d150c518f89754059e3

Use one of those private keys to sign your transaction.

The list of accounts and private keys change after every restart. If you need to have them persist, start Ganache with the --accounts option

ganache-cli --account "0x70f1384b24df3d2cdaca7974552ec28f055812ca5e4da7a0ccd0ac0f8a4a9b00,300000000000000000000" --account "0xad0352cfc09aa0128db4e135fcea276523c400163dcc762a11ecba29d5f0a34a,300000000000000000000"
Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48