slateversions

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 InputV3

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

InputV3 is a v3 input

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 OutputV3

type OutputV3 struct {
	// Options for an output's structure or use
	Features core.OutputFeatures `json:"features"`
	// The homomorphic commitment representing the output amount
	Commit string `json:"commit"`
	// A proof that the commitment is in the right range
	Proof string `json:"proof"`
}

OutputV3 is a v3 output

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 ParticipantDataV3

type ParticipantDataV3 struct {
	// Id of participant in the transaction. (For now, 0=sender, 1=rec)
	ID core.Uint64 `json:"id"`
	// Public key corresponding to private blinding factor
	PublicBlindExcess string `json:"public_blind_excess"`
	// Public key corresponding to private nonce
	PublicNonce string `json:"public_nonce"`
	// Public partial signature
	PartSig *string `json:"part_sig"`
	// A message for other participants
	Message *string `json:"message"`
	// Signature, created with private key corresponding to 'public_blind_excess'
	MessageSig *string `json:"message_sig"`
}

ParticipantDataV3 is the participant data slate version 3

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 PaymentInfoV3

type PaymentInfoV3 struct {
	SenderAddress     string  `json:"sender_address"`
	ReceiverAddress   string  `json:"receiver_address"`
	ReceiverSignature *string `json:"receiver_signature"`
}

PaymentInfoV3 is a v3 payment info

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 SlateV3

type SlateV3 struct {
	// Versioning info
	VersionInfo VersionCompatInfoV3 `json:"version_info"`
	// The number of participants intended to take part in this transaction
	NumParticipants uint `json:"num_participants"`
	// Unique transaction ID, selected by sender
	ID uuid.UUID `json:"id"`
	// The core transaction data:
	// inputs, outputs, kernels, kernel offset
	Transaction TransactionV3 `json:"tx"`
	// base amount (excluding fee)
	Amount core.Uint64 `json:"amount"`
	// fee amount
	Fee core.Uint64 `json:"fee"`
	// Block height for the transaction
	Height core.Uint64 `json:"height"`
	// Lock height
	LockHeight core.Uint64 `json:"lock_height"`
	// TTL, the block height at which wallets
	// should refuse to process the transaction and unlock all
	// associated outputs
	TTLCutoffHeight *core.Uint64 `json:"ttl_cutoff_height"`
	// 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
	ParticipantData []ParticipantDataV3 `json:"participant_data"`
	// Payment Proof
	PaymentProof *PaymentInfoV3 `json:"payment_proof"`
}

SlateV3 slate v3

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 (
	// V4 (most current)
	V4 SlateVersion = iota
	// V3 (3.0.0 - 4.0.0)
	V3
)

type TransactionBodyV3

type TransactionBodyV3 struct {
	// List of inputs spent by the transaction.
	Inputs []InputV3 `json:"inputs"`
	// List of outputs the transaction produces.
	Outputs []OutputV3 `json:"outputs"`
	// List of kernels that make up this transaction (usually a single kernel).
	Kernels []TxKernelV3 `json:"kernels"`
}

TransactionBodyV3 represent a v3 transaction body

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 TransactionV3

type TransactionV3 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 TransactionBodyV3 `json:"body"`
}

TransactionV3 is a v3 transaction

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 TxKernelV3

type TxKernelV3 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"`
}

TxKernelV3 is a v3 tx kernel

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 VersionCompatInfoV3

type VersionCompatInfoV3 struct {
	// The current version of the slate format
	Version uint16 `json:"version"`
	// Original version this slate was converted from
	OrigVersion uint16 `json:"orig_version"`
	// The grin block header version this slate is intended for
	BlockHeaderVersion uint16 `json:"block_header_version"`
}

VersionCompatInfoV3 is a V3 version compat info

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