transaction

package
v4.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const TxExtraAdditionalPubKeysMaxCount = 4096
View Source
const TxExtraNonceMaxCount = 255
View Source
const TxExtraPaddingMaxCount = 255
View Source
const TxExtraTagAdditionalPubKeys = 0x04
View Source
const TxExtraTagMergeMining = 0x03
View Source
const TxExtraTagMergeMiningMaxCount = types.HashSize + 9
View Source
const TxExtraTagMysteriousMinergate = 0xde
View Source
const TxExtraTagNonce = 0x02
View Source
const TxExtraTagPadding = 0x00
View Source
const TxExtraTagPubKey = 0x01
View Source
const TxExtraTemplateNonceSize = 4
View Source
const TxInGen = 0xff
View Source
const TxInToKey = 0x2
View Source
const TxOutToKey = 2
View Source
const TxOutToTaggedKey = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type CoinbaseTransaction

type CoinbaseTransaction struct {
	Version uint8 `json:"version"`
	// UnlockTime would be here
	InputCount uint8 `json:"input_count"`
	InputType  uint8 `json:"input_type"`
	// UnlockTime re-arranged here to improve memory layout space
	UnlockTime uint64  `json:"unlock_time"`
	GenHeight  uint64  `json:"gen_height"`
	Outputs    Outputs `json:"outputs"`

	Extra ExtraTags `json:"extra"`

	ExtraBaseRCT uint8 `json:"extra_base_rct"`

	// AuxiliaryData Used by p2pool serialized pruned blocks
	AuxiliaryData CoinbaseTransactionAuxiliaryData `json:"auxiliary_data"`
}

func (*CoinbaseTransaction) AppendBinaryFlags

func (c *CoinbaseTransaction) AppendBinaryFlags(preAllocatedBuf []byte, pruned, containsAuxiliaryTemplateId bool) ([]byte, error)

func (*CoinbaseTransaction) BufferLength

func (c *CoinbaseTransaction) BufferLength() int

func (*CoinbaseTransaction) CalculateId

func (c *CoinbaseTransaction) CalculateId() (hash types.Hash)

func (*CoinbaseTransaction) FromReader

func (c *CoinbaseTransaction) FromReader(reader utils.ReaderAndByteReader, canBePruned, containsAuxiliaryTemplateId bool) (err error)

func (*CoinbaseTransaction) MarshalBinary

func (c *CoinbaseTransaction) MarshalBinary() ([]byte, error)

func (*CoinbaseTransaction) MarshalBinaryFlags

func (c *CoinbaseTransaction) MarshalBinaryFlags(pruned, containsAuxiliaryTemplateId bool) ([]byte, error)

func (*CoinbaseTransaction) OutputsBlob

func (c *CoinbaseTransaction) OutputsBlob() ([]byte, error)

func (*CoinbaseTransaction) SideChainHashingBlob

func (c *CoinbaseTransaction) SideChainHashingBlob(preAllocatedBuf []byte, zeroTemplateId bool) ([]byte, error)

func (*CoinbaseTransaction) UnmarshalBinary

func (c *CoinbaseTransaction) UnmarshalBinary(data []byte, canBePruned, containsAuxiliaryTemplateId bool) error

type CoinbaseTransactionAuxiliaryData

type CoinbaseTransactionAuxiliaryData struct {
	// WasPruned TODO: use this in encoding instead of flags?
	WasPruned bool `json:"-"`
	// OutputsBlobSize length of serialized Outputs. Used by p2pool serialized pruned blocks, filled regardless
	OutputsBlobSize uint64 `json:"outputs_blob_size"`
	// TotalReward amount of reward existing Outputs. Used by p2pool serialized pruned blocks, filled regardless
	TotalReward uint64 `json:"total_reward"`
	// TemplateId Required by sidechain.GetOutputs to speed up repeated broadcasts from different peers
	// This must be filled when preprocessing
	TemplateId types.Hash `json:"template_id,omitempty"`
}

type ExtraTag

type ExtraTag struct {
	// VarInt has different meanings. In TxExtraTagMergeMining it is depth, while in others it is length
	VarInt    uint64      `json:"var_int"`
	Tag       uint8       `json:"tag"`
	HasVarInt bool        `json:"has_var_int"`
	Data      types.Bytes `json:"data"`
}

func (*ExtraTag) AppendBinary

func (t *ExtraTag) AppendBinary(preAllocatedBuf []byte) ([]byte, error)

func (*ExtraTag) BufferLength

func (t *ExtraTag) BufferLength() int

func (*ExtraTag) FromReader

func (t *ExtraTag) FromReader(reader utils.ReaderAndByteReader) (err error)

func (*ExtraTag) MarshalBinary

func (t *ExtraTag) MarshalBinary() ([]byte, error)

func (*ExtraTag) SideChainHashingBlob

func (t *ExtraTag) SideChainHashingBlob(preAllocatedBuf []byte, zeroTemplateId bool) ([]byte, error)

func (*ExtraTag) UnmarshalBinary

func (t *ExtraTag) UnmarshalBinary(data []byte) error

type ExtraTags

type ExtraTags []ExtraTag

func (*ExtraTags) AppendBinary

func (t *ExtraTags) AppendBinary(preAllocatedBuf []byte) (buf []byte, err error)

func (*ExtraTags) BufferLength

func (t *ExtraTags) BufferLength() (length int)

func (*ExtraTags) FromReader

func (t *ExtraTags) FromReader(reader utils.ReaderAndByteReader) (err error)

func (*ExtraTags) GetTag

func (t *ExtraTags) GetTag(tag uint8) *ExtraTag

func (*ExtraTags) MarshalBinary

func (t *ExtraTags) MarshalBinary() ([]byte, error)

func (*ExtraTags) SideChainHashingBlob

func (t *ExtraTags) SideChainHashingBlob(preAllocatedBuf []byte, zeroTemplateId bool) (buf []byte, err error)

func (*ExtraTags) UnmarshalBinary

func (t *ExtraTags) UnmarshalBinary(data []byte) (err error)

type Output

type Output struct {
	Index  uint64 `json:"index"`
	Reward uint64 `json:"reward"`
	// Type would be here
	EphemeralPublicKey crypto.PublicKeyBytes `json:"ephemeral_public_key"`
	// Type re-arranged here to improve memory layout space
	Type    uint8 `json:"type"`
	ViewTag uint8 `json:"view_tag"`
}

type Outputs

type Outputs []Output

func (*Outputs) AppendBinary

func (s *Outputs) AppendBinary(preAllocatedBuf []byte) (data []byte, err error)

func (*Outputs) BufferLength

func (s *Outputs) BufferLength() (n int)

func (*Outputs) FromReader

func (s *Outputs) FromReader(reader utils.ReaderAndByteReader) (err error)

func (*Outputs) MarshalBinary

func (s *Outputs) MarshalBinary() (data []byte, err error)

Jump to

Keyboard shortcuts

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