How to Verify the Ownership of Your Ethereum Wallet
I was just looking at these verified signatures on Etherscan the other day. My first thought was that why would anyone want to show off their signatures?
One of the reasons could be that they want to prove that they are the owner of the wallet. Let’s take a look at the real example below.
Verify
You can verify what wallet address signed the message from the message and the signature hash like this.
Why can you verify the ownership of the wallet address? Well because without the private key of the wallet address, you can’t generate that signature hash.
That’s why you can prove that you own the wallet address without revealing the private key.
Sign
You can sign a message like this. So signing a message is equal to creating a signature hash with your private key and message hash.
privateKey, err := crypto.HexToECDSA("fad9c8855b740a0b7ed4c221dbad0f33a83a49cad6b3fe8d5817ac83d38b6a19")
if err != nil {
log.Fatal(err)
}
msg := []byte(`IS THIS MY CONTRACT ADRESS ?
I DON'T UNDERSTAND WHAT TO DO TO GET MY MONEY !!`)
messageHash := accounts.TextHash(msg)
signature, err := crypto.Sign(messageHash, privateKey)
if err != nil {
log.Fatal(err)
}
Some application ideas
If you apply this to some applications, you can do the followings.
- clocking in/out of work
- smart lock
- physical vault
Clocking in/out of work