chain

package
v1.108.14 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

validator.go reads the hanzo.network (the Hanzo EVM) mainnet validator set — the source of truth for the FREE fleet-billing tier. A connected box whose validator address is in the set is natively available to the cloud at no fee (it already earns validator economics and secures the chain). The chain is READ, never written, and is authoritative.

HONESTY CONTRACT (never fabricate an on-chain fact): the free exemption is granted ONLY on a POSITIVE, verified membership read. When the lookup is not wired, or a wired lookup errors, the exemption is NOT granted — it is flagged "pending chain wiring" / "lookup error" and the box is billed like any device until the chain confirms it. So a real validator's exemption activates automatically once the operator wires the lookup; nothing is ever exempted on an unverified claim.

Index

Constants

View Source
const (
	ValidatorStatusExempt  = "exempt"               // verified on-chain validator → free
	ValidatorStatusBilled  = "billed"               // verified NOT a validator → billed as a device
	ValidatorStatusPending = "pending-chain-wiring" // lookup unwired → cannot verify → billed, flagged
	ValidatorStatusError   = "lookup-error"         // wired lookup failed → billed (fail-safe), flagged
)

Exemption status strings surfaced to the meter, logs, and the connect response.

Variables

This section is empty.

Functions

func ValidatorExemption

func ValidatorExemption(ctx context.Context, address string) (bool, string, error)

ValidatorExemption reports whether address qualifies for the free validator tier.

not wired          -> (false, ValidatorStatusPending, nil)  // never fabricate; billed, flagged
wired + in set     -> (true,  ValidatorStatusExempt,  nil)  // free / native
wired + not in set -> (false, ValidatorStatusBilled,  nil)  // billed as a device
wired + error      -> (false, ValidatorStatusError,   err)  // fail-safe: billed, error surfaced

The caller grants the free tier iff the returned bool is true, and records status for observability regardless.

func ValidatorLookupWired

func ValidatorLookupWired() bool

ValidatorLookupWired reports whether the validator-set lookup is configured.

Types

type ChainClientInterface

type ChainClientInterface interface {
	Commit(data string) (string, string, error)
	Query(txId string, data string) (string, error)
}

func NewChainClient

func NewChainClient(providerType string, clientId string, clientSecret string, region string, networkId string, chainId string) (ChainClientInterface, error)

type ChainTencentChainmakerClient

type ChainTencentChainmakerClient struct {
	ClientId     string
	ClientSecret string
	Region       string
	NetworkId    string
	ChainId      string
	Client       *tbaas.Client
}

func (*ChainTencentChainmakerClient) Commit

func (client *ChainTencentChainmakerClient) Commit(data string) (string, string, error)

func (ChainTencentChainmakerClient) Query

func (client ChainTencentChainmakerClient) Query(blockId string, data string) (string, error)

type ChainTencentChainmakerDemoClient

type ChainTencentChainmakerDemoClient struct {
	ClientId     string
	ClientSecret string
	Region       string
	NetworkId    string
	ChainId      string
	Client       *tbaas.Client
}

func (*ChainTencentChainmakerDemoClient) Commit

func (client *ChainTencentChainmakerDemoClient) Commit(data string) (string, string, error)

func (ChainTencentChainmakerDemoClient) Query

func (client ChainTencentChainmakerDemoClient) Query(txId string, data string) (string, error)

Jump to

Keyboard shortcuts

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