chain

package
v0.0.0-...-caddeb3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package chain holds the typed domain values used across chain-commons.

All types here are pure data with no I/O dependencies. Aliases over go-ethereum's common.* types let consumers avoid importing go-ethereum just to name a hash or address.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address = common.Address

Address is a 20-byte Ethereum account or contract address.

type BlockNumber

type BlockNumber uint64

BlockNumber is an L1 or L2 block height. Always non-negative.

func (BlockNumber) BigInt

func (b BlockNumber) BigInt() *big.Int

BigInt returns the value as a *big.Int (heap-allocated). Useful for passing to go-ethereum APIs that take *big.Int.

func (BlockNumber) Bytes

func (b BlockNumber) Bytes() []byte

Bytes returns the value as 8 bytes big-endian. Used as a BoltDB key.

func (BlockNumber) String

func (b BlockNumber) String() string

String returns the decimal string form for logs and CLI output.

type ChainID

type ChainID uint64

ChainID identifies which Ethereum-compatible chain the daemon talks to. Arbitrum One is 42161; Arbitrum Sepolia is 421614; Anvil is operator-set.

func (ChainID) BigInt

func (c ChainID) BigInt() *big.Int

BigInt returns the value as a *big.Int.

type GasPrice

type GasPrice = *big.Int

GasPrice is an alias for Wei used in gas-pricing contexts. Same underlying type; the alias documents intent.

type Round

type Round struct {
	// Number is the protocol round number (currently active when this Round
	// event fires).
	Number RoundNumber

	// StartBlock is the L2 block at which this round became current.
	StartBlock BlockNumber

	// L1StartBlock is the Arbitrum-recorded L1 block at which this round
	// became current. Sourced from the L2 block header's l1BlockNumber field.
	L1StartBlock BlockNumber

	// Length is the round length in blocks.
	Length BlockNumber

	// Initialized reports whether RoundsManager.initializeRound() has been
	// called for this round. Some consumers (e.g., reward) only act on
	// initialized rounds.
	Initialized bool

	// LastInitialized is RoundsManager.lastInitializedRound() at the time
	// the event fires — the most recent round whose initializeRound() has
	// been called and whose blockHashForRound() is non-zero. When
	// Initialized is true this equals Number; otherwise it trails Number
	// by 1+ rounds. Consumers that need a round whose blockHash is
	// guaranteed available (payment-daemon's ticket creationRound) read
	// this field; consumers that act on the protocol round itself
	// (protocol-daemon initialize/reward calling) read Number.
	LastInitialized RoundNumber

	// BlockHash is RoundsManager.blockHashForRound at the time the event
	// fires. Zero value until set on-chain.
	BlockHash TxHash
}

Round is the typed event struct emitted by services/roundclock and consumed by daemons that react to round transitions.

func (Round) String

func (r Round) String() string

String returns a compact representation for logs.

type RoundNumber

type RoundNumber uint64

RoundNumber is a Livepeer protocol round number. Always non-negative.

func (RoundNumber) BigInt

func (r RoundNumber) BigInt() *big.Int

BigInt returns the value as a *big.Int.

func (RoundNumber) Bytes

func (r RoundNumber) Bytes() []byte

Bytes returns the value as 8 bytes big-endian.

func (RoundNumber) String

func (r RoundNumber) String() string

String returns the decimal string form.

type TxHash

type TxHash = common.Hash

TxHash is a 32-byte transaction or block hash.

type Wei

type Wei = *big.Int

Wei is an amount in the smallest Ethereum currency unit. Always a pointer so the zero value is a sentinel rather than 0; callers must construct with big.NewInt or new(big.Int).

Jump to

Keyboard shortcuts

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