mithril-go/internal/networks/networks.go
Kayos 97a9434106 genesis Ed25519 verification — working against live mainnet + preprod
- verify package: ComputeProtocolMessageHash mirrors Rust's BTreeMap-ordered
  SHA256 over key||value concatenation (enum declaration order, not alpha)
- DecodeGenesisVerifyKey unpacks Mithril's 'hex of ASCII [b0,b1,...,b31]'
  wrapping convention; also accepts plain 64-char hex
- Genesis() verifies the Ed25519 signature over the ASCII BYTES of the
  signed_message HEX string (critical subtlety from upstream)
- networks: real genesis vkeys for mainnet + preprod + preview from
  mithril-infra/configuration/*/genesis.vkey
- cmd: 'verify genesis' walks head→genesis chain, verifies the terminal cert;
  'verify head' and 'verify <hash>' also wired; JSON output supported
- exit codes honored: 3 network, 4 integrity, 5 bad sig

verified:
  mainnet  genesis cert 25acfcfe…  epoch 539  Ed25519 ✓
  preprod  genesis cert 69bc3bdf…  epoch 196  Ed25519 ✓

next: STM BLS12-381 aggregate verification (the big one)
2026-04-23 15:33:41 -07:00

41 lines
1.8 KiB
Go

// Package networks holds Mithril aggregator endpoints and genesis keys
// per Cardano network.
package networks
type Network struct {
Name string
AggregatorURL string
GenesisVerifyKey string // hex-encoded Ed25519 public key used to verify the Mithril genesis cert chain
CardanoConfigURL string // upstream cardano-node config bundle (config.json, genesis files)
}
var (
Mainnet = Network{
Name: "mainnet",
AggregatorURL: "https://aggregator.release-mainnet.api.mithril.network/aggregator",
GenesisVerifyKey: "5b3139312c36362c3134302c3138352c3133382c31312c3233372c3230372c3235302c3134342c32372c322c3138382c33302c31322c38312c3135352c3230342c31302c3137392c37352c32332c3133382c3139362c3231372c352c31342c32302c35372c37392c33392c3137365d",
}
Preprod = Network{
Name: "preprod",
AggregatorURL: "https://aggregator.release-preprod.api.mithril.network/aggregator",
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d",
}
Preview = Network{
Name: "preview",
AggregatorURL: "https://aggregator.pre-release-preview.api.mithril.network/aggregator",
// Pre-release/preview uses the same genesis key as preprod.
GenesisVerifyKey: "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d",
}
)
func ByName(name string) (Network, bool) {
switch name {
case "mainnet":
return Mainnet, true
case "preprod":
return Preprod, true
case "preview":
return Preview, true
}
return Network{}, false
}