Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCorrespondingUTXOIndexForInput(tx *SignedTransaction, inputNumber int) ([UTXOIndexLength]byte, error)
- func CreateFdbUTXOIndexForInput(db fdb.Database, tx *SignedTransaction, inputNumber int) (subspace.Subspace, error)
- func CreateShortUTXOIndexForOutput(tx *SignedTransaction, blockNumber uint32, transactionNumber uint32, ...) ([]byte, error)
- func CreateUTXOIndexForOutput(tx *SignedTransaction, blockNumber uint32, transactionNumber uint32, ...) ([UTXOIndexLength]byte, error)
- type HumanReadableUTXOdetails
- type NumberedTransaction
- type ParsedTransactionResult
- type ShortUTXOdetails
- type SignedTransaction
- func (tx *SignedTransaction) DecodeRLP(s *rlp.Stream) error
- func (tx *SignedTransaction) EncodeRLP(w io.Writer) error
- func (tx *SignedTransaction) GetFrom() (common.Address, error)
- func (tx *SignedTransaction) GetRaw() ([]byte, error)
- func (tx *SignedTransaction) Sign(privateKey []byte) error
- func (tx *SignedTransaction) Validate() error
- type SpendingRecord
- type TransactionInput
- func (input *TransactionInput) DecodeRLP(s *rlp.Stream) error
- func (input *TransactionInput) EncodeRLP(w io.Writer) error
- func (input *TransactionInput) GetReferedUTXO() *types.BigInt
- func (input *TransactionInput) GetValue() *types.BigInt
- func (input *TransactionInput) SetFields(blockNumber *types.BigInt, transactionNumber *types.BigInt, ...) error
- type TransactionOutput
- func (output *TransactionOutput) DecodeRLP(s *rlp.Stream) error
- func (output *TransactionOutput) EncodeRLP(w io.Writer) error
- func (output *TransactionOutput) GetToAddress() common.Address
- func (output *TransactionOutput) GetValue() *types.BigInt
- func (output *TransactionOutput) SetFields(outputNumber *types.BigInt, address common.Address, value *types.BigInt) error
- type TransactionParser
- type UTXOindex
- type UnsignedTransaction
Constants ¶
const ( TransactionTypeLength = 1 BlockNumberLength = 4 TransactionNumberLength = 4 OutputNumberLength = 1 AddressLength = 20 ValueLength = 32 VLength = 1 RLength = 32 SLength = 32 TransactionTypeSplit = byte(0x01) TransactionTypeMerge = byte(0x02) TransactionTypeFund = byte(0x04) )
const ( UTXOIndexLength = AddressLength + BlockNumberLength + TransactionNumberLength + OutputNumberLength + ValueLength ShortUTXOIndexLength = BlockNumberLength + TransactionNumberLength + OutputNumberLength )
Variables ¶
var EmptyAddress = common.Address{}
var ( MaxUTXOIndex = big.NewInt(0).Lsh(big.NewInt(1), (BlockNumberLength+TransactionNumberLength+ OutputNumberLength)*8) )
Functions ¶
func CreateCorrespondingUTXOIndexForInput ¶
func CreateCorrespondingUTXOIndexForInput(tx *SignedTransaction, inputNumber int) ([UTXOIndexLength]byte, error)
func CreateUTXOIndexForOutput ¶
func CreateUTXOIndexForOutput(tx *SignedTransaction, blockNumber uint32, transactionNumber uint32, outputNumber int) ([UTXOIndexLength]byte, error)
Types ¶
type HumanReadableUTXOdetails ¶
type HumanReadableUTXOdetails struct { Owner string BlockNumber uint32 TransactionNumber uint32 OutputNumber uint8 Value string }
func ParseIndexIntoUTXOdetails ¶
func ParseIndexIntoUTXOdetails(index [UTXOIndexLength]byte) HumanReadableUTXOdetails
type NumberedTransaction ¶
type NumberedTransaction struct { TransactionNumber [TransactionNumberLength]byte SignedTransaction *SignedTransaction }
TransactionInput is one of the inputs into Plasma transaction
func NewNumberedTransaction ¶
func NewNumberedTransaction(signedTX *SignedTransaction, transactionNumber uint32) (*NumberedTransaction, error)
func (*NumberedTransaction) DecodeRLP ¶
func (tx *NumberedTransaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*NumberedTransaction) EncodeRLP ¶
func (tx *NumberedTransaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*NumberedTransaction) GetRaw ¶
func (tx *NumberedTransaction) GetRaw() ([]byte, error)
func (*NumberedTransaction) Validate ¶
func (tx *NumberedTransaction) Validate() error
signature is [R || S || V]
type ParsedTransactionResult ¶
type ShortUTXOdetails ¶
func ParseUTXOindexNumberIntoDetails ¶
func ParseUTXOindexNumberIntoDetails(indexBN *types.BigInt) (*ShortUTXOdetails, error)
type SignedTransaction ¶
type SignedTransaction struct { UnsignedTransaction *UnsignedTransaction V [VLength]byte R [RLength]byte S [SLength]byte RawValue []byte // contains filtered or unexported fields }
TransactionInput is one of the inputs into Plasma transaction
func CreateRawFundingTX ¶
func NewSignedTransaction ¶
func NewSignedTransaction(unsignedTX *UnsignedTransaction, v []byte, r []byte, s []byte) (*SignedTransaction, error)
func (*SignedTransaction) DecodeRLP ¶
func (tx *SignedTransaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*SignedTransaction) EncodeRLP ¶
func (tx *SignedTransaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*SignedTransaction) GetRaw ¶
func (tx *SignedTransaction) GetRaw() ([]byte, error)
func (*SignedTransaction) Sign ¶
func (tx *SignedTransaction) Sign(privateKey []byte) error
func (*SignedTransaction) Validate ¶
func (tx *SignedTransaction) Validate() error
signature is [R || S || V]
type SpendingRecord ¶
type SpendingRecord struct { SpendingTransaction *SignedTransaction OutputIndexes [][UTXOIndexLength]byte }
func NewSpendingRecord ¶
func NewSpendingRecord(tx *SignedTransaction, outputIndexes [][UTXOIndexLength]byte) *SpendingRecord
type TransactionInput ¶
type TransactionInput struct { BlockNumber [BlockNumberLength]byte TransactionNumber [TransactionNumberLength]byte OutputNumber [OutputNumberLength]byte Value [ValueLength]byte }
TransactionInput is one of the inputs into Plasma transaction
func (*TransactionInput) EncodeRLP ¶
func (input *TransactionInput) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*TransactionInput) GetReferedUTXO ¶
func (input *TransactionInput) GetReferedUTXO() *types.BigInt
func (*TransactionInput) GetValue ¶
func (input *TransactionInput) GetValue() *types.BigInt
type TransactionOutput ¶
type TransactionOutput struct { OutputNumber [OutputNumberLength]byte To [AddressLength]byte Value [ValueLength]byte }
TransactionInput is one of the inputs into Plasma transaction
func (*TransactionOutput) DecodeRLP ¶
func (output *TransactionOutput) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*TransactionOutput) EncodeRLP ¶
func (output *TransactionOutput) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*TransactionOutput) GetToAddress ¶
func (output *TransactionOutput) GetToAddress() common.Address
Get address as Ethereum Address type
func (*TransactionOutput) GetValue ¶
func (output *TransactionOutput) GetValue() *types.BigInt
type TransactionParser ¶
type TransactionParser struct { ConcurrencyLimit int // contains filtered or unexported fields }
func NewTransactionParser ¶
func NewTransactionParser(concurrency int) *TransactionParser
func (*TransactionParser) Parse ¶
func (p *TransactionParser) Parse(raw []byte) (*ParsedTransactionResult, error)
type UnsignedTransaction ¶
type UnsignedTransaction struct { TransactionType [TransactionTypeLength]byte Inputs []*TransactionInput Outputs []*TransactionOutput }
TransactionInput is one of the inputs into Plasma transaction
func NewUnsignedTransaction ¶
func NewUnsignedTransaction(txType byte, inputs []*TransactionInput, outputs []*TransactionOutput) (*UnsignedTransaction, error)
func (*UnsignedTransaction) DecodeRLP ¶
func (tx *UnsignedTransaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*UnsignedTransaction) EncodeRLP ¶
func (tx *UnsignedTransaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*UnsignedTransaction) Validate ¶
func (tx *UnsignedTransaction) Validate() error