vollarTransaction

package
v1.2.27 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultOutFlag = byte(0)
)
View Source
const DefaultSigType = byte(1) //all
View Source
const DefaultTxFlag = byte(0)

Variables

View Source
var (
	CurveOrder     = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, 0xE6, 0xAF, 0x48, 0xA0, 0x3B, 0xBF, 0xD2, 0x5E, 0x8C, 0xD0, 0x36, 0x41, 0x41}
	HalfCurveOrder = []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5D, 0x57, 0x6E, 0x73, 0x57, 0xA4, 0x50, 0x1D, 0xDF, 0xE9, 0x2F, 0x46, 0x68, 0x1B, 0x20, 0xA0}
)
View Source
var (
	BitcoinAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
)

Alphabet: copy from https://en.wikipedia.org/wiki/Base58

View Source
var DefaultTxVersion = []byte{0x01, 0x00, 0x00, 0x00}
View Source
var (
	ErrorInvalidBase58String = errors.New("invalid base58 string")
)

Errors

View Source
var FixedHashData = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Functions

func CreateEmptyRawTransactionAndHash

func CreateEmptyRawTransactionAndHash(vins []Vin, vouts []Vout) (string, []string, error)

func Decode

func Decode(input string, alphabet *Alphabet) ([]byte, error)

Decode docode with custom alphabet

func DecodeCheck

func DecodeCheck(address string) ([]byte, []byte, error)

return prefix + hash + error

func Encode

func Encode(input []byte, alphabet *Alphabet) string

Encode encode with custom alphabet

func EncodeCheck

func EncodeCheck(prefix []byte, hash []byte) string

func SignRawTransaction

func SignRawTransaction(hash string, prikey []byte) ([]byte, error)

func VerifyAndCombineRawTransaction

func VerifyAndCombineRawTransaction(emptyTrans string, sigPub []SigPub) (bool, string, error)

Types

type Alphabet

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

Alphabet The base58 alphabet object.

func NewAlphabet

func NewAlphabet(alphabet string) *Alphabet

NewAlphabet create a custom alphabet from 58-length string. Note: len(rune(alphabet)) must be 58.

func (Alphabet) String

func (alphabet Alphabet) String() string

Alphabet's string representation

type SigPub

type SigPub struct {
	Pubkey    []byte
	Signature []byte
}

func (SigPub) ToBytes

func (sp SigPub) ToBytes() []byte

type TxIn

type TxIn struct {
	TxID       []byte
	Vout       []byte
	SigPub     *SigPub
	Sequence   []byte
	LockScript []byte
}

func (TxIn) ToBytes

func (in TxIn) ToBytes() []byte

type TxOut

type TxOut struct {
	Amount     []byte
	Flag       byte
	LockScript []byte
	HashData   []byte
}

func (TxOut) ToBytes

func (out TxOut) ToBytes() []byte

type TxStruct

type TxStruct struct {
	Version []byte // 01000000
	Flag    byte   // 00
	Vin     []TxIn
	Vout    []TxOut
}

func DecodeTxStructRaw

func DecodeTxStructRaw(trans string) (*TxStruct, []string, error)

func NewTxStruct

func NewTxStruct(vins []Vin, vouts []Vout) (*TxStruct, error)

func (TxStruct) GetHash

func (ts TxStruct) GetHash() ([]string, error)

func (TxStruct) ToBytes

func (ts TxStruct) ToBytes() []byte

type Vin

type Vin struct {
	TxID       string
	Vout       uint32
	LockScript string
}

func (Vin) NewTxIn

func (in Vin) NewTxIn() (*TxIn, error)

type Vout

type Vout struct {
	Address string
	Amount  uint64
}

func (Vout) NewTxOut

func (out Vout) NewTxOut() (*TxOut, error)

Jump to

Keyboard shortcuts

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