Home

Awesome

What is NostrP2P?

Concept and Design

Technical Overview

Difference and Commpon Points with (General) Nostr

  

(General) Nostr Architecture


classDiagram
    RelayServerA <-- ClientX : Raed/Write
    RelayServerA <-- ClientY : Raed/Write    
    RelayServerB <-- ClientX : Raed/Write
    RelayServerB <-- ClientY : Raed/Write
    RelayServerB <-- ClientZ : Raed/Write
    RelayServerC <-- ClientX : Raed/Write    
    RelayServerC <-- ClientZ : Raed/Write
    RelayServerD <-- ClientZ : Raed/Write
    RelayServerD <-- ClientY : Raed/Write

    namespace Internet {
      class RelayServerA{
      }
      class RelayServerB{
      }
      class RelayServerC{
      }
      class RelayServerD{
      }
    }
    class ClientX{

    }
    class ClientY{

    }
    class ClientZ{

    }

NostrP2P Architecture

classDiagram
    ServerA <|--|> ServerB : coodinate
    ServerA <|--|> ServerC : coodinate
    ServerA <|--|> ServerD : coodinate
    ServerB <|--|> ServerC : coodinate
    ServerB <|--|> ServerD : coodinate
    ServerA <-- ClientA : Raed/Write
    ServerB <-- ClientB : Read/Write
    ServerC <-- ClientC : Read/Write
    ServerD <-- ClientD : Read/Write(VPN)
    namespace Internet {
      class ServerA{
      }
      class ServerB{
      }
    }
    namespace NW-C____________ {
      class ServerC{
      }
      class ClientC{
      }      
    }
    namespace NW-D______________ {
      class ServerD{
      }
    }
    namespace NW-A {
      class ClientA{
      }
    }
    namespace NW-B_________ {
      class ClientB{
      }
    }
    namespace NW-X_________ {
      class ClientD{      
      }
    }
    

Build

$ go build -o nostrp2p main.go

NostrP2P Command Usage

Usage:
  nostrp2p [flags]
  nostrp2p [command]

Available Commands:
  help        Help about any command.
  server      Startup server.
  genkey      Generate new key pair.

Flags:
  -h, --help   Help for NostrP2P
Usage:
  nostrp2p server [flags]

Flags:
  -h, --help                         Help for server
  -l, --listen-addr-port    string   Address and port to bind to (default: 127.0.0.1:20000)
  -b, --boot-peer-addr-port string   Address and port of a server which already joined NostrP2P network (optional)
  -p, --public-key          string   Your public key (required)
  -d, --debug               bool     If true, debug log is output to stderr (default: false)

Specification

Examples

Generate Key Pair

./nostrp2p genkey
Secret Key:
...
Secret Key (In Hex Representation): 
...
Public Key:
...
Public key (In Hex Representation): 
...

Server Launch

# 4 servers network on local network (4 shells are needed...)
./nostrp2p server  -l 0.0.0.0:20000 -p <public key in npub format>
./nostrp2p server -l 0.0.0.0:20002 -p <public key in npub format> -b 127.0.0.1:20000
./nostrp2p server -l 0.0.0.0:20004 -p <public key in npub format> -b 127.0.0.1:20002
./nostrp2p server -l 0.0.0.0:20006 -p <public key in npub format> -b 127.0.0.1:20000
# 4 servers distributed on different networks

# on network ryogrid.net (bind to address/port which is accessible from The Internet)
./nostrp2p server  -l 0.0.0.0:20000 -p <public key in npub format>

# on network redsky.social (bind to address/port which accessible from The Internet)
./nostrp2p server -l 0.0.0.0:7777 -p <public key in npub format> -b ryogrid.net:9999

# on network A (bind to address/port which is NOT accessible from The Internet)
./nostrp2p server -l 0.0.0.0:20000 -p <public key in npub format> -b ryogrid.net:8888

# on network B (bind to address/port which is NOT accessible from The Internet)
./nostrp2p server -l 0.0.0.0:20000 -p <public key in npub format> -b redsky.social:7777

Bootstrap Server

Client

Trial

Current Implemented Featues on Dedicated NW

<del>Current Implemented Features with Nostr Client (Not NostrP2P Client) Using a Protcol Bridge Server</del>

Roadmap (Server&Client)