P2P programming framework

I was wondering if collecting some common P2P programming subroutines in a library/framework would be worthwhile? I was looking at Tezos code and I thought we could use something like cryptokit (possible names: p2pkit, ocamlp2p) for writing decentralized software. There is libp2p in Go, I wonder if that’s why Go is popular in crypto. They’re (re)building AvaCoin on Go AFAICT.

Previously, I did something like this as part of parallpairs for abstracting MPI calls, this looks like a similar problem. I could provide some cool authentication and basic crypto too. What functions do you think should be supplied by such a library? Should we just try to reimplement libp2p in ocaml?

Best Wishes,

Eray

3 Likes

Functory looks like the closest package to what I’m looking for, I’ve forgotten about it. I’d be glad if you could offer any advice, what’s a practical p2p framework for OCaml? Maybe there is something else I missed.

Additional comments, someone on #python IRC channel asked what specifically I’m looking for. Here is a partial list of my requirements.

  1. transport overlays, like peer routing.
  2. a connection abstraction like in libp2p, not dependent on IP4.
  3. would be nice if the comms stuff had counter-measures against popular censorship mechanisms.
  4. highly abstract distributed computing / comms primitives (see functory).
  5. fault tolerance, peer discovery.
  6. implementations of relevant protocols (consensus protocols, etc.) for decentralized / p2p services.
  7. basic cryptography (encryption, authentication).
  8. cryptographic data structures like blockchain, hash graph, merkle tree, DHT.
  9. generic distributed data store.
  10. decentralized name service.

PS: I am developing a new cryptocurrency called Cypher, it will likely be implemented in OCaml, I’ll post any relevant announcements in here, and would love to talk to OCaml hackers who might be interested in contributing to such a project.

2 Likes

There are quite a few of those things that are part of tezos. You might want to take a look at it: https://gitlab.com/tezos/tezos/

1 Like

Yes, I’ve seen it. It’s quite decent coding. It has some sub libs that can be reused. I was thinking I could use some of the crypto stuff at least, and it’s definitely the authoritative reference right now for anyone wanting to implement a blockchain thingie from scratch in our favorite PL. :slight_smile: Those who haven’t seen it, should, I read most of the code. The only reason I might not want to reuse a large portion of it is these crypto FUDsters who might claim something like “you just forked tezos”.

I was wondering if anything happened with the libp2p bindings. I’m thinking about doing this if it hasn’t already been done.

1 Like

Please do, it’s still a good idea!

Functory is not production-ready AFAIK.
There is some non tail-rec code in there, at least last time I checked.

I should note that now Tezos split the interfase to the separate opam package:

1 Like

Do you know the wire format that they use?
json? XML ? Some binary format like Sun-RPC ?
Other ?

We use a binary format based on data-encoding.

The encoding for the application-level message are passed as argument when instantiating the P2p layer, so you can have some json/xml but the headers will still be some binary format.