libs

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPublicKeys = errors.New("invalid public keys")
	ErrNoPrivateKeys     = errors.New("private keys not supplied")
	ErrInvalidM          = errors.New("invalid m value")
)

Functions

func BuildSignScript

func BuildSignScript(signs *[][]byte) (*script.Script, error)

func FakeSign

func FakeSign(m uint32) (*script.Script, error)

FakeSign 创建一个假的签名脚本,方便计算长度

func GetAddressFromPubKey

func GetAddressFromPubKey(pubKey *ec.PublicKey, isMain bool) (*script.Address, error)

GetAddressFromPubKey is kept for backward compatibility.

func GetAddressFromPublicKey

func GetAddressFromPublicKey(pubKey *ec.PublicKey, isMain bool) (*script.Address, error)

func Lock

func Lock(pubKeys []*ec.PublicKey, m int) (*script.Script, error)

Lock creates a P2MS (Pay to Multi-Signature) locking script

Types

type FeePoolInfo

type FeePoolInfo struct {
	// ServerAmount  uint64
	ExpiredHeight uint32
	PreviousID    *[]byte
}

func GetInfoFromTxOne

func GetInfoFromTxOne(
	tx *transaction.Transaction,

) (info *FeePoolInfo, err error)

type MultiSig

type MultiSig struct {
	PrivateKeys []*ec.PrivateKey
	PublicKeys  []*ec.PublicKey
	M           int // Required signatures
	N           int // Total number of public keys
	SigHashFlag *sighash.Flag
}

MultiSig represents an M-of-N multisig template

func Unlock

func Unlock(privKeys []*ec.PrivateKey, pubKeys []*ec.PublicKey, m int, sigHashFlag *sighash.Flag) (*MultiSig, error)

Unlock creates a new MultiSig unlocking instance

func (*MultiSig) EstimateLength

func (ms *MultiSig) EstimateLength(_ *transaction.Transaction, _ uint32) uint32

EstimateLength estimates the length of the unlocking script

func (*MultiSig) Sign

func (ms *MultiSig) Sign(tx *transaction.Transaction, inputIndex uint32) (*script.Script, error)

Sign creates an unlocking script for the multisig

func (*MultiSig) SignOne

func (ms *MultiSig) SignOne(tx *transaction.Transaction, inputIndex uint32, privateKey *ec.PrivateKey) (*[]byte, error)

分别签名

type UTXO added in v1.0.1

type UTXO struct {
	TxID  string `json:"txid"`
	Vout  uint32 `json:"vout"`
	Value uint64 `json:"satoshis"`
}

UTXO represents an unspent transaction output

Jump to

Keyboard shortcuts

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