RooSoft
Schnorr signatures - anyone here willing to collaborate or create a lib?
Been tinkering with nostr lately. It’s a new open protocol being built in the wild. It has a possibility to disrupt centralized social networks such as Twitter. It’s been recently funded by Jack Dorsey, which is the Twitter founder himself. He’s actually using it and he said that it’s much like the very early Twittr days, with better potential. Ok, enough about Dorsey…
What’s interesting here, is that it’s possible to create all sorts of things that can communicate on this network without having to ask permission. I’d personally like to create bots. Even so, clients meant for people are very rudimentary and I have a good feeling this thing could be greatly improved with realtime Phoenix LiveView apps, for instance.
Problem is… to send anything on this network, messages have to be signed with Schnorr Signatures and I can’t find any lib that can natively do it either for Elixir or Erlang. By the way, this signature scheme is also enabling the new Bitcoin taproot addresses.
So, this is a call to elixir cryptographists and math wizards… is there anyone here willing to collaborate or create such a lib? I’m willing to do my part and would most probably make good use of it.
Most Liked
al2o3cr
There are parts that could be tricky in pure Erlang / Elixir, for instance anything that requires constant-time arithmetic.
One way to avoid that would be to wrap an existing Rust library like k256 with Rustler. I’m neither a cryptographer nor much of a Rust dev, but this example seems like it wouldn’t be too much hassle to hook up.
davidarmstronglewis
Hey! Did a rough implementation that I think covers your use-case
https://github.com/davidarmstronglewis/k256
alias K256.Schnorr
signing_key = Schnorr.generate_random_signing_key()
message = "This is some content to sign"
assert {:ok, signature} = Schnorr.create_signature(signing_key, message)
assert {:ok, verifying_key} = Schnorr.create_verifying_key(signing_key)
assert :ok = Schnorr.validate_signature(message, signature, verifying_key)
There’s a few things I’m not happy about in this first pass
- I’m not pre-compiling anything for downstream users, that’ll probably be necessary if this is being published to Hex.
signatureandverifying_keyare all lists, but I think people would expect binaries or some other opaque blob. Not sure the best way to do this atm.- Missing specs.
- READMEs are whatever was generated by default, docs are minimal
Let me know your thoughts and if you’d like I can run through anything you’d like to know more about ![]()
Again, not a cryptographer, don’t know much about nostr, but enjoyed the challenge here.
RooSoft
Thanks, I will try this right away and potentially start a nostr lib today, thanks to you!
I Agree about the 4 improvements, in the same order. Binaries would be the best as input.
Last Post!
leishman
We just shipped the update to BitcoinEx to support Schnorr signatures: GitHub - RiverFinancial/bitcoinex: Bitcoin utilities in Elixir · GitHub
Popular in Discussions
Other popular topics
Chat & Discussions>Discussions
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









