chore: initial commit for v0.0.1

DChain single-node blockchain + React Native messenger client.

Core:
- PBFT consensus with multi-sig validator admission + equivocation slashing
- BadgerDB + schema migration scaffold (CurrentSchemaVersion=0)
- libp2p gossipsub (tx/v1, blocks/v1, relay/v1, version/v1)
- Native Go contracts (username_registry) alongside WASM (wazero)
- WebSocket gateway with topic-based fanout + Ed25519-nonce auth
- Relay mailbox with NaCl envelope encryption (X25519 + Ed25519)
- Prometheus /metrics, per-IP rate limit, body-size cap

Deployment:
- Single-node compose (deploy/single/) with Caddy TLS + optional Prometheus
- 3-node dev compose (docker-compose.yml) with mocked internet topology
- 3-validator prod compose (deploy/prod/) for federation
- Auto-update from Gitea via /api/update-check + systemd timer
- Build-time version injection (ldflags → node --version)
- UI / Swagger toggle flags (DCHAIN_DISABLE_UI, DCHAIN_DISABLE_SWAGGER)

Client (client-app/):
- Expo / React Native / NativeWind
- E2E NaCl encryption, typing indicator, contact requests
- Auto-discovery of canonical contracts, chain_id aware, WS reconnect on node switch

Documentation:
- README.md, CHANGELOG.md, CONTEXT.md
- deploy/single/README.md with 6 operator scenarios
- deploy/UPDATE_STRATEGY.md with 4-layer forward-compat design
- docs/contracts/*.md per contract
This commit is contained in:
vsecoder
2026-04-17 14:16:44 +03:00
commit 7e7393e4f8
196 changed files with 55947 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
# DChain node environment — copy to node1.env / node2.env / node3.env and
# customise per-host. These values are read by the node binary via ENV
# fallback (flags still override).
#
# Required:
# DCHAIN_VALIDATORS Comma-separated Ed25519 pubkeys of the initial
# validator set. All three nodes must agree on
# this list at genesis; later additions happen
# on-chain via ADD_VALIDATOR.
# DCHAIN_ANNOUNCE Public libp2p multiaddr peers use to dial this
# node from the internet. e.g.
# /ip4/203.0.113.10/tcp/4001
#
# Optional:
# DCHAIN_PEERS Bootstrap peer multiaddrs. Auto-filled by
# --join if omitted.
# DCHAIN_GOVERNANCE_CONTRACT Deployed governance contract ID (hex).
# DCHAIN_RELAY_FEE µT per message when registering as a relay.
# ACME_EMAIL Email for Let's Encrypt (TLS expiry reminders).
# DOMAIN Public hostname — Caddy issues cert for this.
#
# Security:
# Key files are bind-mounted at runtime; do NOT put private keys in this
# file. Each node needs its own identity — generate with
# docker compose run --rm node1 /usr/local/bin/client keygen --out /keys/node.json
# and copy out with `docker cp`.
DCHAIN_VALIDATORS=PUT_FIRST_PUBKEY_HERE,PUT_SECOND_PUBKEY_HERE,PUT_THIRD_PUBKEY_HERE
DCHAIN_ANNOUNCE=/ip4/0.0.0.0/tcp/4001
# DCHAIN_PEERS=/ip4/203.0.113.10/tcp/4001/p2p/12D3Koo...
# DCHAIN_GOVERNANCE_CONTRACT=
# DCHAIN_RELAY_FEE=1000
# ACME_EMAIL=admin@example.com
# DOMAIN=dchain.example.com
# GRAFANA_ADMIN_PW=change-me-to-something-long