Do you know how to validate wallet signature sent from ethers/web3 signed message?

In Javascript libraries there is this helper:


That takes in a nonce and the signature and validates it returning the address. Is there a library that does this in Elixir?

Did you ever figure this out? I’m looking at this too right now :).

I’m working on this as well, just having some trouble properly doing the verification of the signature by using ExSecp256k1.recover_compact. It’s kind of complicated to figure out how the JS libraries do the recover. I was looking at the ethers library for reference.

Have you seen this library? I think all the functions are there to verify is a message was signed by a keypair but there are no examples with how to desctrucure the signature & get the address from private key (eth wallet) but I would ideally want to use the ExSecp256 library with the Rust NIF

@wking-io @cgraham I’ve just published an update to the web3x library I recently created and maintain in version 0.6.3 (fork of exw3) with this feature included & tested.

This is the function verify_message?/4 you would use to determine a successful validation of wallet signature sent form ethers/web3 given a public_address, message, signature, nonce (that is present in the message that was signed).

Lmk if you have any questions! I found that this was missing in the community & decided to open-source it to inspire more elixir devs to build cool stuff that interacts with ethereum :slight_smile:

Nice! I implemented Personal ec_recover (web3.eth.personal — web3.js 1.0.0 documentation ) which I was going to share to github once I got my act together (I went lower level than exw3). If you want it, just let me know. I started working on typed message 3 and 4 but did not complete it and would love to get this done if there are co-collaborators.

Hoping to make Elixir into a great web3 language :slight_smile:

1 Like

Would be great to take a look at your ecRecover implementation!

So sorry about the delay. I finally added it to Hex. You should now be able to just include it and use it. I am hoping myself or someone will add TypedSignature next!

1 Like