systemscript

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChequeArgs

func ChequeArgs(senderLock, receiverLock *types.Script) []byte

ChequeArgs generates a args for cheque script

func DecodeSudtAmount

func DecodeSudtAmount(in []byte) (*big.Int, error)

func EncodeSudtAmount

func EncodeSudtAmount(amount *big.Int) []byte

func GetCodeHash

func GetCodeHash(network types.Network, script SystemScript) types.Hash

func NewScript

func NewScript(script SystemScript, args []byte, network types.Network) *types.Script

func Secp256K1Blake160SignhashAll

func Secp256K1Blake160SignhashAll(key *secp256k1.Secp256k1Key) *types.Script

func Secp256K1Blake160SignhashAllByPublicKey

func Secp256K1Blake160SignhashAllByPublicKey(compressedPubKey []byte) (*types.Script, error)

Secp256K1Blake160SignhashAllByPublicKey generates scep256k1_blake160_sighash_all script with 33-byte compressed public key

func Secp256k1Blake160Multisig

func Secp256k1Blake160Multisig(config *MultisigConfig) (*types.Script, error)

Secp256k1Blake160Multisig generates scep256k1_blake160_multisig script.

Types

type Info

type Info struct {
	CodeHash types.Hash
	HashType types.ScriptHashType
	OutPoint *types.OutPoint
	DepType  types.DepType
}

func GetInfo

func GetInfo(network types.Network, script SystemScript) *Info

type MultisigConfig

type MultisigConfig struct {
	Version    byte
	FirstN     byte
	Threshold  byte
	KeysHashes [][20]byte
}

func DecodeToMultisigConfig

func DecodeToMultisigConfig(in []byte) (*MultisigConfig, error)

func NewMultisigConfig

func NewMultisigConfig(firstN byte, threshold byte) *MultisigConfig

func (*MultisigConfig) AddKeyHash

func (r *MultisigConfig) AddKeyHash(keyHash []byte)

AddKeyHash adds key hash, and panic if keyHash is shorter than 20 bytes.

func (*MultisigConfig) Encode

func (r *MultisigConfig) Encode() []byte

func (*MultisigConfig) Hash160

func (r *MultisigConfig) Hash160() []byte

func (*MultisigConfig) WitnessEmptyPlaceholderInLock

func (r *MultisigConfig) WitnessEmptyPlaceholderInLock() []byte

func (*MultisigConfig) WitnessPlaceholder

func (r *MultisigConfig) WitnessPlaceholder(originalWitness []byte) ([]byte, error)

func (*MultisigConfig) WitnessPlaceholderInLock

func (r *MultisigConfig) WitnessPlaceholderInLock() []byte

type SystemScript

type SystemScript uint
const (
	Secp256k1Blake160SighashAll SystemScript = iota
	Secp256k1Blake160MultisigAll
	AnyoneCanPay
	Dao
	Sudt
	Cheque
	PwLock
	Omnilock
)

Jump to

Keyboard shortcuts

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