multisig

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

View Source
var ErrUndefinedTx = fmt.Errorf("tx is undefined")

Functions

func GetOwners

func GetOwners(network network.Network, subnetID ids.ID) ([]ids.ShortID, uint32, error)

Types

type Multisig

type Multisig struct {
	PChainTx *txs.Tx
	// contains filtered or unexported fields
}

func New

func New(pChainTx *txs.Tx) *Multisig

func (*Multisig) FromBytes

func (ms *Multisig) FromBytes(txBytes []byte) error

func (*Multisig) GetAuthSigners

func (ms *Multisig) GetAuthSigners() ([]ids.ShortID, error)

GetAuthSigners gets all subnet auth addresses that are required to sign a given tx

  • get subnet control keys as string slice using P-Chain API (GetOwners)
  • get subnet auth indices from the tx, field tx.UnsignedTx.SubnetAuth
  • creates the string slice of required subnet auth addresses by applying the indices to the control keys slice

func (*Multisig) GetBlockchainID

func (ms *Multisig) GetBlockchainID() (ids.ID, error)

func (*Multisig) GetNetwork

func (ms *Multisig) GetNetwork() (network.Network, error)

get network model associated to tx

func (*Multisig) GetNetworkID

func (ms *Multisig) GetNetworkID() (uint32, error)

get network id associated to tx

func (*Multisig) GetRemainingAuthSigners

func (ms *Multisig) GetRemainingAuthSigners() ([]ids.ShortID, []ids.ShortID, error)

GetRemainingAuthSigners gets subnet auth addresses that have not signed a given tx

  • get the string slice of auth signers for the tx (GetAuthSigners)
  • verifies that all creds in tx.Creds, except the last one, are fully signed (a cred is fully signed if all the signatures in cred.Sigs are non-empty)
  • computes remaining signers by iterating the last cred in tx.Creds, associated to subnet auth signing
  • for each sig in cred.Sig: if sig is empty, then add the associated auth signer address (obtained from authSigners by using the index) to the remaining signers list

if the tx is fully signed, returns empty slice

func (*Multisig) GetSpendSigners

func (*Multisig) GetSpendSigners() ([]ids.ShortID, error)

func (*Multisig) GetSubnetID

func (ms *Multisig) GetSubnetID() (ids.ID, error)

GetSubnetID gets subnet id associated to tx

func (*Multisig) GetSubnetOwners

func (ms *Multisig) GetSubnetOwners() ([]ids.ShortID, uint32, error)

func (*Multisig) GetTxKind

func (ms *Multisig) GetTxKind() (TxKind, error)

func (*Multisig) GetWrappedPChainTx

func (ms *Multisig) GetWrappedPChainTx() (*txs.Tx, error)

func (*Multisig) IsReadyToCommit

func (ms *Multisig) IsReadyToCommit() (bool, error)

func (*Multisig) String

func (ms *Multisig) String() string

func (*Multisig) ToBytes

func (ms *Multisig) ToBytes() ([]byte, error)

func (*Multisig) Undefined

func (ms *Multisig) Undefined() bool

type TxKind

type TxKind int64
const (
	Undefined TxKind = iota
	PChainRemoveSubnetValidatorTx
	PChainAddSubnetValidatorTx
	PChainCreateChainTx
	PChainTransformSubnetTx
	PChainAddPermissionlessValidatorTx
	PChainTransferSubnetOwnershipTx
)

Jump to

Keyboard shortcuts

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