Skip to content

Instantly share code, notes, and snippets.

View ryogrid's full-sized avatar

Ryo Kanbayashi ryogrid

View GitHub Profile
@ryogrid
ryogrid / nostrp2p_on_termux.md
Last active June 3, 2024 22:47
NostrP2P server on Android Smartphone

The other day, I wrote an articleshown below, and I was thinking about whether I could prepare or have a machine that can run the server continuously.

NostrP2P: Pure P2P Distributed Microblogging System - ryo_grid's tech articles

Then, I remembered that there is an app called Termux that creates a unique Linux environment within an Android device. So, I thought it would be a good idea to use an old Android smartphone to run the server, and when I tried it, it worked perfectly!

(The idea behind Termux is that since Android is a type of Linux, by changing the root location of the file system in the shell shown to the user with chroot and placing the necessary files, you can create a unique Linux userland.)

First, referring to the sites below, install Termux via the Fdroid app.

@ryogrid
ryogrid / nostr_event.pb.go
Last active April 28, 2024 03:40
NostrのイベントデータをMessagePackとProtobufでシリアライズした時のデータサイズ
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v3.19.1
// source: np2p_event.proto
package schema
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@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 December 24, 2023 09:20
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;