immutability-io / vault-ethereum

A plugin that turns Vault into an Ethereum wallet.
243 stars 65 forks source link

Sign message & verify signed message are not working properly #78

Open MonarthS opened 4 years ago

MonarthS commented 4 years ago

Detailed Description

I was trying to sign message using api:

http://localhost:8200/v1/ethereum/accounts/myacc1/sign

got sign data:

"data": {
        "address": "0x6766f3cfd606e1e428747d3364bae65b6f914d56",
        "signature": "0x0c45d788a91cfee5b46c4bfaa00c89b32fe249380b8858807e1c02256486ac9c518c5f4feb2b0a504e37354f3912b00f5a73aa581d757fb225130165d030a0b400"
}

But when I signed same message using web3 getting different signature:

0x34b6d5a2b99234b1e5cc36e0bf0aeb0fa5d667773458c2ac293f74a213a399ed12be94bfc07a1eadc4008ce6e788ab625423c9d13ca3c5a785e7c8874b6080fc1b

also when I try to verify:

http://localhost:8200/v1/ethereum/accounts/myacc1/verify

Its giving me error:

image

Context

Generated signature should be same as web3 & verify methods should work.

Your Environment

OS=Ubuntu 18.04 PLUGIN_VERSION="0.2.11" VAULT_VERSION="1.0.3"

MonarthS commented 4 years ago

Solve signature problem by adding \x19Ethereum Signed Message:\n as prefix of message.

@cypherhat can you please check this?