slateversions

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnknownSlateState coming from earlier versions of the slate
	UnknownSlateState slateStateV4 = iota
	// Standard1SlateState flow, freshly init
	Standard1SlateState
	// Standard2SlateState flow, return journey
	Standard2SlateState
	// Standard3SlateState flow, ready for transaction posting
	Standard3SlateState
	// Invoice1SlateState flow, freshly init
	Invoice1SlateState
	// Invoice2SlateState flow, return journey
	Invoice2SlateState
	// Invoice3SlateState flow, ready for tranasction posting
	Invoice3SlateState
)
View Source
const CurrentSlateVersion uint16 = 4

CurrentSlateVersion is the most recent version of the slate

View Source
const GrinBlockHeaderVersion uint16 = 3

GrinBlockHeaderVersion is the grin block header this slate is intended to be compatible with

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitsV4

type CommitsV4 struct {
	// Options for an output's structure or use
	F OutputFeaturesV4 `json:"f"`
	// The homomorphic commitment representing the output amount
	C string `json:"c"`
	// A proof that the commitment is in the right range
	// Only applies for transaction outputs
	P *string `json:"p,omitempty"`
}

CommitsV4 is a v4 commit

type InputV4

type InputV4 struct {
	// The features of the output being spent.
	// We will check maturity for coinbase output.
	Features OutputFeaturesV4 `json:"features"`
	// The commit referencing the output being spent.
	Commit string `json:"commit"`
}

InputV4 is a v4 input

type KernelFeaturesArgsV4

type KernelFeaturesArgsV4 struct {
	/// Lock height, for HeightLocked
	LockHgt core.Uint64 `json:"lock_hgt"`
}

KernelFeaturesArgsV4 are the kernel features arguments definition

type OutputFeaturesV4

type OutputFeaturesV4 uint8

OutputFeaturesV4 is a v4 output features

type OutputV4

type OutputV4 struct {
	// Options for an output's structure or use
	Features OutputFeaturesV4 `json:"features"`
	// The homomorphic commitment representing the output amount
	Com string `json:"com"`
	// A proof that the commitment is in the right range
	Prf string `json:"prf"`
}

OutputV4 is a v4 output

type ParticipantDataV4

type ParticipantDataV4 struct {
	// Public key corresponding to private blinding factor
	Xs string `json:"xs"`
	// Public key corresponding to private nonce
	Nonce string `json:"nonce"`
	// Public partial signature
	Part *string `json:"part,omitempty"`
}

ParticipantDataV4 is a v4 participant data

type PaymentInfoV4

type PaymentInfoV4 struct {
	Saddr string  `json:"saddr"`
	Raddr string  `json:"raddr"`
	Rsig  *string `json:"rsig,omitempty"`
}

PaymentInfoV4 is a v4 payment info

type SlateV4

type SlateV4 struct {
	// Versioning info
	Ver VersionCompatInfoV4 `json:"ver"`
	// Unique transaction ID, selected by sender
	ID uuid.UUID `json:"id"`
	// Slate state
	Sta slateStateV4 `json:"sta"`
	// Optional fields depending on state
	// Offset, modified by each participant inserting inputs
	Off string `json:"off,omitempty"`
	// The number of participants intended to take part in this transaction, optional
	NumParts uint8 `json:"num_parts"`
	// base amount (excluding fee)
	Amt core.Uint64 `json:"amt"`
	// fee amount
	Fee core.Uint64 `json:"fee"`
	// kernel features, if any
	Feat uint8 `json:"feat"`
	// TTL, the block height at which wallets
	// should refuse to process the transaction and unlock all
	TTL core.Uint64 `json:"ttl"`
	// Structs always required
	// Participant data, each participant in the transaction will
	// insert their public data here. For now, 0 is sender and 1
	// is receiver, though this will change for multi-party
	Sigs []ParticipantDataV4 `json:"sigs"`
	// Situational, but required at some point in the tx
	// Inputs/Output commits added to slate
	Coms *[]CommitsV4 `json:"coms,omitempty"`
	// Optional Structs
	// Payment Proof
	Proof *PaymentInfoV4 `json:"proof,omitempty"`
	// Kernel features arguments
	FeatArgs *KernelFeaturesArgsV4 `json:"feat_args,omitempty"`
}

SlateV4 slate v4

func (SlateV4) MarshalJSON

func (s SlateV4) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaller to account for default field

func (*SlateV4) UnmarshalJSON

func (s *SlateV4) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom unmarshaller that respect default value

type SlateVersion

type SlateVersion int

SlateVersion represents the slate version

const (
	// V4SlateVersion is v4 (most current)
	V4SlateVersion SlateVersion = iota
)

func (SlateVersion) MarshalJSON added in v5.1.0

func (s SlateVersion) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (*SlateVersion) UnmarshalJSON added in v5.1.0

func (s *SlateVersion) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a quoted json string to the enum value

type TransactionBodyV4

type TransactionBodyV4 struct {
	// List of inputs spent by the transaction.
	Ins []InputV4 `json:"ins"`
	// List of outputs the transaction produces.
	Outs []OutputV4 `json:"outs"`
	// List of kernels that make up this transaction (usually a single kernel).
	Kers []TxKernelV4 `json:"kers"`
}

TransactionBodyV4 is a common abstraction for transaction and block

type TransactionV4

type TransactionV4 struct {
	// The kernel "offset" k2
	// excess is k1G after splitting the key k = k1 + k2
	Offset string `json:"offset"`
	// The transaction body - inputs/outputs/kernels
	Body TransactionBodyV4 `json:"body"`
}

TransactionV4 is a v4 transaction

type TxKernelV4

type TxKernelV4 struct {
	// Options for a kernel's structure or use
	Features core.KernelFeatures `json:"features"`
	// Fee originally included in the transaction this proof is for.
	Fee core.Uint64 `json:"fee"`
	// This kernel is not valid earlier than lock_height blocks
	// The max lock_height of all *inputs* to this transaction
	LockHeight core.Uint64 `json:"lock_height"`
	// Remainder of the sum of all transaction commitments. If the transaction
	// is well formed, amounts components should sum to zero and the excess
	// is hence a valid public key.
	Excess string `json:"excess"`
	// The signature proving the excess is a valid public key, which signs
	// the transaction fee.
	ExcessSig string `json:"excess_sig"`
}

TxKernelV4 is a v4 tx kernel

type VersionCompatInfoV4

type VersionCompatInfoV4 struct {
	// The current version of the slate format
	Version uint16 `json:"version"`
	// The grin block header version this slate is intended for
	BlockHeaderVersion uint16 `json:"block_header_version"`
}

VersionCompatInfoV4 is a V4 version compat info

func (VersionCompatInfoV4) MarshalJSON

func (v VersionCompatInfoV4) MarshalJSON() ([]byte, error)

MarshalJSON marshals the VersionCompatInfoV4 as a quoted version like {}:{}

func (*VersionCompatInfoV4) UnmarshalJSON

func (v *VersionCompatInfoV4) UnmarshalJSON(bs []byte) error

UnmarshalJSON unmarshals a quoted version to a VersionCompatInfoV4

Jump to

Keyboard shortcuts

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