Documentation
¶
Overview ¶
Package signer provides BLS signing utilities for builder operations.
Index ¶
- Variables
- func ComputeBuilderDepositSigningRoot(pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, ...) (phase0.Root, error)
- func ComputeDepositDataRoot(pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, ...) (phase0.Root, error)
- func ComputeDepositSigningRoot(pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, ...) (phase0.Root, error)
- func ComputeDomain(domainType phase0.DomainType, forkVersion phase0.Version, ...) phase0.Domain
- func ComputeSigningRoot(objectRoot phase0.Root, domain phase0.Domain) phase0.Root
- func ComputeVoluntaryExitRoot(epoch phase0.Epoch, validatorIndex phase0.ValidatorIndex) phase0.Root
- func DeriveBLSPrivkeyHex(mnemonic string, index uint64) (string, error)
- func DeriveInternalKey(entryPrivkeyHex string, index uint64) (string, error)
- func ResolveEntryPrivkey(privkeyHex, mnemonic string, index uint64) (string, error)
- func VerifyBLSSignature(pubkey phase0.BLSPubKey, message []byte, signature phase0.BLSSignature) bool
- type BLSSigner
- func (s *BLSSigner) PublicKey() phase0.BLSPubKey
- func (s *BLSSigner) PublicKeyBytes() []byte
- func (s *BLSSigner) Sign(message []byte) (phase0.BLSSignature, error)
- func (s *BLSSigner) SignVoluntaryExit(epoch phase0.Epoch, validatorIndex phase0.ValidatorIndex, ...) (phase0.BLSSignature, error)
- func (s *BLSSigner) SignWithDomain(root phase0.Root, domain phase0.Domain) (phase0.BLSSignature, error)
Constants ¶
This section is empty.
Variables ¶
var ( // DomainVoluntaryExit is the standard domain for voluntary exits. DomainVoluntaryExit = phase0.DomainType{0x04, 0x00, 0x00, 0x00} // DomainDeposit is the standard domain for validator deposit signatures, and for // the genesis builder-onboarding path (a pre-fork deposit to the validator deposit // contract with a 0xB0 credential, per the Gloas spec). DomainDeposit = phase0.DomainType{0x03, 0x00, 0x00, 0x00} // DomainBuilderDeposit is DOMAIN_BUILDER_DEPOSIT (Gloas, 0x0E000000): the dedicated // domain for post-fork builder deposits submitted to the EIP-8282 builder deposit // contract. The consensus-specs sign the DepositMessage proof-of-possession under // this domain (is_valid_builder_deposit_signature) so validator and builder deposit // signatures cannot be replayed against the other contract. DomainBuilderDeposit = phase0.DomainType{0x0E, 0x00, 0x00, 0x00} // DomainApplicationBuilder is the domain for builder API validator registration signatures. // See https://github.com/ethereum/builder-specs DomainApplicationBuilder = phase0.DomainType{0x00, 0x00, 0x00, 0x01} )
Domain types for lifecycle operations.
Functions ¶
func ComputeBuilderDepositSigningRoot ¶
func ComputeBuilderDepositSigningRoot( pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, genesisForkVersion phase0.Version, ) (phase0.Root, error)
ComputeBuilderDepositSigningRoot computes the signing root for an EIP-8282 builder deposit message. Per the Gloas consensus-specs (is_valid_builder_deposit_signature) it signs the DepositMessage under DOMAIN_BUILDER_DEPOSIT (0x0E000000) — a dedicated domain, distinct from validator deposits — with GENESIS_FORK_VERSION and a zero genesis_validators_root, so the proof-of-possession is chain- and fork-agnostic.
func ComputeDepositDataRoot ¶
func ComputeDepositDataRoot( pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, signature phase0.BLSSignature, ) (phase0.Root, error)
ComputeDepositDataRoot computes the hash tree root of DepositData. Uses the go-eth2-client library's SSZ implementation for correctness.
func ComputeDepositSigningRoot ¶
func ComputeDepositSigningRoot( pubkey phase0.BLSPubKey, withdrawalCredentials [32]byte, amountGwei uint64, genesisForkVersion phase0.Version, ) (phase0.Root, error)
ComputeDepositSigningRoot computes the signing root for a deposit message. Uses the go-eth2-client library's SSZ implementation for correctness. Per spec, uses GENESIS_FORK_VERSION and zeros for genesis_validators_root.
func ComputeDomain ¶
func ComputeDomain( domainType phase0.DomainType, forkVersion phase0.Version, genesisValidatorsRoot phase0.Root, ) phase0.Domain
ComputeDomain computes a domain value for a given domain type, fork version, and genesis validators root. Uses consensus spec SSZ hash_tree_root(ForkData) so it matches beacon node / mev-boost signing.
func ComputeSigningRoot ¶
ComputeSigningRoot computes the signing root from an object root and domain. Uses consensus spec SSZ hash_tree_root(SigningData) so it matches beacon node / mev-boost signing.
func ComputeVoluntaryExitRoot ¶
ComputeVoluntaryExitRoot computes the hash tree root of a VoluntaryExit.
func DeriveBLSPrivkeyHex ¶
DeriveBLSPrivkeyHex derives a builder BLS private key from a BIP-39 mnemonic and an account index using the standard Ethereum validator key derivation: EIP-2333 tree derivation along the EIP-2334 signing key path m/12381/3600/{index}/0/0.
It returns the 32-byte secret key as a 64-character lowercase hex string (no 0x prefix), matching the format accepted by NewBLSSigner.
func DeriveInternalKey ¶ added in v0.0.3
DeriveInternalKey derives the internal builder key at the given index from an entry key (the operator-supplied private key, or the one derived from the mnemonic via DeriveBLSPrivkeyHex).
Index 0 returns the entry key itself, so the first managed key is always the one the operator configured. Higher indices apply one further EIP-2333 derivation level, i.e. derive_child_SK(entry_sk, index) — for a mnemonic entry key that is the path m/12381/3600/{account}/0/0/{index}, one node deeper than any other participant's account path. That depth is what makes the internal key set collision-free with other builders sharing the same mnemonic: no amount of walking the account index can reach a node below our own key.
It returns the 32-byte secret key as a 64-character lowercase hex string (no 0x prefix), matching the format accepted by NewBLSSigner.
func ResolveEntryPrivkey ¶ added in v0.0.3
ResolveEntryPrivkey resolves the operator-supplied builder key source — either a raw hex private key or a BIP-39 mnemonic + account index — to a 32-byte hex private key. The mnemonic takes precedence when set (callers are expected to enforce mutual exclusivity via config validation).
The result is the entry key of the internal key set: see DeriveInternalKey.
func VerifyBLSSignature ¶
func VerifyBLSSignature(pubkey phase0.BLSPubKey, message []byte, signature phase0.BLSSignature) bool
VerifyBLSSignature verifies a BLS signature over a message with the given public key. Returns true if the signature is valid.
Types ¶
type BLSSigner ¶
type BLSSigner struct {
// contains filtered or unexported fields
}
BLSSigner handles BLS signing operations for a builder.
func NewBLSSigner ¶
NewBLSSigner creates a new BLS signer from a hex-encoded private key.
func NewBuilderSigner ¶
NewBuilderSigner builds a BLS signer from a builder key source: either a raw hex private key or a BIP-39 mnemonic + account index.
func (*BLSSigner) PublicKeyBytes ¶
PublicKeyBytes returns the public key as a byte slice.
func (*BLSSigner) Sign ¶
func (s *BLSSigner) Sign(message []byte) (phase0.BLSSignature, error)
Sign signs a message and returns the signature.
func (*BLSSigner) SignVoluntaryExit ¶
func (s *BLSSigner) SignVoluntaryExit( epoch phase0.Epoch, validatorIndex phase0.ValidatorIndex, forkVersion phase0.Version, genesisValidatorsRoot phase0.Root, ) (phase0.BLSSignature, error)
SignVoluntaryExit signs a voluntary exit message.
func (*BLSSigner) SignWithDomain ¶
func (s *BLSSigner) SignWithDomain(root phase0.Root, domain phase0.Domain) (phase0.BLSSignature, error)
SignWithDomain signs a root with a domain and returns the signature.