pubky / pkarr

Public Key Addressable Resource Records (sovereign TLDs)
https://app.pkarr.org
MIT License
187 stars 20 forks source link

Rewrite in Rust #7

Closed dpc closed 11 months ago

dpc commented 1 year ago

I was going to ask if there are any plans, but I've noticed that README says:

Reimplement everything in Rust once the JS implementation is tested with some scale.

So I would be interested in using Rust implemenation and helping get it done.

dpc commented 1 year ago

I'd like to get Fedimint off DNS, since it's a big usability barrier. Ideally every Fedimint node would join DHT and store records for its peer and other federations, and be a DoH relay.

I'm not sure if an issue is a best place to discuss it. Maybe you could enable github Discussions, or set up some other "community building" place. If you have time, maybe you'd like to chat on a video call with me and other Fedimint developers to see if technically things add up together.

Nuhvi commented 1 year ago

@dpc I am trying, but learning Rust is so hard :'D It doesn't help that I am skeptical of using off-the-shelf tools and want to learn everything with as few dependencies as possible.

I am very open to jump on a call with you anytime.

So far I didn't do much community building though, I have a Matrix room that I didn't invite anyone to yet. #pkarr:matrix.org, I am also on Matrix @nuhvi:matrix.org

Nuhvi commented 1 year ago

So far I managed to do the absolute basics in Rust: make Ping request and parse a response.

Alternatively, I can fork other DHT clients, probably this one, add support for BEP0044, and accept its complexity and async nature.

Rust mentorship would be really appreciated.

Nuhvi commented 1 year ago

The most pragmatic plan though is:

  1. Keep all servers in JS for now
  2. Rewrite a "proxied" client in Rust, that doesn't access the DHT itself, but depend on an HTTP server to relay that on its behalf.

The requirements for that client would be:

  1. http client
  2. ed25519 signatures
  3. json encoding
  4. bencode serialization
  5. brotli compressor

All seem doable, and much easier to implement than a good DHT client.

dpc commented 1 year ago

For the record, we had a long chat about it and other things on #pkarr:matrix.org .

decentralgabe commented 1 year ago

@dpc where did you end up? I have a go impl in progress here https://github.com/decentralgabe/go-pkarr

Nuhvi commented 1 year ago

@decentralgabe I don't think he is working on it, I am :)

I ended up deciding to keep the DHT in JS for now, update the proxy server in front of it, and develop an HTTP client in Rust for now. https://github.com/Nuhvi/pkarr/issues/13

Your implementation will be very minimally affected as the encoding changes.

I might write down the new encoding in a spec for you to try it without waiting for my implementation, but I want to get a feel for it in Rust first, so give me a day or so.