types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMMONLEN = 32
	KEY64     = 64
)
View Source
const (
	HASH_SIZE      = 32
	HASH_DATA_AREA = 136
	HashLength     = HASH_SIZE
)

Variables

View Source
var (
	TAGSIZE   = 2
	LENSIZE   = 2
	TAGOFFSET = 0
	LENOFFSET = TAGSIZE
	HEADSIZE  = TAGSIZE + LENSIZE
	VOFFSET   = HEADSIZE

	IvalidCodeERR = errors.New("invalid code")

	EncodeSpaceERR = errors.New("unexpected encode space")
	NilEncoderERR  = errors.New("encoder is nil")
	EncodeTypeERR  = errors.New("unexpected encode type")

	DecodeSpaceERR = errors.New("unexpected decode space")

	NotSerializableTypeERR = errors.New("just support Serializable type")
)

* TLV serialization protocal 1)tlv normal format:

tlv_format=tag + datalen + rawdata|tlv_format

|--2bytes--|--2bytes--|----datalen bytes--------| | tag | datalen | rawdata/tlv_format |

  1. array/slice format tlv_format = [tlv_format,tlv_format,.......]

special:

array/slice with const size element:
     tlv_format whitout tag field and without datalen field
array/slice with uncertain size element:
     tag fied is unused

3)rawdata use bigEndian for basic type

datalen max value is (1<<16)-1, so just only support 65535 bytes rawdata.

View Source
var (
	ErrParamInvalid = errors.New("param invalid")
)
View Source
var NullHash = Hash{}

Functions

func BasicDataSize

func BasicDataSize(data interface{}) int

func Bytes2Hex

func Bytes2Hex(d []byte) string

Bytes2Hex returns the hexadecimal encoding of d.

func Bytes2Uint

func Bytes2Uint(src []byte) (uint64, error)

Bytes2Uint returns the uint64 by the hexadecimal src.

func CopyBytes

func CopyBytes(b []byte) (copiedBytes []byte)

CopyBytes returns an exact copy of the provided bytes.

func DecodeSliceSize

func DecodeSliceSize(elementSize int, data []byte) (int, error)

func FromHex

func FromHex(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func Hex2Bytes

func Hex2Bytes(str string) []byte

Hex2Bytes returns the bytes represented by the hexadecimal string str.

func Hex2BytesFixed

func Hex2BytesFixed(str string, flen int) []byte

Hex2BytesFixed returns bytes of a specified fixed length flen.

func HexEncode

func HexEncode(b []byte) string

func LeftPadBytes

func LeftPadBytes(slice []byte, l int) []byte

LeftPadBytes zero-pads slice to the left up to length l.

func LenTo2Byte

func LenTo2Byte(datalen int, data []byte)

func RightPadBytes

func RightPadBytes(slice []byte, l int) []byte

RightPadBytes zero-pads slice to the right up to length l.

func TagTo2Byte

func TagTo2Byte(tag Tlvtag, data []byte)

func TlvDecodeFromMap

func TlvDecodeFromMap(data []byte, smap map[Tlvtag]Serializable) error

func TlvDecodeFromSlice

func TlvDecodeFromSlice(data []byte, sSlice []Serializable, elementSize int) error

func TlvEncodeFromMap

func TlvEncodeFromMap(data []byte, smap map[Tlvtag]Serializable) (int, error)

func TlvEncodeFromSlice

func TlvEncodeFromSlice(data []byte, sSlice []Serializable, elementSize int) (int, error)

*

elementSize=0,
elementSize > 0,Each element has same length with elementSize,tag and len is unnecessary

func ToHex deprecated

func ToHex(b []byte) string

ToHex returns the hex representation of b, prefixed with '0x'. For empty slices, the return value is "0x0".

Deprecated: use hexutil.Encode instead.

Types

type AccountAddress

type AccountAddress struct {
	ViewPublicKey  PublicKey
	SpendPublicKey PublicKey
}

AccountAddress represents the address with a view-public-key and a spend-public-ley

func (*AccountAddress) DecodeMap

func (k *AccountAddress) DecodeMap() map[Tlvtag]Serializable

func (*AccountAddress) EncodeMap

func (k *AccountAddress) EncodeMap() map[Tlvtag]Serializable

AccountAddress

func (*AccountAddress) TlvDecode

func (k *AccountAddress) TlvDecode(data []byte) error

func (*AccountAddress) TlvEncode

func (k *AccountAddress) TlvEncode(data []byte) (int, error)

func (*AccountAddress) TlvSize

func (k *AccountAddress) TlvSize() int

type AccountKey

type AccountKey struct {
	Addr      AccountAddress
	SpendSKey SecretKey
	ViewSKey  SecretKey
	Address   string
	SubIdx    uint64
}

AccountKey represents a utxo account

func (*AccountKey) DecodeMap

func (k *AccountKey) DecodeMap() map[Tlvtag]Serializable

func (*AccountKey) EncodeMap

func (k *AccountKey) EncodeMap() map[Tlvtag]Serializable

AccountKey

func (*AccountKey) String

func (a *AccountKey) String() string

func (*AccountKey) TlvDecode

func (k *AccountKey) TlvDecode(data []byte) error

func (*AccountKey) TlvEncode

func (k *AccountKey) TlvEncode(data []byte) (int, error)

func (*AccountKey) TlvSize

func (k *AccountKey) TlvSize() int

type BasiceSerializer

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

func NewBasiceSerializer

func NewBasiceSerializer(target interface{}) *BasiceSerializer

func (*BasiceSerializer) TlvDecode

func (e *BasiceSerializer) TlvDecode(data []byte) error

func (*BasiceSerializer) TlvEncode

func (e *BasiceSerializer) TlvEncode(data []byte) (int, error)

func (*BasiceSerializer) TlvSize

func (e *BasiceSerializer) TlvSize() int

type BlobData

type BlobData string

type Block

type Block struct {
	BlockHeader

	MinerTx  Transaction `json:"miner_tx"`
	TxHashes []string    `json:"tx_hashes"`

	// hash cash
	Hash string `json:"block"`
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock() *Block

func (*Block) InvalidateHashes

func (b *Block) InvalidateHashes()

func (*Block) IsHashValid

func (b *Block) IsHashValid() bool

func (*Block) SetHashValid

func (b *Block) SetHashValid(v bool)

type BlockCompleteEntry

type BlockCompleteEntry struct {
	Block BlobData
	Txs   []BlobData
}

type BlockHeader

type BlockHeader struct {
	MajorVersion uint8  `json:"major_version"`
	MinorVersion uint8  `json:"minor_version"` // now used as a voting mechanism, rather than how this particular block is built
	Timestamp    uint64 `json:"timestamp"`
	PrevID       string `json:"prev_id"`
	Nonce        uint32 `json:"nonce"`
}

type BlockOutputIndices

type BlockOutputIndices struct {
	Indices []TxOutputIndices
}

type BoroSig

type BoroSig struct {
	S0 Key64
	S1 Key64
	Ee Key
}

func (*BoroSig) DecodeMap

func (k *BoroSig) DecodeMap() map[Tlvtag]Serializable

func (*BoroSig) EncodeMap

func (k *BoroSig) EncodeMap() map[Tlvtag]Serializable

BoroSig : tlv interface implements

func (*BoroSig) TlvDecode

func (k *BoroSig) TlvDecode(data []byte) error

func (*BoroSig) TlvEncode

func (k *BoroSig) TlvEncode(data []byte) (int, error)

func (*BoroSig) TlvSize

func (k *BoroSig) TlvSize() int

type Bulletproof

type Bulletproof struct {
	V            KeyV `json:"-" rlp:"-"`
	A, S, T1, T2 Key
	Taux, Mu     Key
	L, R         KeyV
	Aa, B, T     Key // Aa --> a
}

func (*Bulletproof) DecodeMap

func (k *Bulletproof) DecodeMap() map[Tlvtag]Serializable

func (*Bulletproof) EncodeMap

func (k *Bulletproof) EncodeMap() map[Tlvtag]Serializable

Bulletproof : tlv interface implements

func (*Bulletproof) TlvDecode

func (k *Bulletproof) TlvDecode(data []byte) error

func (*Bulletproof) TlvEncode

func (k *Bulletproof) TlvEncode(data []byte) (int, error)

func (*Bulletproof) TlvSize

func (k *Bulletproof) TlvSize() int

type CryptoNoteBlock

type CryptoNoteBlock struct {
}

}

type CryptonoteTransaction

type CryptonoteTransaction struct {
}

type Ctkey

type Ctkey struct {
	Dest Key
	Mask Key
}

func (*Ctkey) DecodeMap

func (k *Ctkey) DecodeMap() map[Tlvtag]Serializable

func (*Ctkey) EncodeMap

func (k *Ctkey) EncodeMap() map[Tlvtag]Serializable

func (*Ctkey) IsEqual

func (t *Ctkey) IsEqual(to *Ctkey) bool

func (*Ctkey) TlvDecode

func (k *Ctkey) TlvDecode(data []byte) error

func (*Ctkey) TlvEncode

func (k *Ctkey) TlvEncode(data []byte) (int, error)

func (*Ctkey) TlvSize

func (k *Ctkey) TlvSize() int

Ctkey : tlv interface implements

type CtkeyM

type CtkeyM []CtkeyV

func (*CtkeyM) IsEqual

func (t *CtkeyM) IsEqual(to *CtkeyM) bool

func (*CtkeyM) TlvDecode

func (k *CtkeyM) TlvDecode(data []byte) error

func (*CtkeyM) TlvEncode

func (k *CtkeyM) TlvEncode(data []byte) (int, error)

func (*CtkeyM) TlvSize

func (k *CtkeyM) TlvSize() int

CtkeyM : tlv interface implements

type CtkeyV

type CtkeyV []Ctkey

func (*CtkeyV) IsEqual

func (t *CtkeyV) IsEqual(to *CtkeyV) bool

func (*CtkeyV) TlvDecode

func (k *CtkeyV) TlvDecode(data []byte) error

func (*CtkeyV) TlvEncode

func (k *CtkeyV) TlvEncode(data []byte) (int, error)

func (*CtkeyV) TlvSize

func (k *CtkeyV) TlvSize() int

CtkeyV : tlv interface implements

type EcPoint

type EcPoint Key

type EcScalar

type EcScalar Key

type EcdhTuple

type EcdhTuple struct {
	Mask     Key
	Amount   Key
	SenderPK Key
}

func (*EcdhTuple) DecodeMap

func (k *EcdhTuple) DecodeMap() map[Tlvtag]Serializable

func (*EcdhTuple) EncodeMap

func (k *EcdhTuple) EncodeMap() map[Tlvtag]Serializable

EcdhTuple : tlv interface implements

func (*EcdhTuple) TlvDecode

func (k *EcdhTuple) TlvDecode(data []byte) error

func (*EcdhTuple) TlvEncode

func (k *EcdhTuple) TlvEncode(data []byte) (int, error)

func (*EcdhTuple) TlvSize

func (k *EcdhTuple) TlvSize() int

type FieldSerializable

type FieldSerializable interface {
	TlvSize() int
	SerializableConfig() map[Tlvtag]interface{}
	DeSerializableConfig() map[Tlvtag]interface{}
}

type Hash

type Hash [HASH_SIZE]byte

func BytesToHash

func BytesToHash(b []byte) Hash

BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.

func HexToHash

func HexToHash(s string) Hash

HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.

func (Hash) Hex

func (h Hash) Hex() string

Hex converts a hash to a hex string.

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.

func (Hash) String

func (h Hash) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

func (Hash) TerminalString

func (h Hash) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type Hash8

type Hash8 [8]byte

func BytesToHash8

func BytesToHash8(b []byte) Hash8

BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.

func HexToHash8

func HexToHash8(s string) Hash8

=========================== HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.

func (Hash8) Hex

func (h Hash8) Hex() string

Hex converts a hash to a hex string.

func (*Hash8) SetBytes

func (h *Hash8) SetBytes(b []byte)

SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.

func (Hash8) String

func (h Hash8) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

type Key

type Key [COMMONLEN]byte

func BytesToKey added in v0.1.1

func BytesToKey(b []byte) Key

BytesToKey returns Address with value b. If b is larger than len(h), b will be cropped from the left.

func HexToKey added in v0.1.1

func HexToKey(s string) Key

HexToKey returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.

func (*Key) Big

func (h *Key) Big() *big.Int

Big converts a hash to a big integer.

func (*Key) Hex

func (h *Key) Hex() string

Hex converts a hash to a hex string.

func (*Key) IsEqual

func (h *Key) IsEqual(to *Key) bool

func (*Key) SetBytes added in v0.1.1

func (h *Key) SetBytes(b []byte)

SetBytes set key bytes

func (*Key) String

func (h *Key) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

func (*Key) TlvDecode

func (k *Key) TlvDecode(data []byte) error

func (*Key) TlvEncode

func (k *Key) TlvEncode(encodeDate []byte) (int, error)

func (*Key) TlvSize

func (k *Key) TlvSize() int

type Key64

type Key64 [KEY64]Key

func (*Key64) TlvDecode

func (k *Key64) TlvDecode(data []byte) error

func (*Key64) TlvEncode

func (k *Key64) TlvEncode(data []byte) (int, error)

func (*Key64) TlvSize

func (k *Key64) TlvSize() int

Key64 : tlv interface implements

type KeyDerivation

type KeyDerivation EcPoint

func (KeyDerivation) Big

func (h KeyDerivation) Big() *big.Int

Big converts a hash to a big integer.

func (KeyDerivation) Hex

func (h KeyDerivation) Hex() string

Hex converts a hash to a hex string.

func (KeyDerivation) String

func (h KeyDerivation) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

type KeyImage

type KeyImage EcPoint

func (KeyImage) Big

func (h KeyImage) Big() *big.Int

Big converts a hash to a big integer.

func (KeyImage) Hex

func (h KeyImage) Hex() string

Hex converts a hash to a hex string.

func (KeyImage) String

func (h KeyImage) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

type KeyM

type KeyM []KeyV

func (*KeyM) TlvDecode

func (k *KeyM) TlvDecode(data []byte) error

func (*KeyM) TlvEncode

func (k *KeyM) TlvEncode(data []byte) (int, error)

func (*KeyM) TlvSize

func (k *KeyM) TlvSize() int

KeyM : tlv interface implements

type KeyV

type KeyV []Key

func (*KeyV) IsEqual

func (key *KeyV) IsEqual(to *KeyV) bool

func (*KeyV) TlvDecode

func (k *KeyV) TlvDecode(data []byte) error

func (*KeyV) TlvEncode

func (k *KeyV) TlvEncode(data []byte) (int, error)

func (*KeyV) TlvSize

func (k *KeyV) TlvSize() int

KeyV : tlv interface implements

type Lk_amount

type Lk_amount uint64

type MgSig

type MgSig struct {
	Ss KeyM
	Cc Key
	II KeyV `json:"-" rlp:"-"`
}

func (*MgSig) DecodeMap

func (k *MgSig) DecodeMap() map[Tlvtag]Serializable

func (*MgSig) EncodeMap

func (k *MgSig) EncodeMap() map[Tlvtag]Serializable

MgSig : tlv interface implements

func (*MgSig) TlvDecode

func (k *MgSig) TlvDecode(data []byte) error

func (*MgSig) TlvEncode

func (k *MgSig) TlvEncode(data []byte) (int, error)

func (*MgSig) TlvSize

func (k *MgSig) TlvSize() int

type MultisigKLRki

type MultisigKLRki struct {
	K  Key
	L  Key
	R  Key
	Ki Key
}

func (*MultisigKLRki) DecodeMap

func (k *MultisigKLRki) DecodeMap() map[Tlvtag]Serializable

func (*MultisigKLRki) EncodeMap

func (k *MultisigKLRki) EncodeMap() map[Tlvtag]Serializable

MultisigKLRki : tlv interface implements

func (*MultisigKLRki) TlvDecode

func (k *MultisigKLRki) TlvDecode(data []byte) error

func (*MultisigKLRki) TlvEncode

func (k *MultisigKLRki) TlvEncode(data []byte) (int, error)

func (*MultisigKLRki) TlvSize

func (k *MultisigKLRki) TlvSize() int

type MultisigOut

type MultisigOut struct {
	C KeyV
}

func (*MultisigOut) DecodeMap

func (k *MultisigOut) DecodeMap() map[Tlvtag]Serializable

func (*MultisigOut) EncodeMap

func (k *MultisigOut) EncodeMap() map[Tlvtag]Serializable

MultisigOut : tlv interface implements

func (*MultisigOut) TlvDecode

func (k *MultisigOut) TlvDecode(data []byte) error

func (*MultisigOut) TlvEncode

func (k *MultisigOut) TlvEncode(data []byte) (int, error)

func (*MultisigOut) TlvSize

func (k *MultisigOut) TlvSize() int

type ParsedBlock

type ParsedBlock struct {
	Hash     Hash
	Block    Block
	Txes     []Transaction
	OIndices BlockOutputIndices
	HasErr   bool
}

type PublicKey

type PublicKey EcPoint

func (PublicKey) Big

func (h PublicKey) Big() *big.Int

Big converts a hash to a big integer.

func (PublicKey) Hex

func (h PublicKey) Hex() string

Hex converts a hash to a hex string.

func (PublicKey) String

func (h PublicKey) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

func (*PublicKey) TlvDecode

func (k *PublicKey) TlvDecode(data []byte) error

func (*PublicKey) TlvEncode

func (k *PublicKey) TlvEncode(encodeDate []byte) (int, error)

func (*PublicKey) TlvSize

func (k *PublicKey) TlvSize() int

PublicKey

type RangeProofType

type RangeProofType uint8
const (
	RCTTypeNull         RangeProofType = 0
	RCTTypeFull         RangeProofType = 1
	RCTTypeSimple       RangeProofType = 2
	RCTTypeBulletproof  RangeProofType = 3
	RCTTypeBulletproof2 RangeProofType = 4
)

func (*RangeProofType) TlvDecode

func (k *RangeProofType) TlvDecode(data []byte) error

func (*RangeProofType) TlvEncode

func (k *RangeProofType) TlvEncode(data []byte) (int, error)

func (*RangeProofType) TlvSize

func (k *RangeProofType) TlvSize() int

RangeProofType : tlv interface implements

type RangeSig

type RangeSig struct {
	Asig BoroSig
	Ci   Key64
}

func (*RangeSig) DecodeMap

func (k *RangeSig) DecodeMap() map[Tlvtag]Serializable

func (*RangeSig) EncodeMap

func (k *RangeSig) EncodeMap() map[Tlvtag]Serializable

RangeSig : tlv interface implements

func (*RangeSig) TlvDecode

func (k *RangeSig) TlvDecode(data []byte) error

func (*RangeSig) TlvEncode

func (k *RangeSig) TlvEncode(data []byte) (int, error)

func (*RangeSig) TlvSize

func (k *RangeSig) TlvSize() int

type RctConfig

type RctConfig struct {
	RangeProofType RangeProofType
	BpVersion      int32
}

func (*RctConfig) DecodeMap

func (k *RctConfig) DecodeMap() map[Tlvtag]Serializable

func (*RctConfig) EncodeMap

func (k *RctConfig) EncodeMap() map[Tlvtag]Serializable

RctConfig : tlv interface implements

func (*RctConfig) TlvDecode

func (k *RctConfig) TlvDecode(data []byte) error

func (*RctConfig) TlvEncode

func (k *RctConfig) TlvEncode(data []byte) (int, error)

func (*RctConfig) TlvSize

func (k *RctConfig) TlvSize() int

type RctSig

type RctSig struct {
	RctSigBase
	P RctSigPrunable
}

func (*RctSig) DecodeMap

func (k *RctSig) DecodeMap() map[Tlvtag]Serializable

func (*RctSig) EncodeMap

func (k *RctSig) EncodeMap() map[Tlvtag]Serializable

RctSig : tlv interface implements

func (*RctSig) TlvDecode

func (k *RctSig) TlvDecode(data []byte) error

func (*RctSig) TlvEncode

func (k *RctSig) TlvEncode(data []byte) (int, error)

func (*RctSig) TlvSize

func (k *RctSig) TlvSize() int

type RctSigBase

type RctSigBase struct {
	Type       uint8
	Message    Key    `json:"-" rlp:"-"`
	MixRing    CtkeyM `json:"-" rlp:"-"`
	PseudoOuts KeyV
	EcdhInfo   []EcdhTuple
	OutPk      CtkeyV
	TxnFee     Lk_amount
}

func (*RctSigBase) DecodeMap

func (k *RctSigBase) DecodeMap() map[Tlvtag]Serializable

func (*RctSigBase) EncodeMap

func (k *RctSigBase) EncodeMap() map[Tlvtag]Serializable

RctSigBase : tlv interface implements

func (*RctSigBase) TlvDecode

func (k *RctSigBase) TlvDecode(data []byte) error

func (*RctSigBase) TlvEncode

func (k *RctSigBase) TlvEncode(data []byte) (int, error)

func (*RctSigBase) TlvSize

func (k *RctSigBase) TlvSize() int

type RctSigPrunable

type RctSigPrunable struct {
	RangeSigs    []RangeSig
	Bulletproofs []Bulletproof
	MGs          []MgSig
	PseudoOuts   KeyV
	Ss           []Signature
}

func (*RctSigPrunable) DecodeMap

func (k *RctSigPrunable) DecodeMap() map[Tlvtag]Serializable

func (*RctSigPrunable) EncodeMap

func (k *RctSigPrunable) EncodeMap() map[Tlvtag]Serializable

RctSigPrunable : tlv interface implements

func (*RctSigPrunable) TlvDecode

func (k *RctSigPrunable) TlvDecode(data []byte) error

func (*RctSigPrunable) TlvEncode

func (k *RctSigPrunable) TlvEncode(data []byte) (int, error)

func (*RctSigPrunable) TlvSize

func (k *RctSigPrunable) TlvSize() int

type SecretKey

type SecretKey EcScalar

func (SecretKey) Big

func (h SecretKey) Big() *big.Int

Big converts a hash to a big integer.

func (SecretKey) Hex

func (h SecretKey) Hex() string

Hex converts a hash to a hex string.

func (SecretKey) String

func (h SecretKey) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

func (*SecretKey) TlvDecode

func (k *SecretKey) TlvDecode(data []byte) error

func (*SecretKey) TlvEncode

func (k *SecretKey) TlvEncode(encodeDate []byte) (int, error)

func (*SecretKey) TlvSize

func (k *SecretKey) TlvSize() int

SecretKey

type SecretKeyV

type SecretKeyV []SecretKey

type Serializable

type Serializable interface {
	TlvEncode([]byte) (int, error)
	TlvDecode([]byte) error
	TlvSize() int
}

type Signature

type Signature struct {
	C, R EcScalar
}

type SliceSerializer

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

func NewSliceSerializer

func NewSliceSerializer(elementSize int, target interface{}) *SliceSerializer

func (*SliceSerializer) TlvDecode

func (e *SliceSerializer) TlvDecode(data []byte) error

func (*SliceSerializer) TlvEncode

func (e *SliceSerializer) TlvEncode(data []byte) (int, error)

func (*SliceSerializer) TlvSize

func (e *SliceSerializer) TlvSize() int

type TlvMapSerializer

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

func NewTlvMapSerializer

func NewTlvMapSerializer() *TlvMapSerializer

func NewTlvMapSerializerWith

func NewTlvMapSerializerWith(serializer ...Serializable) *TlvMapSerializer

func (*TlvMapSerializer) SetTagAndSerializer

func (tms *TlvMapSerializer) SetTagAndSerializer(tag Tlvtag, serializer Serializable)

func (*TlvMapSerializer) TlvDecode

func (tms *TlvMapSerializer) TlvDecode(data []byte) error

func (*TlvMapSerializer) TlvEncode

func (tms *TlvMapSerializer) TlvEncode(data []byte) (int, error)

func (*TlvMapSerializer) TlvSize

func (tms *TlvMapSerializer) TlvSize() int

type Tlvtag

type Tlvtag int

func ParseTagAndLen

func ParseTagAndLen(data []byte) (tag Tlvtag, dlen int, err error)

type Transaction

type Transaction struct {
	TransactionPrefix

	Signatures    [][]Signature //count signatures  always the same as inputs count
	RctSignatures RctSig        `json:"rct_signatures"`

	Hash     Hash
	BlobSize int
	// contains filtered or unexported fields
}

func (*Transaction) InvalidateHashes

func (t *Transaction) InvalidateHashes()

func (*Transaction) IsHashValid

func (t *Transaction) IsHashValid() bool

func (*Transaction) IstBlobSizeValid

func (t *Transaction) IstBlobSizeValid() bool

func (*Transaction) SetBlobSizeValid

func (t *Transaction) SetBlobSizeValid(v bool)

func (*Transaction) SetHashValid

func (t *Transaction) SetHashValid(v bool)

type TransactionPrefix

type TransactionPrefix struct {
	// tx information
	Version    int    `json:"version"`
	UnlockTime uint64 `json:"unlock_time"` //number of block (or time), used as a limitation like: spend this tx not early then block/time

	Vin  []TxinV `json:"vin"`
	Vout []TxOut `json:"vout"`
	//extra
	Extra []uint8 `json:"extra"`
}

type TxCacheData

type TxCacheData struct {
	TxExtraFields []TxExtraField
}

type TxExtraField

type TxExtraField struct{}

func (*TxExtraField) Clear

func (tef *TxExtraField) Clear()

type TxOut

type TxOut struct {
	Amount *big.Int
	Target TxoutTargetV
}

type TxOutputIndices

type TxOutputIndices struct {
	Indices []uint64
}

type TxinGen

type TxinGen struct {
	Height uint64 `json:"height"`
}

type TxinToKey

type TxinToKey struct {
	Amount     *big.Int
	KeyOffsets []uint64
	KImage     KeyImage // double spending protection
}

type TxinToScript

type TxinToScript struct {
	Prev    Hash
	Prevout int
	Sigset  []uint8
}

type TxinToScripthash

type TxinToScripthash struct {
	Prev    Hash
	Prevout int
	Script  TxoutToScript
	Sigset  []uint8
}

type TxinV

type TxinV interface{}

TxinV type is in(TxinGen TxinToScript TxinToScripthash TxinToKey)

type TxoutTargetV

type TxoutTargetV struct{}

TxoutTargetV type is in(TxoutToScript TxoutToScripthash TxoutToKey)

type TxoutToKey

type TxoutToKey struct {
	Key PublicKey
}

type TxoutToScript

type TxoutToScript struct {
	Keys   []PublicKey
	Script []uint8
}

type TxoutToScripthash

type TxoutToScripthash struct {
	Hash Hash
}

Jump to

Keyboard shortcuts

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