script

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Push value onto stack
	OP_0     = 0x00
	OP_FALSE = OP_0
	OP_1     = 0x51
	OP_TRUE  = 0x01

	// Stack Operation
	OP_DUP = 0x76

	// Binary arithmetic and conditionals
	OP_EQUAL       = 0x87
	OP_EQUALVERIFY = 0x88

	// Cryptographic and hashing operations
	OP_HASH160       = 0xA9
	OP_CHECKSIG      = 0xAC
	OP_CHECKMULTISIG = 0xAE
)

Variables

View Source
var DefaultNetwork = Mainnet

Functions

func Hash160

func Hash160(buf []byte) []byte

func IsXPub

func IsXPub(s string) bool

IsXPub returns if a string looks like an XPub or not

func NewBytes

func NewBytes(bufs ...[]byte) []byte

func OP_N

func OP_N(n int) byte

func OP_PUSH_BYTES

func OP_PUSH_BYTES(b int) byte

func Sha256

func Sha256(buf []byte) []byte

Types

type Key

type Key interface {
	Bytes() []byte
	String() string
}

type Network

type Network int
const (
	Mainnet Network = iota
	Testnet
	Regtest
)

type PubKey

type PubKey struct {
	// contains filtered or unexported fields
}

func NewPubKey

func NewPubKey(s string) (*PubKey, error)

func (*PubKey) Bytes

func (pk *PubKey) Bytes() []byte

func (*PubKey) String

func (pk *PubKey) String() string

type Script

type Script struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(s string) (*Script, error)

func ParseWithPath

func ParseWithPath(s string, path string) (*Script, error)

func (*Script) Address

func (s *Script) Address(net Network) string

func (*Script) Bytes

func (s *Script) Bytes() []byte

type ScriptExpr

type ScriptExpr interface {
	Eval() (*Script, error)
}

func Multi

func Multi(m int, keys ...string) ScriptExpr

func Pkh

func Pkh(key string) ScriptExpr

func Sh

func Sh(expr ScriptExpr) ScriptExpr

func Sortedmulti

func Sortedmulti(m int, keys ...string) ScriptExpr

func Tr

func Tr(key string, tree Tree) ScriptExpr

func Wpkh

func Wpkh(key string) ScriptExpr

func Wsh

func Wsh(expr ScriptExpr) ScriptExpr

type Tree

type Tree interface {
}

type XPub

type XPub struct {
	// contains filtered or unexported fields
}

func NewXPub

func NewXPub(s string) (*XPub, error)

func (*XPub) Child

func (xpub *XPub) Child(i uint32) (Key, error)

func (*XPub) Derive

func (xpub *XPub) Derive(path string) (*XPub, error)

func (*XPub) PubKey

func (xpub *XPub) PubKey() (string, error)

func (*XPub) String

func (xpub *XPub) String() string

Jump to

Keyboard shortcuts

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