aliencoinTransaction

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultSigType = byte(1) //all

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 DefaultSigTypeBytes = []byte{0x01, 0x00, 0x00, 0x00}
View Source
var DefaultTxVersion = []byte{0x01, 0x00, 0x00, 0x00}
View Source
var (
	ErrorInvalidBase58String = errors.New("invalid base58 string")
)

Errors

Functions

func CreateEmptyTransactionAndHash

func CreateEmptyTransactionAndHash(vin []Vin, vout []Vout, lockTime uint32) (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 SignTransaction

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

func VerifyAndCombineTransaction

func VerifyAndCombineTransaction(emptyTrans string, sigPubs []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
	LockScript []byte
}

func (TxOut) ToBytes

func (out TxOut) ToBytes() []byte

type TxStruct

type TxStruct struct {
	Version []byte // 01000000
	//TimeInterval []byte
	Vin      []TxIn
	Vout     []TxOut
	LockTime []byte
}

func DecodeTxStructRaw

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

func NewTxStruct

func NewTxStruct(vins []Vin, vouts []Vout, lockTime uint32) (*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