o1js
o1js copied to clipboard
Improve DevX for ethereum signatures
Summary
O1JS has implemented the primitives needed to verify ECSDA over Secp256k1 signatures (used in ethereum and other blockchains), but the developer experience leaves room for improvement.
Current State
Currently, the examples of the foreign curve features in o1js are missing a demo of verifying a signature created outside of o1js, and a demo of serializing a signature created in o1js for use elsewhere.
There appears to be no API to import a public key (point on a foreign curve) via hex string. This would be a very useful helper for verifying signatures created outside of o1js.
Example
I created a small, demonstrative example of how we can verify an ethereum signature currently, using ethers.js and o1js: https://github.com/45930/ethereum-mina-signatures/blob/5a369f01a709e825c07602a314c9e731b942f24d/src/run.ts
AFAIK, a third party library is needed because ethers.js does not expose the raw point (x,y) value for a public key, and o1js does not expose a fromHex
static method on a FlexiblePoint
.
Request
- [ ] Add an ideomatic helper function in o1js to load a ECDSA public key from a string as exported by popular ethereum libraries like ethers.js and web3.js
- e.g.
0x02d6f1535378e31fd4157f4c25b1083f3de826ba9f6dfc9ed85d037bae0af0db2a
=>{ x: 97221334834783863255825296972943887528361439031388116048503920621661788887850n, y: 114331162635234428354714160655850636928139561391788648658879739511865095545994n }
- e.g.
- [ ] Add an example to o1js demonstrating how a foreign curve signature can be verified without knowing the private key in advance