legacy

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 12 Imported by: 0

README

Legacy Schemas

This document will explain the manner in which data is carried by the RUSK structures, when the node is running on legacy mode (which is used for testing purposes).

Schemas

The schemas will be structured in a way which depicts the old transaction types, and then their corresponding field on the RUSK structures. If a field is not named on a RUSK structure, it can be assumed to be filled with the appropriate amount of zero bytes. To find the full versions of the RUSK structures, please consult the rusk-schema repo.

Block, Block Header, Certificate

The block structure inherently stays unchanged between the legacy library and the new one. The difference comes from the types of transactions between the two. Besides this, the coinbase output is set to be the very last one in the array in the new block structure, due to VM requirements.

Standard TX

RUSK structure: Transaction

Standard TX Fields Rusk Field
Version Version
Type Type
R TxPayload.Anchor
Inputs TxPayload.Nullifier
Outputs TxPayload.Notes
Rangeproof TxPayload.SpendingProof

Currently, the fee is not manually set, and thus isn't really carried over in either structure. It is always assumed to be 0.0000000100 DUSK.

Stake TX

RUSK structure: Transaction

Besides everything contained in the Standard TX, the remaining fields are carried as follows:

Stake TX Fields Rusk Field
Locktime TxPayload.CallData[0:8]
BLS Public Key TxPayload.CallData[8:]
Bid TX

RUSK structure: Transaction

Besides everything contained in the Standard TX, the remaining fields are carried as follows:

Bid TX Fields Rusk Field
Locktime TxPayload.CallData[0:8]
M TxPayload.CallData[8:]
Coinbase TX

RUSK structure: Transaction

Besides everything contained in the Standard TX, the remaining fields are carried as follows:

Coinbase TX Fields Rusk Field
Rewards.Amount TxPayload.CallData[0:8]
Rewards.R TxPayload.Notes[0].PkR
Inputs

RUSK structure: Nullifier

Since a RUSK nullifier basically only contains a scalar, we break the size limit rule for this particular field, to encode all legacy input fields in a contiguous buffer.

Input Fields Rusk Fields
KeyImage Scalar.Data[0:32]
PubKey.P Scalar.Data[32:64]
PseudoCommitment Scalar.Data[64:96]
KeyImage Scalar.Data[96:]
Outputs

RUSK structure: Note

Output Fields Rusk Fields
Commitment Randomness
PubKey.P PkR
EncryptedAmount Commitment
EncryptedMask Nonce

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BidToRuskBid

func BidToRuskBid(tx *transactions.Bid) (*rusk.BidTransaction, error)

BidToRuskBid turns a legacy bid into a rusk bid.

func ContractCallsToTxs

func ContractCallsToTxs(calls []*rusk.Transaction) ([]transactions.Transaction, error)

ContractCallsToTxs turns a slice of rusk contract calls into a slice of standard txs.

func NewBlockToOldBlock

func NewBlockToOldBlock(b *newblock.Block) (*block.Block, error)

NewBlockToOldBlock will convert a dusk-blockchain block into a dusk-wallet block.

func OldBlockToNewBlock

func OldBlockToNewBlock(b *block.Block) (*newblock.Block, error)

OldBlockToNewBlock will convert a dusk-wallet block into a dusk-blockchain block.

func ProvisionersToRuskCommittee

func ProvisionersToRuskCommittee(p *user.Provisioners) []*rusk.Provisioner

ProvisionersToRuskCommittee converts a native Provisioners struct to a slice of rusk Provisioners.

func RuskBidToBid

func RuskBidToBid(tx *rusk.Transaction) (*transactions.Bid, error)

RuskBidToBid turns a rusk bid into a legacy bid.

func RuskDistributeToCoinbase

func RuskDistributeToCoinbase(tx *rusk.Transaction) (*transactions.Coinbase, error)

RuskDistributeToCoinbase turns a rusk distribute call to an equivalent legacy coinbase.

func RuskStakeToStake

func RuskStakeToStake(tx *rusk.Transaction) (*transactions.Stake, error)

RuskStakeToStake turns a rusk stake into a legacy stake.

func RuskTxToTx

func RuskTxToTx(tx *rusk.Transaction) (*transactions.Standard, error)

RuskTxToTx turns a rusk transaction into a legacy transaction.

func StakeToRuskStake

func StakeToRuskStake(tx *transactions.Stake) (*rusk.Transaction, error)

StakeToRuskStake turns a legacy stake into a rusk stake.

func TxToRuskTx

func TxToRuskTx(tx transactions.Transaction) (*rusk.Transaction, error)

TxToRuskTx turns a legacy transaction into a rusk transaction.

Types

This section is empty.

Jump to

Keyboard shortcuts

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