Skip to content

Instantly share code, notes, and snippets.

View ryogrid's full-sized avatar

Ryo Kanbayashi ryogrid

View GitHub Profile
@ryogrid
ryogrid / nostrp2p_demo_v3_procedure.md
Last active June 9, 2024 01:35
About trial procedure of NostrP2P

Trying to enable (some) Nostr clients to connect to the NostrP2P server

  • The I/F for NostrP2P clients is REST, but it is necessary to insert a WS <-> REST bridge server for Nostr called Yonle/nhttp-adapter So, I tried to make it behave in a way that is compatible to some extent
    • Some modifications were required to the NostrP2P server to achieve this...
    • The specifications of nhttp -adapter were not compatible with NostrP2P's REST I/F, so I made some modifications ryogrid/nhttp-adapter

How to try

  • Client to use
    • For now, I will use Snort because it seems to handle the display of posts and profile information well even if I respond to REQ in a careless manner
  • procedure
@ryogrid
ryogrid / NostrP2P_Concept_En.md
Last active March 18, 2024 13:48
Pure P2P Distributed Microblogging System by All Sser's Contribution (NostrP2p)
  • Concept
    • Microblogging system by all user's contribution
      • Problem NostrP2P focus on: Existing distributed SNS (Mastdon, Nostr, Bluesky, etc.) place a big works on the server operators, but there is no insentive for that
  • Other points
    • A system centered on broadcasting using the gossip protocol (messaging is handled by the weaveworks/mesh library)
    • Focus on ease of implementation and simplicity over performance and data consistency
      • In the end, it may come down to wanting to save man-hours, but if you put a complicated mechanism into this kind of system, it's difficult to make it work stably
      • For the above reasons, we will not adopt structuring mechanisms such as DHT (for the time being)
    • Make the whole thing fuzzy (ex: event data loss is acceptable as long as it is a small amount)
  • Compared to other decentralized SNS, it is a pure P2P architecture that is difficult to operate with decent performance, but it can be managed by making a
@ryogrid
ryogrid / about.md
Last active June 21, 2024 13:27
みんなで頑張る分散ピュアP2Pマイクロブログシステム(NostrP2p)

正直、精査していないので普通に穴があるかもしれない。
GitHub Repo

  • コンセプト
    • 利用者皆の貢献により構成されるシステム
      • 課題感: 既存の分散SNS(Mastdon、Nostr、Bluesky、etc..)は言うて、サーバ運用者にかかる負荷が高く、その割に見返りもない
  • その他のポイント
    • gossipプロトコルによるブロードキャストを軸にしたシステム(メッセージングはweaveworks/mesh ライブラリが担う)
    • パフォーマンスやデータの一貫性より実装の容易さとシンプルさに重点を置く
  • 結局のところは省工数にしたいという理由に落ちるかもしれないが、この手のシステムで複雑な仕組みを入れると安定して動くようにするのが大変
@ryogrid
ryogrid / gen_graph_data.go
Last active January 5, 2024 02:36
dummy graph data generator (exection: go run gen_graph_data.go)
package main
import (
"bufio"
"fmt"
"log"
"math/rand"
"os"
"strconv"
)
@ryogrid
ryogrid / config.js
Last active September 5, 2024 13:56
current bostr config
// Bostr config
module.exports = {
// Server listener [Required]
address: "127.0.0.1",
port: "8080",
// Clusters.
// 0 will make bostr run clusters with available parallelism / CPU cores.
clusters: 1,
@ryogrid
ryogrid / config.js
Created December 24, 2023 05:51
config of Bostr
// Bostr config
module.exports = {
// Server listener [Required]
address: "127.0.0.1",
port: "8080",
// Clusters.
// 0 will make bostr run clusters with available parallelism / CPU cores.
@ryogrid
ryogrid / lmdb-survey.md
Last active December 23, 2023 01:54
Survey of internel design of Lightning Memory-Mapped Database (LMDB) and its usage on real applications (Nostr relays)

Introduction

  • This is article about knowledges I got with survey of LMDB a DBMS

Discraimer

  • The author is not an expert on database systems, so there is a possibility that my descriptions are sloppy. Please keep this in mind. I would appreciate it if you could point out any mistakes
  • Some of the content is based on speculation. I write in a way that makes it clear that these parts are based on speculation
    • (Because I couldn't go as far as checking the implementation)

Why I decided to survey about LMDB

  • There is a communication protocol architecture for distributed applications called nostr
@ryogrid
ryogrid / BallController.cs
Created November 16, 2023 23:41
Unityで作った3D版Pongのソースコード部分だけ (https://unityroom.com/games/3dpongmodoki)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallController : MonoBehaviour
{
public GameObject StampPrefab;
public GameObject ParticlePrefab;
private Rigidbody rb;
@ryogrid
ryogrid / gossip-overlay-todo.txt
Last active February 10, 2024 10:23
gossipプロトコルベースのオーバレイネットワーク構築ライブラリ Gossip Overlayの実装TODO
■meshとpion/sctpとpion/datachannelを使ったオーバレイネットワーク構築用ライブラリ Gossip Overlayの開発
・【済】read済みのデータをバッファから取り除く
・【済】ローカルのバッファを触る時はconnオブジェクトのmutexのロックをとって行うようにする
・【済】複数のノードとやりとりしても問題ないようにする(meshライブラリのユニキャストを使う時の話)
・【済】meshのオリジナルをimportする形(修正無し)で動作に問題ないか確認する
・【済】password を nil にしなかった場合に暗号化がなされるのか、なされるならどの範囲までか、を確認
 => 同一のpasswordを設定しているノードしか同一のネットワークには参加できない模様。中継も含めて、
   おそらく・・・ノード間の通信は暗号化されている
・【済】新たなデータを受信するまでreadがブロックするようにする(プロキシデーモンの形にする時に必要、と思われる)
・【作業中】ノード間ごとの通信路(conn?)を双方向通信可なチャネルとして抽象化する(コネクションの概念を導入する)
@ryogrid
ryogrid / query_jsons.txt
Last active October 28, 2023 01:13
SamehadaDB REST I/F sample request jsons
{"Query":"CREATE TABLE name_age_list(name VARCHAR(256), age INT);"}
{"Query":"INSERT INTO name_age_list(name, age) VALUES ('Sam', 20);"}
{"Query":"INSERT INTO name_age_list(name, age) VALUES ('Bob', 22);"}
{"Query":"INSERT INTO name_age_list(name, age) VALUES ('Alice', 25);"}
{"Query":"INSERT INTO name_age_list(name, age) VALUES ('Kathy', 18);"}
{"Query":"INSERT INTO name_age_list(name, age) VALUES ('Andy', 18);"}
{"Query":"DELETE FROM name_age_list WHERE age > 20;"}
{"Query":"SELECT * FROM name_age_list;"}
// below is result of last SELECT query. results of other queries are omitted here