Documentation
¶
Overview ¶
Command bitcoin-shard-proxy accepts BSV transaction datagrams on a UDP IPv6 socket, derives a multicast group address from the transaction ID's top N bits, and retransmits each datagram verbatim to the derived group.
Multiple worker goroutines — one per CPU by default — each bind an independent SO_REUSEPORT socket to the listen port. The kernel distributes incoming datagrams across them, providing CPU-local processing with no userspace coordination on the ingress path.
Quick start ¶
bitcoin-shard-proxy -iface eth0,eth1 -shard-bits 8 -scope site
Configuration ¶
All flags have environment variable equivalents; see config.Load for the full mapping. The most important parameters:
-shard-bits (SHARD_BITS): controls how many bits of the txid prefix are used as the multicast group key. Range 1–15. 8 → 256 groups (fits any managed switch) 12 → 4096 groups 15 → 32768 groups (maximum; top of 16-bit space reserved for control)
-mc-group-id (MC_GROUP_ID): IANA group-id occupying bytes 12–13 of the address. Default 0x000B (IANA Bitcoin allocation "FF0X::B"). Operators MAY override for testing/private deployments.
-scope (MC_SCOPE): multicast scope. Use "site" for closed subscriber fabrics; "global" only if subscribers span BGP domains.
-iface (MULTICAST_IF): comma-separated NIC names over which multicast datagrams are sent (e.g. eth0,eth1). Each datagram is forwarded to all listed interfaces in order. All names must exist on the host; the proxy exits immediately if any are not found.
Graceful shutdown ¶
The proxy catches SIGINT (Ctrl-C) and SIGTERM (sent by systemd, container orchestrators, etc.). Shutdown proceeds in two phases:
Draining: /readyz immediately returns 503, then the process sleeps -drain-timeout (DRAIN_TIMEOUT) to allow load-balancer health checks to propagate and stop sending new connections. Defaults to 0 (disabled).
Quiescing: the done channel is closed, each worker's ingress socket is closed (unblocking ReadFrom), and main waits for all goroutines to exit before the process returns.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
perf-test
command
Command perf-test is a throughput performance measurement tool for bitcoin-shard-proxy.
|
Command perf-test is a throughput performance measurement tool for bitcoin-shard-proxy. |
|
recv-test-frames
command
Command recv-test-frames joins one or more IPv6 multicast groups and prints every BSV-over-UDP frame it receives.
|
Command recv-test-frames joins one or more IPv6 multicast groups and prints every BSV-over-UDP frame it receives. |
|
send-test-frames
command
Command send-test-frames crafts and sends well-formed BSV-over-UDP frames to bitcoin-shard-proxy for local integration testing.
|
Command send-test-frames crafts and sends well-formed BSV-over-UDP frames to bitcoin-shard-proxy for local integration testing. |
|
Package config loads and validates runtime configuration for bitcoin-shard-proxy.
|
Package config loads and validates runtime configuration for bitcoin-shard-proxy. |
|
Package forwarder implements the decode → forward pipeline for bitcoin-shard-proxy.
|
Package forwarder implements the decode → forward pipeline for bitcoin-shard-proxy. |
|
Package metrics initialises an OpenTelemetry MeterProvider backed by both a Prometheus exporter (for scraping) and an optional OTLP gRPC exporter (for push-based delivery to any OTel-compatible backend).
|
Package metrics initialises an OpenTelemetry MeterProvider backed by both a Prometheus exporter (for scraping) and an optional OTLP gRPC exporter (for push-based delivery to any OTel-compatible backend). |
|
Package worker — tcp.go provides TCPIngress: a TCP listener that accepts reliable frame delivery connections and feeds them into the shared Forwarder.
|
Package worker — tcp.go provides TCPIngress: a TCP listener that accepts reliable frame delivery connections and feeds them into the shared Forwarder. |