multisig

package
v1.16.39 Latest Latest
Warning

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

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

Documentation

Overview

Package multisig provides multi-signature transaction support.

Index

Constants

This section is empty.

Variables

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

Functions

func GetOwners

func GetOwners(network network.LegacyNetwork, netID 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) GetNetID added in v1.3.8

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

GetNetID gets net id associated to tx

func (*Multisig) GetNetOwners added in v1.3.8

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

func (*Multisig) GetNetwork

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

GetNetwork gets network model associated to tx.

func (*Multisig) GetNetworkID

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

GetNetworkID gets 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) 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
	PChainRemoveChainValidatorTx
	PChainAddChainValidatorTx
	PChainCreateChainTx
	PChainTransformChainTx
	PChainAddPermissionlessValidatorTx
	PChainTransferChainOwnershipTx
)

Jump to

Keyboard shortcuts

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