Progress in My P2P Library: A Work in Progress

Rmag Breaking News

Hello everyone!

I’m pleased to share with you the progress I’ve made with my p2p library. So far, everything is going as planned, and I’m excited about the development it’s undergoing. I’ve built this library using a set of modern cryptography tools, including:

Blake2 Hash
ED25519 Signature
ChaCha20-Poly1305 Cipher
Diffie-Hellman Curve25519 Key Exchange

Recently, I conducted some benchmarking tests, and I’d like to share the results with you. However, it’s important to note that I haven’t yet conducted a “micro benchmark”.

perflock -governor=80% go test -benchmem -run=^$ -benchtime 1s -bench=BenchmarkHandshakeProfile -cpu 1,2,4,8 -count 2 -memprofile mem.prof -cpuprofile cpu.prof
goos: linux
goarch: amd64
pkg: github.com/geolffreym/p2p-noise
cpu: Intel(R) Xeon(R) CPU E3-1505M v5 @ 2.80GHz
BenchmarkHandshakeProfile 962 1061028 ns/op 34391 B/op 267 allocs/op
BenchmarkHandshakeProfile 1322 919647 ns/op 34383 B/op 267 allocs/op
BenchmarkHandshakeProfile-2 1294 834506 ns/op 37095 B/op 285 allocs/op
BenchmarkHandshakeProfile-2 1398 858845 ns/op 36872 B/op 284 allocs/op
BenchmarkHandshakeProfile-4 1395 875618 ns/op 41912 B/op 323 allocs/op
BenchmarkHandshakeProfile-4 1341 914046 ns/op 41858 B/op 323 allocs/op
BenchmarkHandshakeProfile-8 1276 879535 ns/op 42055 B/op 324 allocs/op
BenchmarkHandshakeProfile-8 1279 929125 ns/op 41812 B/op 323 allocs/op
PASS
ok github.com/geolffreym/p2p-noise 13.201s

From the beginning, my main goal has been to maintain simplicity in the use of the library, exposing only what’s necessary to the user. To achieve this, I’ve followed an approach of solving one problem at a time. This has prevented the library from growing unnecessarily in size and complexity. Currently, the library is designed to establish a secure connection and exchange information between two known nodes in a network without NAT.

Although the library doesn’t currently include solutions for connectivity such as Nat Traversals, Discovery, Multiplexing, etc., these are part of my roadmap. I plan to implement them in separate packages communicated through their respective interfaces, allowing for the extension of the library’s functionality as needed to create more complex networks. (Clarification: It’s not precisely the approach of passing modules as a configuration parameter to the library, but rather a “programmatic” approach that allows for defining custom and flexible logics for network management and configuration.)

Looking ahead, I intend to develop improvements in data compression to enhance bandwidth efficiency and transmission. Given my interest in p2p networks based on non-structured network topologies, I’ve been exploring related solutions. Recently, I investigated a solution based on node metrics called “adaptive peer search”, which focuses on ensuring service quality related to parameters such as latency, bandwidth, or connection time in non-structured networks. (Note: This is an idea, not something I’m currently implementing. There’s much more research I need to do to compare it with existing algorithms.)

If this sounds interesting to you, you can find more details in the following document: Document.

I’d love to connect with people who are interested in this idea and willing to contribute to this initiative. I appreciate any feedback that can help me ensure I’m on the right track.

The library is in the development stage, and there are many improvements to be made in terms of testing, bug fixes, and possibly performance.

Best regards to all!

repo: https://github.com/geolffreym/p2p-noise

Leave a Reply

Your email address will not be published. Required fields are marked *