host

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identity

type Identity struct {
	// TLS is the staking certificate and its private key, presented on every
	// dial and every accept.
	TLS tls.Certificate
	// Cert is the parsed leaf, kept because the node id is derived from its
	// exact DER and re-parsing per use would be a second chance to disagree.
	Cert *x509.Certificate
	// NodeID is RIPEMD160(SHA256(cert DER)) — the derivation in luxfi/ids, not a
	// local copy of it.
	NodeID ids.NodeID
	// Signer holds the BLS staking key. Nil when the node has no signing key,
	// which makes it a follower: it reads the network and never votes.
	Signer *localsigner.LocalSigner
}

Identity is who this node is on the network: one staking certificate, which names it, and one BLS key, which is how it votes.

The two are not interchangeable and neither substitutes for the other. The certificate is what a peer authenticates the TLS session against and what the node id is derived from; the BLS key is what a validator set holds and what a finality certificate is assembled out of. A node whose certificate is known and whose BLS key is not is a peer that cannot vote, which is a real and intended state — so they are loaded together and kept apart.

func LoadIdentity

func LoadIdentity(dir string) (*Identity, error)

LoadIdentity reads a staking directory.

The certificate and its key are required — without them the node has no name and cannot open a session. The BLS key is optional for the reason above.

func (*Identity) PublicKey

func (i *Identity) PublicKey() *bls.PublicKey

PublicKey returns the BLS public key this node votes under, or nil when it holds no signing key.

func (*Identity) Sign

func (i *Identity) Sign(msg []byte) ([]byte, error)

Sign produces this node's BLS signature over msg. It is the ONE place the staking key is used to sign a vote, so every signature the node makes passes through the same call — which is what lets the equivocation journal stand in front of all of them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL