About 4 days of claude work, fully vibed: "Across both the native C-to-C and the JVM/JNI comparison, our custom C secp256k1 implementation — written from scratch — matches or beats Bitcoin's libsecp256k1 on every Nostr-relevant operation, by roughly 10–30% on single ops (sign, verify, ECDH, pubkeyCreate, etc) and 4.5×–8.3× on batch verification." "On batch operations, our batch verify for 200 events hits ~190,000 ev/s through JNI vs ~23,000 ev/s for JNI/libsecp verifying them individually today, a performance gain of ~826% over the current lib". And yes, the lib not only passes all tests from Bitcoin core, but all of our event sign and verify tests as well.

Replies (22)

hello's avatar
hello 4 months ago
people are even doing formal verification to cryptography... not just tests...
oh yeah well i vibed secp256k1 in pure go and skipped all the fancy bitshifting and speed hacks in lieu of highly readable stdlib code and produced something about 10x slower than the reference implementation. and it too passes all the reference tests 😎
Idk if you're joking, but it's a serious concern. Vitor are you or someone close to this code a cryptogrqphery? Is this code going to be part of Amethyst?
No, I got rid of it. We are not a wallet and the keys are always hot in memory. So the protection didn't do much given that the entire app has access to the key at all times. anyone trying to get the key from physical signals the phones electric circuit emits has a better chance of getting the key by observing other parts of the app, not just the signing.
Elmoorishien's avatar
Elmoorishien 4 months ago
About 4 days of claude work, fully vibed: "Across both the native C-to-C and the JVM/JNI comparison, our custom C secp256k1 implementation — written from scratch — matches or beats Bitcoin's libsecp256k1 on every Nostr-relevant operation, by roughly 10–30% on single ops (sign, verify, ECDH, pubkeyCreate, etc) and 4.5×–8.3× on batch verification." "On batch operations, our batch verify for 200 events hits ~190,000 ev/s through JNI vs ~23,000 ev/s for JNI/libsecp verifying them individually today, a performance gain of ~826% over the current lib". And yes, the lib not only passes all tests from Bitcoin core, but all of our event sign and verify tests as well.