RooSoft

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

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

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

  1. I’m not pre-compiling anything for downstream users, that’ll probably be necessary if this is being published to Hex.
  2. signature and verifying_key are all lists, but I think people would expect binaries or some other opaque blob. Not sure the best way to do this atm.
  3. Missing specs.
  4. 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 :slight_smile:

Again, not a cryptographer, don’t know much about nostr, but enjoyed the challenge here.

RooSoft

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

leishman

We just shipped the update to BitcoinEx to support Schnorr signatures: GitHub - RiverFinancial/bitcoinex: Bitcoin utilities in Elixir · GitHub

Where Next?

Popular in Discussions Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 14350 124
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement