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
167 lines
4.8 KiB
Go
167 lines
4.8 KiB
Go
package node
|
|
|
|
import (
|
|
_ "embed"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed explorer/index.html
|
|
var explorerIndexHTML string
|
|
|
|
//go:embed explorer/address.html
|
|
var explorerAddressHTML string
|
|
|
|
//go:embed explorer/tx.html
|
|
var explorerTxHTML string
|
|
|
|
//go:embed explorer/node.html
|
|
var explorerNodeHTML string
|
|
|
|
//go:embed explorer/style.css
|
|
var explorerStyleCSS string
|
|
|
|
//go:embed explorer/common.js
|
|
var explorerCommonJS string
|
|
|
|
//go:embed explorer/app.js
|
|
var explorerAppJS string
|
|
|
|
//go:embed explorer/address.js
|
|
var explorerAddressJS string
|
|
|
|
//go:embed explorer/tx.js
|
|
var explorerTxJS string
|
|
|
|
//go:embed explorer/node.js
|
|
var explorerNodeJS string
|
|
|
|
//go:embed explorer/relays.html
|
|
var explorerRelaysHTML string
|
|
|
|
//go:embed explorer/relays.js
|
|
var explorerRelaysJS string
|
|
|
|
//go:embed explorer/validators.html
|
|
var explorerValidatorsHTML string
|
|
|
|
//go:embed explorer/validators.js
|
|
var explorerValidatorsJS string
|
|
|
|
//go:embed explorer/contract.html
|
|
var explorerContractHTML string
|
|
|
|
//go:embed explorer/contract.js
|
|
var explorerContractJS string
|
|
|
|
//go:embed explorer/tokens.html
|
|
var explorerTokensHTML string
|
|
|
|
//go:embed explorer/tokens.js
|
|
var explorerTokensJS string
|
|
|
|
//go:embed explorer/token.html
|
|
var explorerTokenHTML string
|
|
|
|
//go:embed explorer/token.js
|
|
var explorerTokenJS string
|
|
|
|
func serveExplorerIndex(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerIndexHTML))
|
|
}
|
|
|
|
func serveExplorerAddressPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerAddressHTML))
|
|
}
|
|
|
|
func serveExplorerTxPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTxHTML))
|
|
}
|
|
|
|
func serveExplorerNodePage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerNodeHTML))
|
|
}
|
|
|
|
func serveExplorerCSS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/css; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerStyleCSS))
|
|
}
|
|
|
|
func serveExplorerCommonJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerCommonJS))
|
|
}
|
|
|
|
func serveExplorerJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerAppJS))
|
|
}
|
|
|
|
func serveExplorerAddressJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerAddressJS))
|
|
}
|
|
|
|
func serveExplorerTxJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTxJS))
|
|
}
|
|
|
|
func serveExplorerNodeJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerNodeJS))
|
|
}
|
|
|
|
func serveExplorerRelaysPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerRelaysHTML))
|
|
}
|
|
|
|
func serveExplorerRelaysJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerRelaysJS))
|
|
}
|
|
|
|
func serveExplorerValidatorsPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerValidatorsHTML))
|
|
}
|
|
|
|
func serveExplorerValidatorsJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerValidatorsJS))
|
|
}
|
|
|
|
func serveExplorerContractPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerContractHTML))
|
|
}
|
|
|
|
func serveExplorerContractJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerContractJS))
|
|
}
|
|
|
|
func serveExplorerTokensPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTokensHTML))
|
|
}
|
|
|
|
func serveExplorerTokensJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTokensJS))
|
|
}
|
|
|
|
func serveExplorerTokenPage(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTokenHTML))
|
|
}
|
|
|
|
func serveExplorerTokenJS(w http.ResponseWriter, _ *http.Request) {
|
|
w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
|
|
_, _ = w.Write([]byte(explorerTokenJS))
|
|
}
|