Documentation ¶
Index ¶
- Constants
- func Bool(buf []byte) (bool, error)
- func BytesWithUInt16Len(buf []byte) ([]byte, error)
- func PutBool(buf []byte, b bool)
- func PutBytesWithUInt16Len(buf []byte, data []byte)
- func PutStringWithUInt16Len(buf []byte, s string)
- func StringWithUInt16Len(buf []byte) (string, error)
- type AccountsState
- type Address
- type Alias
- type AssetPair
- type Attachment
- type B58Bytes
- type BinaryDataEntry
- func (e BinaryDataEntry) GetKey() string
- func (e BinaryDataEntry) GetValueType() ValueType
- func (e BinaryDataEntry) MarshalBinary() ([]byte, error)
- func (e BinaryDataEntry) MarshalJSON() ([]byte, error)
- func (e *BinaryDataEntry) UnmarshalBinary(data []byte) error
- func (e *BinaryDataEntry) UnmarshalJSON(value []byte) error
- type Block
- type BlockHeader
- type BlockMessage
- type BooleanDataEntry
- func (e BooleanDataEntry) GetKey() string
- func (e BooleanDataEntry) GetValueType() ValueType
- func (e BooleanDataEntry) MarshalBinary() ([]byte, error)
- func (e BooleanDataEntry) MarshalJSON() ([]byte, error)
- func (e *BooleanDataEntry) UnmarshalBinary(data []byte) error
- func (e *BooleanDataEntry) UnmarshalJSON(value []byte) error
- type BurnV1
- type BurnV2
- type CheckPointMessage
- type CheckpointItem
- type CreateAliasV1
- func (tx CreateAliasV1) GetID() []byte
- func (tx *CreateAliasV1) MarshalBinary() ([]byte, error)
- func (tx *CreateAliasV1) Sign(secretKey crypto.SecretKey) error
- func (CreateAliasV1) Transaction()
- func (tx *CreateAliasV1) UnmarshalBinary(data []byte) error
- func (tx *CreateAliasV1) UnmarshalJSON(data []byte) error
- func (tx *CreateAliasV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type CreateAliasV2
- func (tx CreateAliasV2) GetID() []byte
- func (tx *CreateAliasV2) MarshalBinary() ([]byte, error)
- func (tx *CreateAliasV2) Sign(secretKey crypto.SecretKey) error
- func (CreateAliasV2) Transaction()
- func (tx *CreateAliasV2) UnmarshalBinary(data []byte) error
- func (tx *CreateAliasV2) UnmarshalJSON(data []byte) error
- func (tx *CreateAliasV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type DataEntries
- type DataEntry
- type DataEntryType
- type DataV1
- func (tx *DataV1) AppendEntry(entry DataEntry) error
- func (tx *DataV1) BodyMarshalBinary() ([]byte, error)
- func (tx DataV1) GetID() []byte
- func (tx *DataV1) MarshalBinary() ([]byte, error)
- func (tx *DataV1) Sign(secretKey crypto.SecretKey) error
- func (DataV1) Transaction()
- func (tx *DataV1) UnmarshalBinary(data []byte) error
- func (tx *DataV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type ExchangeV1
- func (tx ExchangeV1) GetID() []byte
- func (tx *ExchangeV1) MarshalBinary() ([]byte, error)
- func (tx *ExchangeV1) Sign(secretKey crypto.SecretKey) error
- func (ExchangeV1) Transaction()
- func (tx *ExchangeV1) UnmarshalBinary(data []byte) error
- func (tx *ExchangeV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type ExchangeV2
- func (tx ExchangeV2) GetID() []byte
- func (tx *ExchangeV2) MarshalBinary() ([]byte, error)
- func (tx *ExchangeV2) Sign(secretKey crypto.SecretKey) error
- func (ExchangeV2) Transaction()
- func (tx *ExchangeV2) UnmarshalBinary(data []byte) error
- func (tx *ExchangeV2) UnmarshalJSON(data []byte) error
- func (tx *ExchangeV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type Genesis
- type GetBlockMessage
- type GetPeersMessage
- type GetSignaturesMessage
- type Handshake
- type IntegerDataEntry
- func (e IntegerDataEntry) GetKey() string
- func (e IntegerDataEntry) GetValueType() ValueType
- func (e IntegerDataEntry) MarshalBinary() ([]byte, error)
- func (e IntegerDataEntry) MarshalJSON() ([]byte, error)
- func (e *IntegerDataEntry) UnmarshalBinary(data []byte) error
- func (e *IntegerDataEntry) UnmarshalJSON(value []byte) error
- type IssueV1
- type IssueV2
- func (tx IssueV2) GetID() []byte
- func (tx *IssueV2) MarshalBinary() ([]byte, error)
- func (tx *IssueV2) NonEmptyScript() bool
- func (tx *IssueV2) Sign(secretKey crypto.SecretKey) error
- func (IssueV2) Transaction()
- func (tx *IssueV2) UnmarshalBinary(data []byte) error
- func (tx *IssueV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type LeaseCancelV1
- func (tx LeaseCancelV1) GetID() []byte
- func (tx *LeaseCancelV1) MarshalBinary() ([]byte, error)
- func (tx *LeaseCancelV1) Sign(secretKey crypto.SecretKey) error
- func (LeaseCancelV1) Transaction()
- func (tx *LeaseCancelV1) UnmarshalBinary(data []byte) error
- func (tx *LeaseCancelV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type LeaseCancelV2
- func (tx LeaseCancelV2) GetID() []byte
- func (tx *LeaseCancelV2) MarshalBinary() ([]byte, error)
- func (tx *LeaseCancelV2) Sign(secretKey crypto.SecretKey) error
- func (LeaseCancelV2) Transaction()
- func (tx *LeaseCancelV2) UnmarshalBinary(data []byte) error
- func (tx *LeaseCancelV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type LeaseV1
- type LeaseV2
- type MassTransferEntry
- type MassTransferV1
- func (tx MassTransferV1) GetID() []byte
- func (tx *MassTransferV1) MarshalBinary() ([]byte, error)
- func (tx *MassTransferV1) Sign(secretKey crypto.SecretKey) error
- func (MassTransferV1) Transaction()
- func (tx *MassTransferV1) UnmarshalBinary(data []byte) error
- func (tx *MassTransferV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type OptionalAsset
- func (a *OptionalAsset) MarshalBinary() ([]byte, error)
- func (a OptionalAsset) MarshalJSON() ([]byte, error)
- func (a OptionalAsset) String() string
- func (a *OptionalAsset) ToID() []byte
- func (a *OptionalAsset) UnmarshalBinary(data []byte) error
- func (a *OptionalAsset) UnmarshalJSON(value []byte) error
- type Order
- type OrderType
- type OrderV1
- func (o OrderV1) GetMatcherPK() crypto.PublicKey
- func (o OrderV1) GetOrderType() OrderType
- func (o OrderV1) GetVersion() byte
- func (o *OrderV1) MarshalBinary() ([]byte, error)
- func (o *OrderV1) Sign(secretKey crypto.SecretKey) error
- func (o *OrderV1) UnmarshalBinary(data []byte) error
- func (o *OrderV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type OrderV2
- func (o OrderV2) GetMatcherPK() crypto.PublicKey
- func (o OrderV2) GetOrderType() OrderType
- func (o OrderV2) GetVersion() byte
- func (o *OrderV2) MarshalBinary() ([]byte, error)
- func (o *OrderV2) Sign(secretKey crypto.SecretKey) error
- func (o *OrderV2) UnmarshalBinary(data []byte) error
- func (o *OrderV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type OrderVersion
- type Payment
- type PeerInfo
- type PeersMessage
- type ProofsV1
- func (p *ProofsV1) MarshalBinary() ([]byte, error)
- func (p ProofsV1) MarshalJSON() ([]byte, error)
- func (p *ProofsV1) Sign(pos int, key crypto.SecretKey, data []byte) error
- func (p ProofsV1) String() string
- func (p *ProofsV1) UnmarshalBinary(data []byte) error
- func (p *ProofsV1) UnmarshalJSON(value []byte) error
- func (p *ProofsV1) Verify(pos int, key crypto.PublicKey, data []byte) (bool, error)
- type Recipient
- type ReissueV1
- func (tx ReissueV1) GetID() []byte
- func (tx *ReissueV1) MarshalBinary() ([]byte, error)
- func (tx *ReissueV1) Sign(secretKey crypto.SecretKey) error
- func (ReissueV1) Transaction()
- func (tx *ReissueV1) UnmarshalBinary(data []byte) error
- func (tx *ReissueV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type ReissueV2
- func (tx ReissueV2) GetID() []byte
- func (tx *ReissueV2) MarshalBinary() ([]byte, error)
- func (tx *ReissueV2) Sign(secretKey crypto.SecretKey) error
- func (ReissueV2) Transaction()
- func (tx *ReissueV2) UnmarshalBinary(data []byte) error
- func (tx *ReissueV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type ScoreMessage
- type Script
- type SetAssetScriptV1
- func (tx SetAssetScriptV1) GetID() []byte
- func (tx *SetAssetScriptV1) MarshalBinary() ([]byte, error)
- func (tx *SetAssetScriptV1) NonEmptyScript() bool
- func (tx *SetAssetScriptV1) Sign(secretKey crypto.SecretKey) error
- func (SetAssetScriptV1) Transaction()
- func (tx *SetAssetScriptV1) UnmarshalBinary(data []byte) error
- func (tx *SetAssetScriptV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type SetScriptV1
- func (tx SetScriptV1) GetID() []byte
- func (tx *SetScriptV1) MarshalBinary() ([]byte, error)
- func (tx *SetScriptV1) NonEmptyScript() bool
- func (tx *SetScriptV1) Sign(secretKey crypto.SecretKey) error
- func (SetScriptV1) Transaction()
- func (tx *SetScriptV1) UnmarshalBinary(data []byte) error
- func (tx *SetScriptV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type SignaturesMessage
- type SponsorshipV1
- func (tx SponsorshipV1) GetID() []byte
- func (tx *SponsorshipV1) MarshalBinary() ([]byte, error)
- func (tx *SponsorshipV1) Sign(secretKey crypto.SecretKey) error
- func (SponsorshipV1) Transaction()
- func (tx *SponsorshipV1) UnmarshalBinary(data []byte) error
- func (tx *SponsorshipV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type StringDataEntry
- func (e StringDataEntry) GetKey() string
- func (e StringDataEntry) GetValueType() ValueType
- func (e StringDataEntry) MarshalBinary() ([]byte, error)
- func (e StringDataEntry) MarshalJSON() ([]byte, error)
- func (e *StringDataEntry) UnmarshalBinary(data []byte) error
- func (e *StringDataEntry) UnmarshalJSON(value []byte) error
- type Transaction
- type TransactionMessage
- type TransactionType
- type TransactionValidator
- type TransferV1
- func (tx TransferV1) GetID() []byte
- func (tx *TransferV1) MarshalBinary() ([]byte, error)
- func (tx *TransferV1) Sign(secretKey crypto.SecretKey) error
- func (TransferV1) Transaction()
- func (tx *TransferV1) UnmarshalBinary(data []byte) error
- func (tx *TransferV1) Verify(publicKey crypto.PublicKey) (bool, error)
- type TransferV2
- func (tx *TransferV2) BodyMarshalBinary() ([]byte, error)
- func (tx *TransferV2) BodyUnmarshalBinary(data []byte) error
- func (tx TransferV2) GetID() []byte
- func (tx *TransferV2) MarshalBinary() ([]byte, error)
- func (tx *TransferV2) Sign(secretKey crypto.SecretKey) error
- func (TransferV2) Transaction()
- func (tx *TransferV2) UnmarshalBinary(data []byte) error
- func (tx *TransferV2) Verify(publicKey crypto.PublicKey) (bool, error)
- type ValueType
- type Version
Constants ¶
const ( AddressSize = headerSize + bodySize + checksumSize MainNetScheme byte = 'W' TestNetScheme byte = 'T' DevNetScheme byte = 'D' )
const ( ContentIDGetPeers = 0x1 ContentIDPeers = 0x2 ContentIDGetSignatures = 0x14 ContentIDSignatures = 0x15 ContentIDGetBlock = 0x16 ContentIDBlock = 0x17 ContentIDScore = 0x18 ContentIDTransaction = 0x19 ContentIDCheckpoint = 0x64 )
Constants for message IDs
const (
//WavesAssetName is the default name for basic WAVES asset.
WavesAssetName = "WAVES"
)
Variables ¶
This section is empty.
Functions ¶
func BytesWithUInt16Len ¶
BytesWithUInt16Len reads from buf an array of bytes of length encoded in first 2 bytes.
func PutBytesWithUInt16Len ¶
PutBytesWithUInt16Len prepends given buf with 2 bytes of it's length.
func PutStringWithUInt16Len ¶
func StringWithUInt16Len ¶
Types ¶
type AccountsState ¶ added in v0.2.0
type Address ¶
type Address [AddressSize]byte
func NewAddressFromBytes ¶
func NewAddressFromPublicKey ¶
func NewAddressFromString ¶
func (Address) MarshalJSON ¶
func (*Address) UnmarshalJSON ¶
type Alias ¶
func NewAliasFromBytes ¶
func NewAliasFromString ¶
func (*Alias) MarshalBinary ¶
func (Alias) MarshalJSON ¶
func (*Alias) UnmarshalBinary ¶
func (*Alias) UnmarshalJSON ¶
type AssetPair ¶
type AssetPair struct { AmountAsset OptionalAsset `json:"amountAsset"` PriceAsset OptionalAsset `json:"priceAsset"` }
AssetPair is a pair of assets in ExchangeTransaction.
type Attachment ¶
type Attachment string
Attachment represents the additional data stored in Transfer and MassTransfer transactions.
func NewAttachmentFromBase58 ¶ added in v0.1.2
func NewAttachmentFromBase58(s string) (Attachment, error)
NewAttachmentFromBase58 creates an Attachment structure from its base58 string representation.
func (Attachment) MarshalJSON ¶
func (a Attachment) MarshalJSON() ([]byte, error)
MarshalJSON writes Attachment as a JSON string Value
func (Attachment) String ¶
func (a Attachment) String() string
String returns Attachment's string representation
func (*Attachment) UnmarshalJSON ¶
func (a *Attachment) UnmarshalJSON(value []byte) error
UnmarshalJSON reads Attachment from a JSON string Value
type B58Bytes ¶
type B58Bytes []byte
B58Bytes represents bytes as Base58 string in JSON
func (B58Bytes) MarshalJSON ¶
MarshalJSON writes B58Bytes Value as JSON string
func (*B58Bytes) UnmarshalJSON ¶
UnmarshalJSON reads B58Bytes from JSON string
type BinaryDataEntry ¶
BinaryDataEntry represents a key-value data entry that stores binary value.
func (BinaryDataEntry) GetKey ¶
func (e BinaryDataEntry) GetKey() string
GetKey returns the key of data entry.
func (BinaryDataEntry) GetValueType ¶
func (e BinaryDataEntry) GetValueType() ValueType
GetValueType returns the type of value (Binary) stored in an entry.
func (BinaryDataEntry) MarshalBinary ¶
func (e BinaryDataEntry) MarshalBinary() ([]byte, error)
MarshalBinary writes an entry to its byte representation.
func (BinaryDataEntry) MarshalJSON ¶
func (e BinaryDataEntry) MarshalJSON() ([]byte, error)
MarshalJSON converts an entry to its JSON representation. Note that BASE64 is used to represent the binary value.
func (*BinaryDataEntry) UnmarshalBinary ¶
func (e *BinaryDataEntry) UnmarshalBinary(data []byte) error
UnmarshalBinary reads an entry from a binary representation.
func (*BinaryDataEntry) UnmarshalJSON ¶
func (e *BinaryDataEntry) UnmarshalJSON(value []byte) error
UnmarshalJSON converts JSON to a BinaryDataEntry structure. Value should be stored as BASE64 sting in JSON.
type Block ¶ added in v0.2.0
type Block struct { BlockHeader Transactions []byte `json:"-"` }
Block is a block of the blockchain
func (*Block) MarshalBinary ¶ added in v0.2.0
MarshalBinary encodes Block to binary form
func (*Block) UnmarshalBinary ¶ added in v0.2.0
UnmarshalBinary decodes Block from binary form
type BlockHeader ¶ added in v0.2.0
type BlockHeader struct { Version uint8 Timestamp uint64 Parent crypto.Signature ConsensusBlockLength uint32 BaseTarget uint64 GenSignature crypto.Digest TransactionBlockLength uint32 TransactionCount int GenPublicKey crypto.PublicKey BlockSignature crypto.Signature Height uint64 }
Block info (except transactions)
func (*BlockHeader) MarshalHeaderToBinary ¶ added in v0.2.0
func (b *BlockHeader) MarshalHeaderToBinary() ([]byte, error)
func (*BlockHeader) UnmarshalHeaderFromBinary ¶ added in v0.2.0
func (b *BlockHeader) UnmarshalHeaderFromBinary(data []byte) error
type BlockMessage ¶
type BlockMessage struct {
BlockBytes []byte
}
BlockMessage represents Block message
func (*BlockMessage) MarshalBinary ¶
func (m *BlockMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes BlockMessage to binary form
func (*BlockMessage) ReadFrom ¶
func (m *BlockMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads BlockMessage from io.Reader
func (*BlockMessage) UnmarshalBinary ¶
func (m *BlockMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes BlockMessage from binary from
type BooleanDataEntry ¶
BooleanDataEntry represents a key-value pair that stores a bool value.
func (BooleanDataEntry) GetKey ¶
func (e BooleanDataEntry) GetKey() string
GetKey returns the key of data entry.
func (BooleanDataEntry) GetValueType ¶
func (e BooleanDataEntry) GetValueType() ValueType
GetValueType returns the data type (Boolean) of the entry.
func (BooleanDataEntry) MarshalBinary ¶
func (e BooleanDataEntry) MarshalBinary() ([]byte, error)
MarshalBinary writes a byte representation of the boolean data entry.
func (BooleanDataEntry) MarshalJSON ¶
func (e BooleanDataEntry) MarshalJSON() ([]byte, error)
MarshalJSON writes the data entry to a JSON representation.
func (*BooleanDataEntry) UnmarshalBinary ¶
func (e *BooleanDataEntry) UnmarshalBinary(data []byte) error
UnmarshalBinary reads a byte representation of the data entry.
func (*BooleanDataEntry) UnmarshalJSON ¶
func (e *BooleanDataEntry) UnmarshalJSON(value []byte) error
UnmarshalJSON reads the entry from its JSON representation.
type BurnV1 ¶
type BurnV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
BurnV1 transaction allows to decrease the total supply of the existing asset. Asset must be reissuable.
func NewUnsignedBurnV1 ¶
func NewUnsignedBurnV1(senderPK crypto.PublicKey, assetID crypto.Digest, amount, timestamp, fee uint64) (*BurnV1, error)
NewUnsignedBurnV1 creates new BurnV1 transaction with no signature and ID.
func (*BurnV1) MarshalBinary ¶
MarshalBinary saves transaction to
func (BurnV1) Transaction ¶ added in v0.1.2
func (BurnV1) Transaction()
func (*BurnV1) UnmarshalBinary ¶
UnmarshalBinary reads transaction form its binary representation.
type BurnV2 ¶ added in v0.1.2
type BurnV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ChainID byte `json:"-"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
BurnV2 same as BurnV1 but version 2 with Proofs.
func NewUnsignedBurnV2 ¶ added in v0.1.2
func NewUnsignedBurnV2(chainID byte, senderPK crypto.PublicKey, assetID crypto.Digest, amount, timestamp, fee uint64) (*BurnV2, error)
NewUnsignedBurnV2 creates new BurnV2 transaction without proofs and ID.
func (*BurnV2) MarshalBinary ¶ added in v0.1.2
MarshalBinary writes BurnV2 transaction to its bytes representation.
func (BurnV2) Transaction ¶ added in v0.1.2
func (BurnV2) Transaction()
func (*BurnV2) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads BurnV2 from its bytes representation.
type CheckPointMessage ¶
type CheckPointMessage struct {
Checkpoints []CheckpointItem
}
CheckPointMessage represents a CheckPoint message
func (*CheckPointMessage) MarshalBinary ¶
func (m *CheckPointMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes CheckPointMessage to binary form
func (*CheckPointMessage) ReadFrom ¶
func (m *CheckPointMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads CheckPointMessage from io.Reader
func (*CheckPointMessage) UnmarshalBinary ¶
func (m *CheckPointMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes CheckPointMessage from binary form
type CheckpointItem ¶
CheckpointItem represents a Checkpoint
type CreateAliasV1 ¶
type CreateAliasV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
func (CreateAliasV1) GetID ¶ added in v0.2.0
func (tx CreateAliasV1) GetID() []byte
func (*CreateAliasV1) MarshalBinary ¶
func (tx *CreateAliasV1) MarshalBinary() ([]byte, error)
func (CreateAliasV1) Transaction ¶ added in v0.1.2
func (CreateAliasV1) Transaction()
func (*CreateAliasV1) UnmarshalBinary ¶
func (tx *CreateAliasV1) UnmarshalBinary(data []byte) error
func (*CreateAliasV1) UnmarshalJSON ¶ added in v0.2.0
func (tx *CreateAliasV1) UnmarshalJSON(data []byte) error
type CreateAliasV2 ¶ added in v0.1.2
type CreateAliasV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
func NewUnsignedCreateAliasV2 ¶ added in v0.1.2
func (CreateAliasV2) GetID ¶ added in v0.2.0
func (tx CreateAliasV2) GetID() []byte
func (*CreateAliasV2) MarshalBinary ¶ added in v0.1.2
func (tx *CreateAliasV2) MarshalBinary() ([]byte, error)
MarshalBinary saves the transaction to its binary representation.
func (*CreateAliasV2) Sign ¶ added in v0.1.2
func (tx *CreateAliasV2) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (CreateAliasV2) Transaction ¶ added in v0.1.2
func (CreateAliasV2) Transaction()
func (*CreateAliasV2) UnmarshalBinary ¶ added in v0.1.2
func (tx *CreateAliasV2) UnmarshalBinary(data []byte) error
UnmarshalBinary reads the transaction from bytes slice.
func (*CreateAliasV2) UnmarshalJSON ¶ added in v0.2.0
func (tx *CreateAliasV2) UnmarshalJSON(data []byte) error
type DataEntries ¶ added in v0.2.0
type DataEntries []DataEntry
DataEntries the slice of various entries of DataTransaction
func (*DataEntries) UnmarshalJSON ¶ added in v0.2.0
func (e *DataEntries) UnmarshalJSON(data []byte) error
UnmarshalJSOL special method to unmarshal DataEntries from JSON with detection of real type of each entry.
type DataEntry ¶
type DataEntry interface { GetKey() string GetValueType() ValueType MarshalBinary() ([]byte, error) // contains filtered or unexported methods }
DataEntry is a common interface of all types of data entries. The interface is used to store different types of data entries in one slice.
type DataEntryType ¶ added in v0.2.0
type DataEntryType struct {
Type string `json:"type"`
}
DataEntryType is the assistive structure used to get the type of DataEntry while unmarshal form JSON.
type DataV1 ¶
type DataV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Entries DataEntries `json:"data"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
DataV1 is first version of the transaction that puts data to the key-value storage of an account.
func NewUnsignedData ¶
NewUnsignedData creates new Data transaction without proofs.
func (*DataV1) AppendEntry ¶
AppendEntry adds the entry to the transaction.
func (*DataV1) BodyMarshalBinary ¶ added in v0.2.0
func (*DataV1) MarshalBinary ¶
MarshalBinary saves the transaction to bytes.
func (DataV1) Transaction ¶ added in v0.1.2
func (DataV1) Transaction()
func (*DataV1) UnmarshalBinary ¶
UnmarshalBinary reads the transaction from the bytes.
type ExchangeV1 ¶
type ExchangeV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` BuyOrder OrderV1 `json:"order1"` SellOrder OrderV1 `json:"order2"` Price uint64 `json:"price"` Amount uint64 `json:"amount"` BuyMatcherFee uint64 `json:"buyMatcherFee"` SellMatcherFee uint64 `json:"sellMatcherFee"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
ExchangeV1 is a transaction to store settlement on blockchain.
func NewUnsignedExchangeV1 ¶
func NewUnsignedExchangeV1(buy, sell OrderV1, price, amount, buyMatcherFee, sellMatcherFee, fee, timestamp uint64) (*ExchangeV1, error)
func (ExchangeV1) GetID ¶ added in v0.2.0
func (tx ExchangeV1) GetID() []byte
func (*ExchangeV1) MarshalBinary ¶
func (tx *ExchangeV1) MarshalBinary() ([]byte, error)
MarshalBinary saves the transaction to its binary representation.
func (*ExchangeV1) Sign ¶
func (tx *ExchangeV1) Sign(secretKey crypto.SecretKey) error
Sing calculates ID and Signature of the transaction.
func (ExchangeV1) Transaction ¶ added in v0.1.2
func (ExchangeV1) Transaction()
func (*ExchangeV1) UnmarshalBinary ¶
func (tx *ExchangeV1) UnmarshalBinary(data []byte) error
UnmarshalBinary loads the transaction from its binary representation.
type ExchangeV2 ¶ added in v0.1.2
type ExchangeV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` BuyOrder Order `json:"order1"` SellOrder Order `json:"order2"` Price uint64 `json:"price"` Amount uint64 `json:"amount"` BuyMatcherFee uint64 `json:"buyMatcherFee"` SellMatcherFee uint64 `json:"sellMatcherFee"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
ExchangeV2 is a transaction to store settlement on blockchain.
func NewUnsignedExchangeV2 ¶ added in v0.1.2
func NewUnsignedExchangeV2(buy, sell Order, price, amount, buyMatcherFee, sellMatcherFee, fee, timestamp uint64) (*ExchangeV2, error)
func (ExchangeV2) GetID ¶ added in v0.2.0
func (tx ExchangeV2) GetID() []byte
func (*ExchangeV2) MarshalBinary ¶ added in v0.1.2
func (tx *ExchangeV2) MarshalBinary() ([]byte, error)
MarshalBinary saves the transaction to its binary representation.
func (*ExchangeV2) Sign ¶ added in v0.1.2
func (tx *ExchangeV2) Sign(secretKey crypto.SecretKey) error
Sign calculates transaction signature using given secret key.
func (ExchangeV2) Transaction ¶ added in v0.1.2
func (ExchangeV2) Transaction()
func (*ExchangeV2) UnmarshalBinary ¶ added in v0.1.2
func (tx *ExchangeV2) UnmarshalBinary(data []byte) error
UnmarshalBinary loads the transaction from its binary representation.
func (*ExchangeV2) UnmarshalJSON ¶ added in v0.2.0
func (tx *ExchangeV2) UnmarshalJSON(data []byte) error
type Genesis ¶
type Genesis struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Signature `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` Timestamp uint64 `json:"timestamp"` Recipient Address `json:"recipient"` Amount uint64 `json:"amount"` }
Genesis is a transaction used to initial balances distribution. This transactions allowed only in the first block.
func NewUnsignedGenesis ¶
NewUnsignedGenesis returns a new unsigned Genesis transaction. Actually Genesis transaction could not be signed. That is why it doesn't implement Sing method. Instead it has GenerateSigID method, which calculates ID and uses it also as a signature.
func (*Genesis) GenerateSigID ¶
GenerateSigID calculates hash of the transaction and use it as an ID. Also doubled hash is used as a signature.
func (*Genesis) MarshalBinary ¶
MarshalBinary writes transaction bytes to slice of bytes.
func (Genesis) Transaction ¶ added in v0.1.2
func (Genesis) Transaction()
func (*Genesis) UnmarshalBinary ¶
UnmarshalBinary reads transaction values from the slice of bytes.
type GetBlockMessage ¶
GetBlockMessage represents GetBlock message
func (*GetBlockMessage) MarshalBinary ¶
func (m *GetBlockMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes GetBlockMessage to binary form
func (*GetBlockMessage) ReadFrom ¶
func (m *GetBlockMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads GetBlockMessage from io.Reader
func (*GetBlockMessage) UnmarshalBinary ¶
func (m *GetBlockMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes GetBlockMessage from binary form
type GetPeersMessage ¶
type GetPeersMessage struct{}
GetPeersMessage implements the GetPeers message from the waves protocol
func (*GetPeersMessage) MarshalBinary ¶
func (m *GetPeersMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes GetPeersMessage to binary form
func (*GetPeersMessage) ReadFrom ¶
func (m *GetPeersMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads GetPeersMessage from io.Reader
func (*GetPeersMessage) UnmarshalBinary ¶
func (m *GetPeersMessage) UnmarshalBinary(b []byte) error
UnmarshalBinary decodes GetPeersMessage from binary form
type GetSignaturesMessage ¶
GetSignaturesMessage represents the Get Signatures request
func (*GetSignaturesMessage) MarshalBinary ¶
func (m *GetSignaturesMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes GetSignaturesMessage to binary form
func (*GetSignaturesMessage) ReadFrom ¶
func (m *GetSignaturesMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads GetSignaturesMessage from io.Reader
func (*GetSignaturesMessage) UnmarshalBinary ¶
func (m *GetSignaturesMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes GetSignaturesMessage from binary form
type Handshake ¶
type Handshake struct { Name string Version Version NodeName string NodeNonce uint64 DeclaredAddrBytes []byte Timestamp uint64 }
Handshake is the handshake structure of the waves protocol
func (*Handshake) MarshalBinary ¶
MarshalBinary encodes Handshake to binary form
func (*Handshake) UnmarshalBinary ¶
UnmarshalBinary decodes Handshake from binary from
type IntegerDataEntry ¶
IntegerDataEntry stores int64 value.
func (IntegerDataEntry) GetKey ¶
func (e IntegerDataEntry) GetKey() string
GetKey returns the key of data entry.
func (IntegerDataEntry) GetValueType ¶
func (e IntegerDataEntry) GetValueType() ValueType
GetValueType returns the value type of the entry.
func (IntegerDataEntry) MarshalBinary ¶
func (e IntegerDataEntry) MarshalBinary() ([]byte, error)
MarshalBinary marshals the integer data entry in its bytes representation.
func (IntegerDataEntry) MarshalJSON ¶
func (e IntegerDataEntry) MarshalJSON() ([]byte, error)
MarshalJSON writes a JSON representation of integer data entry.
func (*IntegerDataEntry) UnmarshalBinary ¶
func (e *IntegerDataEntry) UnmarshalBinary(data []byte) error
UnmarshalBinary reads binary representation of integer data entry to the structure.
func (*IntegerDataEntry) UnmarshalJSON ¶
func (e *IntegerDataEntry) UnmarshalJSON(value []byte) error
UnmarshalJSON reads an integer data entry from its JSON representation.
type IssueV1 ¶
type IssueV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Name string `json:"name"` Description string `json:"description"` Quantity uint64 `json:"quantity"` Decimals byte `json:"decimals"` Reissuable bool `json:"reissuable"` Timestamp uint64 `json:"timestamp,omitempty"` Fee uint64 `json:"fee"` }
IssueV1 transaction is a transaction to issue new asset.
func NewUnsignedIssueV1 ¶
func NewUnsignedIssueV1(senderPK crypto.PublicKey, name, description string, quantity uint64, decimals byte, reissuable bool, timestamp, fee uint64) (*IssueV1, error)
NewUnsignedIssueV1 creates new IssueV1 transaction without signature and ID.
func (*IssueV1) MarshalBinary ¶
MarshalBinary saves transaction's binary representation to slice of bytes.
func (IssueV1) Transaction ¶ added in v0.1.2
func (IssueV1) Transaction()
func (*IssueV1) UnmarshalBinary ¶
UnmarshalBinary reads transaction from its binary representation.
type IssueV2 ¶ added in v0.1.2
type IssueV2 struct { Type TransactionType `json:"type"` Version byte `json:"version"` ChainID byte `json:"-"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Name string `json:"name"` Description string `json:"description"` Quantity uint64 `json:"quantity"` Decimals byte `json:"decimals"` Reissuable bool `json:"reissuable"` Script Script `json:"script"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
IssueV2 is a transaction to issue new asset, second version.
func NewUnsignedIssueV2 ¶ added in v0.1.2
func NewUnsignedIssueV2(chainID byte, senderPK crypto.PublicKey, name, description string, quantity uint64, decimals byte, reissuable bool, script []byte, timestamp, fee uint64) (*IssueV2, error)
NewUnsignedIssueV2 creates a new IssueV2 transaction with empty Proofs.
func (*IssueV2) MarshalBinary ¶ added in v0.1.2
MarshalBinary converts transaction to its binary representation.
func (*IssueV2) NonEmptyScript ¶ added in v0.1.2
NonEmptyScript returns true if the script of the transaction is not empty, otherwise false.
func (*IssueV2) Sign ¶ added in v0.1.2
Sign calculates transaction signature using given secret key.
func (IssueV2) Transaction ¶ added in v0.1.2
func (IssueV2) Transaction()
func (*IssueV2) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads transaction from its binary representation.
type LeaseCancelV1 ¶
type LeaseCancelV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
LeaseCancelV1 transaction can be used to cancel previously created leasing.
func NewUnsignedLeaseCancelV1 ¶
func NewUnsignedLeaseCancelV1(senderPK crypto.PublicKey, leaseID crypto.Digest, fee, timestamp uint64) (*LeaseCancelV1, error)
NewUnsignedLeaseCancelV1 creates new LeaseCancelV1 transaction structure without a signature and an ID.
func (LeaseCancelV1) GetID ¶ added in v0.2.0
func (tx LeaseCancelV1) GetID() []byte
func (*LeaseCancelV1) MarshalBinary ¶
func (tx *LeaseCancelV1) MarshalBinary() ([]byte, error)
MarshalBinary saves transaction to its binary representation.
func (LeaseCancelV1) Transaction ¶ added in v0.1.2
func (LeaseCancelV1) Transaction()
func (*LeaseCancelV1) UnmarshalBinary ¶
func (tx *LeaseCancelV1) UnmarshalBinary(data []byte) error
type LeaseCancelV2 ¶ added in v0.1.2
type LeaseCancelV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ChainID byte `json:"-"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
LeaseCancelV2 same as LeaseCancelV1 but with proofs.
func NewUnsignedLeaseCancelV2 ¶ added in v0.1.2
func NewUnsignedLeaseCancelV2(chainID byte, senderPK crypto.PublicKey, leaseID crypto.Digest, fee, timestamp uint64) (*LeaseCancelV2, error)
NewUnsignedLeaseCancelV2 creates new LeaseCancelV2 transaction structure without a signature and an ID.
func (LeaseCancelV2) GetID ¶ added in v0.2.0
func (tx LeaseCancelV2) GetID() []byte
func (*LeaseCancelV2) MarshalBinary ¶ added in v0.1.2
func (tx *LeaseCancelV2) MarshalBinary() ([]byte, error)
MarshalBinary saves the transaction to its binary representation.
func (*LeaseCancelV2) Sign ¶ added in v0.1.2
func (tx *LeaseCancelV2) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (LeaseCancelV2) Transaction ¶ added in v0.1.2
func (LeaseCancelV2) Transaction()
func (*LeaseCancelV2) UnmarshalBinary ¶ added in v0.1.2
func (tx *LeaseCancelV2) UnmarshalBinary(data []byte) error
UnmarshalBinary reads the transaction from bytes slice.
type LeaseV1 ¶
type LeaseV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
LeaseV1 is a transaction that allows to lease Waves to other account.
func NewUnsignedLeaseV1 ¶
func NewUnsignedLeaseV1(senderPK crypto.PublicKey, recipient Address, amount, fee, timestamp uint64) (*LeaseV1, error)
NewUnsignedLeaseV1 creates new LeaseV1 transaction without signature and ID set.
func (*LeaseV1) MarshalBinary ¶
MarshalBinary saves the transaction to its binary representation.
func (LeaseV1) Transaction ¶ added in v0.1.2
func (LeaseV1) Transaction()
func (*LeaseV1) UnmarshalBinary ¶
UnmarshalBinary reads the transaction from bytes slice.
type LeaseV2 ¶ added in v0.1.2
type LeaseV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
LeaseV2 is a second version of the LeaseV1 transaction.
func NewUnsignedLeaseV2 ¶ added in v0.1.2
func NewUnsignedLeaseV2(senderPK crypto.PublicKey, recipient Address, amount, fee, timestamp uint64) (*LeaseV2, error)
NewUnsignedLeaseV2 creates new LeaseV1 transaction without signature and ID set.
func (*LeaseV2) MarshalBinary ¶ added in v0.1.2
MarshalBinary saves the transaction to its binary representation.
func (LeaseV2) Transaction ¶ added in v0.1.2
func (LeaseV2) Transaction()
func (*LeaseV2) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads the transaction from bytes slice.
type MassTransferEntry ¶
type MassTransferEntry struct { Recipient Recipient `json:"recipient"` Amount uint64 `json:"amount"` }
func (*MassTransferEntry) MarshalBinary ¶
func (e *MassTransferEntry) MarshalBinary() ([]byte, error)
func (*MassTransferEntry) UnmarshalBinary ¶
func (e *MassTransferEntry) UnmarshalBinary(data []byte) error
type MassTransferV1 ¶
type MassTransferV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Asset OptionalAsset `json:"assetId"` Transfers []MassTransferEntry `json:"transfers"` Timestamp uint64 `json:"timestamp,omitempty"` Fee uint64 `json:"fee"` Attachment Attachment `json:"attachment,omitempty"` }
MassTransferV1 is a transaction that performs multiple transfers of one asset to the accounts at once.
func NewUnsignedMassTransferV1 ¶
func NewUnsignedMassTransferV1(senderPK crypto.PublicKey, asset OptionalAsset, transfers []MassTransferEntry, fee, timestamp uint64, attachment string) (*MassTransferV1, error)
NewUnsignedMassTransferV1 creates new MassTransferV1 transaction structure without signature and ID.
func (MassTransferV1) GetID ¶ added in v0.2.0
func (tx MassTransferV1) GetID() []byte
func (*MassTransferV1) MarshalBinary ¶
func (tx *MassTransferV1) MarshalBinary() ([]byte, error)
MarshalBinary saves the transaction to its binary representation.
func (*MassTransferV1) Sign ¶
func (tx *MassTransferV1) Sign(secretKey crypto.SecretKey) error
Sign calculates signature and ID of the transaction.
func (MassTransferV1) Transaction ¶ added in v0.1.2
func (MassTransferV1) Transaction()
func (*MassTransferV1) UnmarshalBinary ¶
func (tx *MassTransferV1) UnmarshalBinary(data []byte) error
UnmarshalBinary loads transaction from its binary representation.
type OptionalAsset ¶
OptionalAsset represents an optional asset identification
func NewOptionalAssetFromBytes ¶ added in v0.2.0
func NewOptionalAssetFromBytes(b []byte) (*OptionalAsset, error)
func NewOptionalAssetFromDigest ¶ added in v0.2.0
func NewOptionalAssetFromDigest(d crypto.Digest) (*OptionalAsset, error)
func NewOptionalAssetFromString ¶
func NewOptionalAssetFromString(s string) (*OptionalAsset, error)
NewOptionalAssetFromString creates an OptionalAsset structure from its string representation.
func (*OptionalAsset) MarshalBinary ¶
func (a *OptionalAsset) MarshalBinary() ([]byte, error)
MarshalBinary marshals the optional asset to its binary representation.
func (OptionalAsset) MarshalJSON ¶
func (a OptionalAsset) MarshalJSON() ([]byte, error)
MarshalJSON writes OptionalAsset as a JSON string Value
func (OptionalAsset) String ¶
func (a OptionalAsset) String() string
String method converts OptionalAsset to its text representation
func (*OptionalAsset) ToID ¶ added in v0.2.0
func (a *OptionalAsset) ToID() []byte
func (*OptionalAsset) UnmarshalBinary ¶
func (a *OptionalAsset) UnmarshalBinary(data []byte) error
UnmarshalBinary reads the OptionalAsset structure from its binary representation.
func (*OptionalAsset) UnmarshalJSON ¶
func (a *OptionalAsset) UnmarshalJSON(value []byte) error
UnmarshalJSON reads OptionalAsset from a JSON string Value
type OrderType ¶
type OrderType byte
OrderType an alias for byte that encodes the type of OrderV1 (BUY|SELL).
func (OrderType) MarshalJSON ¶
MarshalJSON writes value of OrderType to JSON representation.
func (*OrderType) UnmarshalJSON ¶
UnmarshalJSON reads the OrderType value from JSON value.
type OrderV1 ¶ added in v0.1.2
type OrderV1 struct { ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
OrderV1 is an order created and signed by user. Two matched orders builds up an Exchange transaction.
func NewUnsignedOrderV1 ¶ added in v0.1.2
func NewUnsignedOrderV1(senderPK, matcherPK crypto.PublicKey, amountAsset, priceAsset OptionalAsset, orderType OrderType, price, amount, timestamp, expiration, matcherFee uint64) (*OrderV1, error)
NewUnsignedOrderV1 creates the new unsigned order.
func (OrderV1) GetMatcherPK ¶ added in v0.1.2
func (OrderV1) GetOrderType ¶ added in v0.1.2
func (OrderV1) GetVersion ¶ added in v0.1.2
func (*OrderV1) MarshalBinary ¶ added in v0.1.2
MarshalBinary writes order to its bytes representation.
func (*OrderV1) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads an order from its binary representation.
type OrderV2 ¶ added in v0.1.2
type OrderV2 struct { Version byte `json:"version"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
OrderV2 is an order created and signed by user. Two matched orders builds up an Exchange transaction. Version 2 with proofs.
func NewUnsignedOrderV2 ¶ added in v0.1.2
func NewUnsignedOrderV2(senderPK, matcherPK crypto.PublicKey, amountAsset, priceAsset OptionalAsset, orderType OrderType, price, amount, timestamp, expiration, matcherFee uint64) (*OrderV2, error)
NewUnsignedOrderV2 creates the new unsigned order.
func (OrderV2) GetMatcherPK ¶ added in v0.1.2
func (OrderV2) GetOrderType ¶ added in v0.1.2
func (OrderV2) GetVersion ¶ added in v0.1.2
func (*OrderV2) MarshalBinary ¶ added in v0.1.2
MarshalBinary writes order to its bytes representation.
func (*OrderV2) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads an order from its binary representation.
type OrderVersion ¶ added in v0.2.0
type OrderVersion struct {
Version byte `json:"version"`
}
type Payment ¶
type Payment struct { Type TransactionType `json:"type"` Version byte `json:"version"` ID *crypto.Signature `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Recipient Address `json:"recipient"` Amount uint64 `json:"amount"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp"` }
Payment transaction is deprecated and can be used only for validation of blockchain.
func NewUnsignedPayment ¶
func NewUnsignedPayment(senderPK crypto.PublicKey, recipient Address, amount, fee, timestamp uint64) (*Payment, error)
NewUnsignedPayment creates new Payment transaction with empty Signature and ID fields.
func (*Payment) MarshalBinary ¶
MarshalBinary returns a bytes representation of Payment transaction.
func (Payment) Transaction ¶ added in v0.1.2
func (Payment) Transaction()
func (*Payment) UnmarshalBinary ¶
UnmarshalBinary reads Payment transaction from its binary representation.
type PeerInfo ¶
PeerInfo represents the address of a single peer
func (*PeerInfo) MarshalBinary ¶
MarshalBinary encodes PeerInfo message to binary form
func (PeerInfo) MarshalJSON ¶
MarshalJSON writes PeerInfo Value as JSON string
func (*PeerInfo) UnmarshalBinary ¶
UnmarshalBinary decodes PeerInfo message from binary form
func (*PeerInfo) UnmarshalJSON ¶
UnmarshalJSON reads PeerInfo from JSON string
type PeersMessage ¶
type PeersMessage struct {
Peers []PeerInfo
}
PeersMessage represents the peers message
func (*PeersMessage) MarshalBinary ¶
func (m *PeersMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes PeersMessage message to binary form
func (*PeersMessage) ReadFrom ¶
func (m *PeersMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads PeersMessage from io.Reader
func (*PeersMessage) UnmarshalBinary ¶
func (m *PeersMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes PeersMessage from binary form
type ProofsV1 ¶
ProofsV1 is a collection of proofs.
func (*ProofsV1) MarshalBinary ¶
MarshalBinary writes the proofs to its binary form.
func (ProofsV1) MarshalJSON ¶
MarshalJSON writes the proofs to JSON.
func (*ProofsV1) UnmarshalBinary ¶
UnmarshalBinary reads the proofs from its binary representation.
func (*ProofsV1) UnmarshalJSON ¶
UnmarshalJSON reads the proofs from JSON.
type Recipient ¶ added in v0.2.0
func NewRecipientFromAddress ¶ added in v0.2.0
func NewRecipientFromAlias ¶ added in v0.2.0
func (*Recipient) MarshalBinary ¶ added in v0.2.0
func (Recipient) MarshalJSON ¶ added in v0.2.0
func (*Recipient) UnmarshalBinary ¶ added in v0.2.0
func (*Recipient) UnmarshalJSON ¶ added in v0.2.0
type ReissueV1 ¶
type ReissueV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
ReissueV1 is a transaction that allows to issue new amount of existing token, if it was issued as reissuable.
func NewUnsignedReissueV1 ¶
func NewUnsignedReissueV1(senderPK crypto.PublicKey, assetID crypto.Digest, quantity uint64, reissuable bool, timestamp, fee uint64) (*ReissueV1, error)
NewUnsignedReissueV1 creates new ReissueV1 transaction without signature and ID.
func (*ReissueV1) MarshalBinary ¶
MarshalBinary saves the transaction to its binary representation.
func (*ReissueV1) Sign ¶
Sign use given private key to calculate signature of the transaction. This function also calculates digest of transaction data and assigns it to ID field.
func (ReissueV1) Transaction ¶ added in v0.1.2
func (ReissueV1) Transaction()
func (*ReissueV1) UnmarshalBinary ¶
UnmarshalBinary reads transaction from its binary representation.
type ReissueV2 ¶ added in v0.1.2
type ReissueV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ChainID byte `json:"-"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
ReissueV2 same as ReissueV1 but version 2 with Proofs.
func NewUnsignedReissueV2 ¶ added in v0.1.2
func NewUnsignedReissueV2(chainID byte, senderPK crypto.PublicKey, assetID crypto.Digest, quantity uint64, reissuable bool, timestamp, fee uint64) (*ReissueV2, error)
NewUnsignedReissueV2 creates new ReissueV2 transaction without signature and ID.
func (*ReissueV2) MarshalBinary ¶ added in v0.1.2
MarshalBinary writes ReissueV2 transaction to its bytes representation.
func (ReissueV2) Transaction ¶ added in v0.1.2
func (ReissueV2) Transaction()
func (*ReissueV2) UnmarshalBinary ¶ added in v0.1.2
UnmarshalBinary reads ReissueV2 from its bytes representation.
type ScoreMessage ¶
type ScoreMessage struct {
Score []byte
}
ScoreMessage represents Score message
func (*ScoreMessage) MarshalBinary ¶
func (m *ScoreMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes ScoreMessage to binary form
func (*ScoreMessage) ReadFrom ¶
func (m *ScoreMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads ScoreMessage from io.Reader
func (*ScoreMessage) UnmarshalBinary ¶
func (m *ScoreMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes ScoreMessage from binary form
type Script ¶
type Script []byte
func (Script) MarshalJSON ¶ added in v0.2.0
MarshalJSON writes Script as JSON
func (Script) String ¶ added in v0.2.0
String gives a string representation of Script bytes, script bytes encoded as BASE64 with prefix
func (*Script) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON reads Script from it's JSON representation
type SetAssetScriptV1 ¶ added in v0.2.0
type SetAssetScriptV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` ChainID byte `json:"-"` SenderPK crypto.PublicKey `json:"senderPublicKey"` AssetID crypto.Digest `json:"assetId"` Script Script `json:"script"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
SetAssetScriptV1 is a transaction to set smart script on an asset.
func NewUnsignedSetAssetScriptV1 ¶ added in v0.2.0
func NewUnsignedSetAssetScriptV1(chain byte, senderPK crypto.PublicKey, assetID crypto.Digest, script []byte, fee, timestamp uint64) (*SetAssetScriptV1, error)
NewUnsignedSetAssetScriptV1 creates new unsigned SetAssetScriptV1 transaction.
func (SetAssetScriptV1) GetID ¶ added in v0.2.0
func (tx SetAssetScriptV1) GetID() []byte
func (*SetAssetScriptV1) MarshalBinary ¶ added in v0.2.0
func (tx *SetAssetScriptV1) MarshalBinary() ([]byte, error)
MarshalBinary writes SetAssetScriptV1 transaction to its bytes representation.
func (*SetAssetScriptV1) NonEmptyScript ¶ added in v0.2.0
func (tx *SetAssetScriptV1) NonEmptyScript() bool
NonEmptyScript returns true if transaction contains non-empty script.
func (*SetAssetScriptV1) Sign ¶ added in v0.2.0
func (tx *SetAssetScriptV1) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (SetAssetScriptV1) Transaction ¶ added in v0.2.0
func (SetAssetScriptV1) Transaction()
func (*SetAssetScriptV1) UnmarshalBinary ¶ added in v0.2.0
func (tx *SetAssetScriptV1) UnmarshalBinary(data []byte) error
UnmarshalBinary reads SetAssetScriptV1 transaction from its binary representation.
type SetScriptV1 ¶
type SetScriptV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` ChainID byte `json:"-"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Script Script `json:"script"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
SetScriptV1 is a transaction to set smart script on an account.
func NewUnsignedSetScriptV1 ¶
func NewUnsignedSetScriptV1(chain byte, senderPK crypto.PublicKey, script []byte, fee, timestamp uint64) (*SetScriptV1, error)
NewUnsignedSetScriptV1 creates new unsigned SetScriptV1 transaction.
func (SetScriptV1) GetID ¶ added in v0.2.0
func (tx SetScriptV1) GetID() []byte
func (*SetScriptV1) MarshalBinary ¶
func (tx *SetScriptV1) MarshalBinary() ([]byte, error)
MarshalBinary writes SetScriptV1 transaction to its bytes representation.
func (*SetScriptV1) NonEmptyScript ¶
func (tx *SetScriptV1) NonEmptyScript() bool
NonEmptyScript returns true if transaction contains non-empty script.
func (*SetScriptV1) Sign ¶
func (tx *SetScriptV1) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (SetScriptV1) Transaction ¶ added in v0.1.2
func (SetScriptV1) Transaction()
func (*SetScriptV1) UnmarshalBinary ¶
func (tx *SetScriptV1) UnmarshalBinary(data []byte) error
UnmarshalBinary reads SetScriptV1 transaction from its binary representation.
type SignaturesMessage ¶
SignaturesMessage represents Signatures message
func (*SignaturesMessage) MarshalBinary ¶
func (m *SignaturesMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes SignaturesMessage to binary form
func (*SignaturesMessage) ReadFrom ¶
func (m *SignaturesMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads SignaturesMessage from binary form
func (*SignaturesMessage) UnmarshalBinary ¶
func (m *SignaturesMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes SignaturesMessage from binary form
type SponsorshipV1 ¶
type SponsorshipV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` AssetID crypto.Digest `json:"assetId"` MinAssetFee uint64 `json:"minSponsoredAssetFee"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
SponsorshipV1 is a transaction to setup fee sponsorship for an asset.
func NewUnsignedSponsorshipV1 ¶
func NewUnsignedSponsorshipV1(senderPK crypto.PublicKey, assetID crypto.Digest, minAssetFee, fee, timestamp uint64) (*SponsorshipV1, error)
NewUnsignedSponsorshipV1 creates new unsigned SponsorshipV1 transaction
func (SponsorshipV1) GetID ¶ added in v0.2.0
func (tx SponsorshipV1) GetID() []byte
func (*SponsorshipV1) MarshalBinary ¶
func (tx *SponsorshipV1) MarshalBinary() ([]byte, error)
MarshalBinary writes SponsorshipV1 transaction to its bytes representation.
func (*SponsorshipV1) Sign ¶
func (tx *SponsorshipV1) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (SponsorshipV1) Transaction ¶ added in v0.1.2
func (SponsorshipV1) Transaction()
func (*SponsorshipV1) UnmarshalBinary ¶
func (tx *SponsorshipV1) UnmarshalBinary(data []byte) error
UnmarshalBinary reads SponsorshipV1 from its bytes representation.
type StringDataEntry ¶
StringDataEntry structure is a key-value pair to store a string value.
func (StringDataEntry) GetKey ¶
func (e StringDataEntry) GetKey() string
GetKey returns the key of key-value pair.
func (StringDataEntry) GetValueType ¶
func (e StringDataEntry) GetValueType() ValueType
GetValueType returns the type of value in key-value entry.
func (StringDataEntry) MarshalBinary ¶
func (e StringDataEntry) MarshalBinary() ([]byte, error)
MarshalBinary converts the data entry to its byte representation.
func (StringDataEntry) MarshalJSON ¶
func (e StringDataEntry) MarshalJSON() ([]byte, error)
MarshalJSON writes the entry to its JSON representation.
func (*StringDataEntry) UnmarshalBinary ¶
func (e *StringDataEntry) UnmarshalBinary(data []byte) error
UnmarshalBinary reads an StringDataEntry structure from bytes.
func (*StringDataEntry) UnmarshalJSON ¶
func (e *StringDataEntry) UnmarshalJSON(value []byte) error
UnmarshalJSON reads the entry from JSON.
type Transaction ¶ added in v0.1.2
type Transaction interface { Transaction() GetID() []byte MarshalBinary() ([]byte, error) UnmarshalBinary([]byte) error }
func BytesToTransaction ¶ added in v0.2.0
func BytesToTransaction(tx []byte) (Transaction, error)
type TransactionMessage ¶
type TransactionMessage struct {
Transaction []byte
}
TransactionMessage represents Transaction message
func (*TransactionMessage) MarshalBinary ¶
func (m *TransactionMessage) MarshalBinary() ([]byte, error)
MarshalBinary encodes TransactionMessage to binary form
func (*TransactionMessage) ReadFrom ¶
func (m *TransactionMessage) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads TransactionMessage from io.Reader
func (*TransactionMessage) UnmarshalBinary ¶
func (m *TransactionMessage) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes TransactionMessage from binary form
type TransactionType ¶
type TransactionType byte
TransactionType
const ( GenesisTransaction TransactionType = iota + 1 PaymentTransaction IssueTransaction TransferTransaction ReissueTransaction BurnTransaction ExchangeTransaction LeaseTransaction LeaseCancelTransaction CreateAliasTransaction MassTransferTransaction DataTransaction SetScriptTransaction SponsorshipTransaction SetAssetScriptTransaction )
All transaction types supported.
type TransactionValidator ¶ added in v0.2.0
type TransactionValidator struct {
// contains filtered or unexported fields
}
func NewTransactionValidator ¶ added in v0.2.0
func NewTransactionValidator(genesis crypto.Signature, state AccountsState) (*TransactionValidator, error)
func (*TransactionValidator) IsSupported ¶ added in v0.2.0
func (tv *TransactionValidator) IsSupported(tx Transaction) bool
func (*TransactionValidator) ValidateTransaction ¶ added in v0.2.0
func (tv *TransactionValidator) ValidateTransaction(blockID crypto.Signature, tx Transaction, initialisation bool) error
type TransferV1 ¶
type TransferV1 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` // contains filtered or unexported fields }
TransferV1 transaction to transfer any token from one account to another. Version 1.
func NewUnsignedTransferV1 ¶
func NewUnsignedTransferV1(senderPK crypto.PublicKey, amountAsset, feeAsset OptionalAsset, timestamp, amount, fee uint64, recipient Address, attachment string) (*TransferV1, error)
NewUnsignedTransferV1 creates new TransferV1 transaction without signature and ID.
func (TransferV1) GetID ¶ added in v0.2.0
func (tx TransferV1) GetID() []byte
func (*TransferV1) MarshalBinary ¶
func (tx *TransferV1) MarshalBinary() ([]byte, error)
MarshalBinary saves transaction to its binary representation.
func (*TransferV1) Sign ¶
func (tx *TransferV1) Sign(secretKey crypto.SecretKey) error
Sign calculates a signature and a digest as an ID of the transaction.
func (TransferV1) Transaction ¶ added in v0.1.2
func (TransferV1) Transaction()
func (*TransferV1) UnmarshalBinary ¶
func (tx *TransferV1) UnmarshalBinary(data []byte) error
UnmarshalBinary reads transaction from its binary representation.
type TransferV2 ¶ added in v0.1.2
type TransferV2 struct { Type TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Proofs *ProofsV1 `json:"proofs,omitempty"` // contains filtered or unexported fields }
TransferV2 transaction to transfer any token from one account to another. Version 2.
func NewUnsignedTransferV2 ¶ added in v0.1.2
func NewUnsignedTransferV2(senderPK crypto.PublicKey, amountAsset, feeAsset OptionalAsset, timestamp, amount, fee uint64, recipient Address, attachment string) (*TransferV2, error)
NewUnsignedTransferV2 creates new TransferV2 transaction without proofs and ID.
func (*TransferV2) BodyMarshalBinary ¶ added in v0.2.0
func (tx *TransferV2) BodyMarshalBinary() ([]byte, error)
func (*TransferV2) BodyUnmarshalBinary ¶ added in v0.2.0
func (tx *TransferV2) BodyUnmarshalBinary(data []byte) error
func (TransferV2) GetID ¶ added in v0.2.0
func (tx TransferV2) GetID() []byte
func (*TransferV2) MarshalBinary ¶ added in v0.1.2
func (tx *TransferV2) MarshalBinary() ([]byte, error)
MarshalBinary writes TransferV2 transaction to its bytes representation.
func (*TransferV2) Sign ¶ added in v0.1.2
func (tx *TransferV2) Sign(secretKey crypto.SecretKey) error
Sign adds signature as a proof at first position.
func (TransferV2) Transaction ¶ added in v0.1.2
func (TransferV2) Transaction()
func (*TransferV2) UnmarshalBinary ¶ added in v0.1.2
func (tx *TransferV2) UnmarshalBinary(data []byte) error
UnmarshalBinary reads TransferV2 from its bytes representation.