Documentation
¶
Overview ¶
Package clirewards cmd/skywire-cli/commands/rewards/calc.go c4-vis-cli
Package clirewards cmd/skywire-cli/commands/rewards/runday.go c4-vis-cli
runday.go runs the hourly reward cycle in-process, the steps of the skywire-reward.service pipeline (`cli log --no-fetch`, `bw-collect`, `script reward | bash`), with the calculation done once by calcRewards.
Package clirewards cmd/skywire-cli/commands/rewards/serve.go c4-vis-cli
Package clirewards cmd/skywire-cli/commands/rewards/server.go c4-vis-cli
Package clirewards cmd/skywire-cli/commands/rewards/services.go c4-vis-cli
Package clirewards cmd/skywire-cli/commands/rewards/transports.go c4-vis-cli
Package clirewards cmd/skywire-cli/commands/rewards/uptime.go c4-vis-cli
Index ¶
Constants ¶
const BandwidthDataVersion = 2
BandwidthDataVersion is the current bw-collect output schema version. v1 = bare {pk:bytes} map (no per-transport detail; full sent+recv
credited to BOTH edges; no counterparty eligibility filter possible at calc time).
v2 = {version:2, transports:[{a,b,sent_a,sent_b}]} — preserves
per-transport detail so the calculator can (a) drop transports where either edge is reward-ineligible and (b) credit each edge only for the bytes it actually sent (sender-pays model).
Variables ¶
var RootCmd = &cobra.Command{ Use: "rewards", Short: "reward-system operator toolchain (calculate & distribute rewards)", Long: ` This plural 'rewards' command is the reward-system OPERATOR toolchain that runs the daily reward distribution: collect surveys/transports/bandwidth, fetch uptimes, calculate per-visor shares, and serve the metrics UI. Node operators who only want to set their own reward address or check their payout history want the singular command instead: 'skywire cli reward'. The bare 'rewards' command calculates a single day from data already on disk and prints the sections its -0 -1 -2 -e flags select. The 'rewards run' subcommand performs the whole hourly cycle and writes every section to its file in hist/, through the same calculation. Architectures: ` + fmt.Sprintf("%v", append(rewards.Architectures, "null", "all")) + ` `, Run: func(_ *cobra.Command, _ []string) { if log == nil { log = logging.MustGetLogger("rewards") } if logLvl != "" { if lvl, err := logging.LevelFromString(logLvl); err == nil { logging.SetLevel(lvl) } } r := calcRewards(calcFlags) w := cmdutil.Stdout() if grr { _ = writeIneligible(w, r) return } if !h0 { _ = writeStats(w, r) } if !h1 { _ = writeShares(w, r) } if !h0 { _ = writeTotal(w, r) } if !h2 { _ = writeRewardTxn(w, r) } if calcFlags.pubkey == "" { if err := writePerPoolFiles(calcFlags.histDir, r.date, r.eligible, r.bwSatExp, r.minBW); err != nil { log.Warnf("Failed to write per-pool detail files: %v", err) } } }, }
RootCmd is the root command for skywire-cli rewards
Functions ¶
This section is empty.
Types ¶
type BandwidthData ¶
type BandwidthData struct {
Version int `json:"version"`
Transports []TransportBW `json:"transports"`
}
BandwidthData is the v2 wire format for hist/<date>_bandwidth.json. See comment on BandwidthDataVersion for the migration story.
type PerKeyStats ¶
PerKeyStats is a map from PK hex to transport counts by type (includes "total" key) Format: {"pk1": {"total": 15, "stcpr": 1, "sudph": 14}, ...}
type TransportBW ¶
type TransportBW struct {
A string `json:"a"`
B string `json:"b"`
SentA uint64 `json:"sent_a"`
SentB uint64 `json:"sent_b"`
}
TransportBW is one bidirectional transport's per-edge sent bytes, each capped by the counterparty's reported recv (so a one-sided inflation of .sent can't pump the credit). sent_a is the bytes A sent that B confirmed receiving; sent_b is the mirror.
type VisorBandwidthResult ¶
VisorBandwidthResult maps public key hex to daily bandwidth in bytes. This is the pre-v2 bandwidth.json shape — retained for backward compatibility when the reward calculator encounters a file written by an older bw-collect.