0

Can I have some clarification on what is the first argument of web3.eth.sign.

  • it says here that the first argument is a account-- What is an account? Is it my ethereum address or a private key.
  • it says to make sure "the account must be unlocked" -- Im not dealing with geth. How do I unlock my account?

I am just writing test on my smart contract deployment on Ganache and now I need to sign something with a private key hopefully with one of the local account I control on Ganache.

I have tried inserting my ethereum address. After using ecrecover to verify the signer of the signature, I found that the account signing is done by an address 0x3f17f1962B36e491b30A40b2405849e597Ba5FB5 -- apparently this is the address generated from the private key 000..0. Which makes sense because I think I should be passing something like a private key (not the address), hence this api confuses me.

web3.eth.sign(
      <Ganache Ethereum address>,
      text='some-text-tö-sign')

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.