Documentation ¶
Index ¶
- Variables
- func BuildBlockCoderFromBytes(data []byte) (*coder.StatechainBlock, error)
- func BuildBytesCoderFromBytes(data []byte) (*coder.Diff, error)
- func BuildCoderFromBlock(b *Block) *coder.StatechainBlock
- func BuildCoderFromDiff(d *Diff) *coder.Diff
- func BuildCoderFromTransaction(tx *Transaction) (*coder.Transaction, error)
- func BuildTransactionCoderFromBytes(data []byte) (*coder.Transaction, error)
- type Block
- func (b Block) CalculateHash() (string, error)
- func (b Block) CalculateHashBytes() ([]byte, error)
- func (b *Block) Deserialize(data []byte) error
- func (b *Block) DeserializeString(hexStr string) error
- func (b Block) Equals(other merkletree.Content) (bool, error)
- func (b *Block) MarshalJSON() ([]byte, error)
- func (b Block) Props() BlockProps
- func (b *Block) Serialize() ([]byte, error)
- func (b Block) SerializeString() (string, error)
- func (b *Block) SetHash() error
- func (b *Block) UnmarshalJSON(data []byte) error
- type BlockProps
- type Diff
- func (d Diff) CalculateHash() (string, error)
- func (d Diff) CalculateHashBytes() ([]byte, error)
- func (d *Diff) Deserialize(data []byte) error
- func (d *Diff) DeserializeString(hexStr string) error
- func (d Diff) Equals(other merkletree.Content) (bool, error)
- func (d *Diff) MarshalJSON() ([]byte, error)
- func (d Diff) Props() DiffProps
- func (d *Diff) Serialize() ([]byte, error)
- func (d Diff) SerializeString() (string, error)
- func (d *Diff) SetHash() error
- func (d *Diff) UnmarshalJSON(data []byte) error
- type DiffProps
- type Transaction
- func (tx *Transaction) CalcSig(priv *ecdsa.PrivateKey) (*TxSig, error)
- func (tx *Transaction) CalculateHash() (string, error)
- func (tx *Transaction) CalculateHashBytes() ([]byte, error)
- func (tx *Transaction) Deserialize(data []byte) error
- func (tx *Transaction) DeserializeString(hexStr string) error
- func (tx *Transaction) Equals(other merkletree.Content) (bool, error)
- func (tx *Transaction) MarshalJSON() ([]byte, error)
- func (tx *Transaction) Props() TransactionProps
- func (tx *Transaction) Serialize() ([]byte, error)
- func (tx *Transaction) SerializeString() (string, error)
- func (tx *Transaction) SetHash() error
- func (tx *Transaction) SetSig(priv *ecdsa.PrivateKey) error
- func (tx *Transaction) UnmarshalJSON(data []byte) error
- type TransactionProps
- type TransactionsMap
- type TxSig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoHash ... ErrNoHash = errors.New("no hash present") // ErrNilTx ... ErrNilTx = errors.New("transaction is nil") // ErrNoSig ... ErrNoSig = errors.New("no signature present") // ErrInvalidFromAddress ... ErrInvalidFromAddress = errors.New("from address is not valid") // ErrNilBlock ... ErrNilBlock = errors.New("block is nil") // ErrNilDiff ... ErrNilDiff = errors.New("diff is nil") )
Functions ¶
func BuildBlockCoderFromBytes ¶
func BuildBlockCoderFromBytes(data []byte) (*coder.StatechainBlock, error)
BuildBlockCoderFromBytes ...
func BuildBytesCoderFromBytes ¶
BuildBytesCoderFromBytes ...
func BuildCoderFromBlock ¶
func BuildCoderFromBlock(b *Block) *coder.StatechainBlock
BuildCoderFromBlock ...
func BuildCoderFromTransaction ¶
func BuildCoderFromTransaction(tx *Transaction) (*coder.Transaction, error)
BuildCoderFromTransaction ...
func BuildTransactionCoderFromBytes ¶
func BuildTransactionCoderFromBytes(data []byte) (*coder.Transaction, error)
BuildTransactionCoderFromBytes ...
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block ...
func (Block) CalculateHashBytes ¶
CalculateHashBytes ...
func (*Block) DeserializeString ¶
DeserializeString ...
type BlockProps ¶
type BlockProps struct { BlockHash *string `json:"blockHash,omitempty" rlp:"nil"` BlockNumber string `json:"blockNumber"` BlockTime string `json:"blockTime"` // unix timestamp ImageHash string `json:"imageHash"` TxHash string `json:"txHash"` PrevBlockHash string `json:"prevBlockHash"` StatePrevDiffHash string `json:"statePrevDiffHash"` StateCurrentHash string `json:"stateCurrentHash"` }
BlockProps ...
func BuildBlockPropsFromBytes ¶
func BuildBlockPropsFromBytes(data []byte) (*BlockProps, error)
BuildBlockPropsFromBytes ...
func BuildBlockPropsFromCoder ¶
func BuildBlockPropsFromCoder(tmp *coder.StatechainBlock) (*BlockProps, error)
BuildBlockPropsFromCoder ...
type Diff ¶
type Diff struct {
// contains filtered or unexported fields
}
Diff ...
func (Diff) CalculateHashBytes ¶
CalculateHashBytes ...
func (*Diff) DeserializeString ¶
DeserializeString ...
type DiffProps ¶
type DiffProps struct { DiffHash *string `json:"diffHash,omitempty" rlp:"nil"` // what's the best way to store a diff? Data string `json:"data"` }
DiffProps ... note @miguelmota: any better system than simply storing as a string?
func BuildDiffPropsFromBytes ¶
BuildDiffPropsFromBytes ...
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction ...
func (*Transaction) CalcSig ¶
func (tx *Transaction) CalcSig(priv *ecdsa.PrivateKey) (*TxSig, error)
CalcSig ...
func (*Transaction) CalculateHash ¶
func (tx *Transaction) CalculateHash() (string, error)
CalculateHash ...
func (*Transaction) CalculateHashBytes ¶
func (tx *Transaction) CalculateHashBytes() ([]byte, error)
CalculateHashBytes ...
func (*Transaction) Deserialize ¶
func (tx *Transaction) Deserialize(data []byte) error
Deserialize ...
func (*Transaction) DeserializeString ¶
func (tx *Transaction) DeserializeString(hexStr string) error
DeserializeString ...
func (*Transaction) Equals ¶
func (tx *Transaction) Equals(other merkletree.Content) (bool, error)
Equals ...
func (*Transaction) MarshalJSON ¶
func (tx *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON ...
func (*Transaction) SerializeString ¶
func (tx *Transaction) SerializeString() (string, error)
SerializeString ...
func (*Transaction) UnmarshalJSON ¶
func (tx *Transaction) UnmarshalJSON(data []byte) error
UnmarshalJSON ...
type TransactionProps ¶
type TransactionProps struct { TxHash *string `json:"txHash,omitempty" rlp:"nil"` ImageHash string `json:"imageHash"` Method string `json:"method"` Payload []byte `json:"payload"` From string `json:"from"` Sig *TxSig `json:"txSig,omitempty" rlp:"nil"` }
TransactionProps ...
func BuildTransactionPropsFromBytes ¶
func BuildTransactionPropsFromBytes(data []byte) (*TransactionProps, error)
BuildTransactionPropsFromBytes ...
func BuildTransactionPropsFromCoder ¶
func BuildTransactionPropsFromCoder(tmp *coder.Transaction) (*TransactionProps, error)
BuildTransactionPropsFromCoder ...
type TransactionsMap ¶
type TransactionsMap map[string][]*Transaction
TransactionsMap is a list of transactions by image hashes