docs: update README + api docs + architecture for v2.0.0 feed
README
- Mention social feed in the one-line description and feature bullets
- Add relay + feed endpoint tables to the API overview (was
previously empty on messaging)
- List media/ package in the repo structure
docs/api/
- New docs/api/feed.md: full reference for /feed/publish, fetch,
stats, view, author, timeline, trending, foryou, hashtag; all
on-chain CREATE_POST / DELETE_POST / FOLLOW / LIKE payloads;
fee economics; server-side scrubbing contract.
- docs/api/relay.md rewritten: /relay/broadcast is now the primary
E2E path with a complete envelope schema; /relay/send kept but
flagged ⚠ NOT E2E; DELETE /relay/inbox/{id} documented with the
new Ed25519 signed-auth body.
- docs/api/README.md index: added feed.md row.
docs/architecture.md
- L2 Transport layer description updated to include the feed
mailbox alongside the 1:1 relay mailbox.
- New "Социальная лента (v2.0.0)" section right after the 1:1
message flow: ASCII diagram of publish + on-chain commit +
timeline fetch, economic summary, metadata-scrub summary.
docs/node/README.md
- Removed stale chan:/chan-member: keys from the BadgerDB schema
reference; replaced with the v2.0.0 feed keys (post:,
postbyauthor:, follow:, followin:, like:, likecount:).
docs/update-system.md
- Example features[] array updated to match the actual node output
(channels_v1 removed, feed_v2 / media_scrub / relay_broadcast added).
Node feature flags
- api_well_known_version.go: dropped channels_v1 tag (the
/api/channels/:id endpoint was removed in the feed refactor);
added feed_v2, media_scrub, relay_broadcast so clients can
feature-detect the v2.0.0 surface.
- Comment example updated channels_v2/v1 → feed_v3/v2.
Client
- CLIENT_REQUIRED_FEATURES expanded to include the v2.0.0 feature
flags the client now depends on (feed_v2, media_scrub,
relay_broadcast); checkNodeVersion() will flag older nodes as
unsupported and surface an upgrade prompt.
All 7 Go test packages green; tsc --noEmit clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
38
README.md
38
README.md
@@ -1,6 +1,6 @@
|
||||
# DChain
|
||||
|
||||
Блокчейн-стек для децентрализованного мессенджера:
|
||||
Блокчейн-стек для децентрализованного мессенджера + социальной ленты:
|
||||
|
||||
- **PBFT** консенсус с multi-sig validator governance и equivocation slashing
|
||||
- **Native Go контракты** рядом с WASM (wazero) — нулевая задержка для
|
||||
@@ -8,6 +8,12 @@
|
||||
- **WebSocket push API** — клиент не опрашивает, все события прилетают
|
||||
на соединение
|
||||
- **E2E-шифрованный relay mailbox** на libp2p gossipsub с TTL live-detection
|
||||
(1:1 чаты через NaCl box; посты в ленте — plaintext-публичные)
|
||||
- **Социальная лента v2.0.0** (заменила каналы): публичные посты
|
||||
с оплатой за размер (автор платит, хостящая релей-нода получает);
|
||||
on-chain граф подписок + лайки; off-chain просмотры + хэштеги;
|
||||
мандаторный server-side scrubber метаданных (EXIF/GPS-стрип + FFmpeg
|
||||
sidecar для видео); share-to-chat c embedded post-карточкой
|
||||
- **Система обновлений:** build-time версия → `/api/well-known-version`,
|
||||
peer-version gossip, `/api/update-check` против Gitea releases,
|
||||
`update.sh` с semver guard
|
||||
@@ -142,7 +148,8 @@ sudo systemctl enable --now dchain-update.timer
|
||||
| `node/` | HTTP + WS API, SSE, metrics, access control |
|
||||
| `node/version/` | Build-time version metadata (ldflags-инжектимый) |
|
||||
| `vm/` | wazero runtime для WASM-контрактов + gas model |
|
||||
| `relay/` | E2E mailbox с NaCl-envelopes |
|
||||
| `relay/` | E2E mailbox (1:1 envelopes) + public feed-mailbox (post bodies, view counter, hashtag index) |
|
||||
| `media/` | Server-side metadata scrubber (EXIF strip + FFmpeg sidecar client) |
|
||||
| `identity/` | Ed25519 + X25519 keypair, tx signing |
|
||||
| `economy/` | Fee model, rewards |
|
||||
| `wallet/` | Optional payout wallet (отдельный ключ) |
|
||||
@@ -179,6 +186,33 @@ sudo systemctl enable --now dchain-update.timer
|
||||
Scoped WS-топики (`addr:`, `inbox:`, `typing:`) требуют auth через
|
||||
Ed25519-nonce; публичные (`blocks`, `tx`, `contract_log`) — без.
|
||||
|
||||
### Relay (E2E messaging)
|
||||
| Endpoint | Описание |
|
||||
|----------|----------|
|
||||
| `POST /relay/broadcast` | Опубликовать pre-sealed envelope (E2E-путь, рекомендован) |
|
||||
| `GET /relay/inbox?pub=<x25519>` | Прочитать входящие конверты |
|
||||
| `DELETE /relay/inbox/{id}` | Удалить envelope (требует Ed25519-подписи владельца) |
|
||||
|
||||
Детали — [`docs/api/relay.md`](docs/api/relay.md). `/relay/send` оставлен
|
||||
для backward-compat, но ломает E2E (nod-релей запечатывает своим ключом)
|
||||
и помечен как non-recommended.
|
||||
|
||||
### Social feed (v2.0.0)
|
||||
| Endpoint | Описание |
|
||||
|----------|----------|
|
||||
| `POST /feed/publish` | Загрузить тело поста + EXIF-скраб + вернуть fee |
|
||||
| `GET /feed/post/{id}` | Тело поста |
|
||||
| `GET /feed/post/{id}/attachment` | Сырые байты картинки/видео (cache'able) |
|
||||
| `GET /feed/post/{id}/stats?me=<pub>` | `{views, likes, liked_by_me?}` |
|
||||
| `POST /feed/post/{id}/view` | Бамп off-chain счётчика просмотров |
|
||||
| `GET /feed/author/{pub}?before=<ts>&limit=N` | Посты автора (пагинация `before`) |
|
||||
| `GET /feed/timeline?follower=<pub>&before=<ts>&limit=N` | Merged лента подписок |
|
||||
| `GET /feed/trending?window=24&limit=N` | Топ по `likes × 3 + views` за окно |
|
||||
| `GET /feed/foryou?pub=<pub>&limit=N` | Рекомендации (неподписанные авторы) |
|
||||
| `GET /feed/hashtag/{tag}?limit=N` | Посты по хэштегу |
|
||||
|
||||
Детали + спецификация — [`docs/api/feed.md`](docs/api/feed.md).
|
||||
|
||||
### Docs / UI
|
||||
- `GET /swagger` — **Swagger UI** (рендерится через swagger-ui-dist).
|
||||
- `GET /swagger/openapi.json` — сырая OpenAPI 3.0 спека.
|
||||
|
||||
Reference in New Issue
Block a user