How can I derive BigInt3/EcPoints from an ethereum public key and signature?

Recently @liorgold published a cairo-examples/secp at master · starkware-libs/cairo-examples · GitHub which introduces support to the ECDSA signature verification over the secp256k1 elliptic curve. I am trying to use the code but I am still strugling with what should be the way to transform the public key into an EcPoint and r, s into BigInt3

Can someone give me an example of how to transform this?


    message: 'Some data',
    messageHash: '0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655',
    v: '0x1c',
    r: '0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd',
    s: '0x6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a029',
    signature: '0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c'
    public_key: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23'
13 Likes

Hey I am sorry, I have been busy lately but I saw your message. Will update asap. Did you manage to move forward?
Thanks!

2 Likes

Thanks for your reply @henri.lieutaud ! No not yet. we are still working on it! It would be great if you could provide any insights/examples!

2 Likes

The repo actually contains two examples -

Cairo example
StarkNet example

Let me know if you have any more questions after looking at them

5 Likes

@bbrandtom My question is not on how to use the code but rather on how to prepare the data and transform the public key into an EcPoint and the r,s into BigInt3.

4 Likes

I think I found the answer! I was casually reading some of Cairo source code and I stumbled upon this :smiley: I will test it out and write my findings cairo-lang/secp_utils.py at master · starkware-libs/cairo-lang · GitHub

5 Likes

Hey, great to read! Do post your comments later on, thanks!

3 Likes

Continuing the discussion from How can I derive BigInt3/EcPoints from an ethereum public key and signature?: