proto

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 23 Imported by: 38

Documentation

Index

Constants

View Source
const (
	AddressSize = headerSize + bodySize + checksumSize

	AliasMinLength = 4
	AliasMaxLength = 30
	AliasAlphabet  = "-.0123456789@_abcdefghijklmnopqrstuvwxyz"
	AliasPrefix    = "alias"

	MainNetScheme   byte = 'W'
	TestNetScheme   byte = 'T'
	StageNetScheme  byte = 'S'
	CustomNetScheme byte = 'E'
)
View Source
const (
	MaxHeaderLength = 17

	HeaderSizeWithPayload    = 17
	HeaderSizeWithoutPayload = 13
)
View Source
const (
	ContentIDGetPeers          = 0x1
	ContentIDPeers             = 0x2
	ContentIDGetSignatures     = 0x14
	ContentIDSignatures        = 0x15
	ContentIDGetBlock          = 0x16
	ContentIDBlock             = 0x17
	ContentIDScore             = 0x18
	ContentIDTransaction       = 0x19
	ContentIDInvMicroblock     = 0x1A
	ContentIDCheckpoint        = 0x64
	ContentIDMicroblockRequest = 27
	ContentIDMicroblock        = 28

	HeaderContentIDPosition = 8
)

Constants for message IDs

View Source
const (
	//WavesAssetName is the default name for basic WAVES asset.
	WavesAssetName = "WAVES"

	PriceConstant  = 100000000
	MaxOrderAmount = 100 * PriceConstant * PriceConstant
	MaxOrderTTL    = uint64((30 * 24 * time.Hour) / time.Millisecond)
)
View Source
const (
	BooleanTrue  = 6
	BooleanFalse = 7
)

Special values to represent Boolean value

View Source
const IpPortLength = net.IPv6len + 8

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func AppendHeaderBytesToTransactions added in v0.3.0

func AppendHeaderBytesToTransactions(headerBytes []byte, transactions []byte) ([]byte, error)

func BlockEncodeJson added in v0.3.0

func BlockEncodeJson(b *Block) ([]byte, error)

func BlockGetParent added in v0.3.0

func BlockGetParent(data []byte) (crypto.Signature, error)

BlockGetParent get parent signature from block without deserialization

func BlockGetSignature added in v0.3.0

func BlockGetSignature(data []byte) (crypto.Signature, error)

BlockGetSignature get signature from block without deserialization

func Bool

func Bool(buf []byte) (bool, error)

func BytesWithUInt16Len

func BytesWithUInt16Len(buf []byte) ([]byte, error)

BytesWithUInt16Len reads from buf an array of bytes of length encoded in first 2 bytes.

func BytesWithUInt32Len added in v0.3.0

func BytesWithUInt32Len(buf []byte) ([]byte, error)

BytesWithUInt32Len reads from buf an array of bytes of length encoded in first 4 bytes.

func NetworkSchemeByType added in v0.3.0

func NetworkSchemeByType(networkType string) (byte, error)

func NetworkStrByType added in v0.3.0

func NetworkStrByType(networkType string) (string, error)

func NewTimestampFromTime added in v0.3.0

func NewTimestampFromTime(t time.Time) uint64

func NewTimestampFromUnixNano added in v0.3.0

func NewTimestampFromUnixNano(nano int64) uint64

func PutBool

func PutBool(buf []byte, b bool)

func PutBytesWithUInt16Len

func PutBytesWithUInt16Len(buf []byte, data []byte)

PutBytesWithUInt16Len prepends given buf with 2 bytes of it's length.

func PutBytesWithUInt32Len added in v0.3.0

func PutBytesWithUInt32Len(buf []byte, data []byte)

PutBytesWithUInt32Len prepends given buf with 4 bytes of it's length.

func PutStringWithUInt16Len

func PutStringWithUInt16Len(buf []byte, s string)

PutStringWithUInt16Len writes to the buffer `buf` two bytes of the string `s` length followed with the bytes of the string `s`.

func PutStringWithUInt32Len added in v0.3.0

func PutStringWithUInt32Len(buf []byte, s string)

PutStringWithUInt32Len writes to the buffer `buf` four bytes of the string's `s` length followed with the bytes of string itself.

func PutStringWithUInt8Len added in v0.3.0

func PutStringWithUInt8Len(buf []byte, s string)

PutStringWithUInt8Len converts the string to slice of bytes. The first byte of resulting slice contains the length of the string.

func ReadPacket added in v0.3.0

func ReadPacket(buf []byte, r io.Reader) (int64, error)

func ReadPayload added in v0.3.0

func ReadPayload(buf []byte, r io.Reader) (int64, error)

func StringWithUInt16Len

func StringWithUInt16Len(buf []byte) (string, error)

StringWithUInt16Len reads a string from the buffer `buf`.

func StringWithUInt32Len added in v0.3.0

func StringWithUInt32Len(buf []byte) (string, error)

StringWithUInt32Len reads a string from the buffer `buf`.

func StringWithUInt8Len added in v0.3.0

func StringWithUInt8Len(buf []byte) (string, error)

StringWithUInt8Len reads a string from given slice of bytes. The first byte of slice should contain the length of the following string. Function fails then the length of slice is less then 1 byte or the length of remaining slice is less then the length value from first byte.

Types

type Address

type Address [AddressSize]byte

Address is the transformed Public Key with additional bytes of the version, a blockchain scheme and a checksum.

func MustAddressFromPublicKey added in v0.3.0

func MustAddressFromPublicKey(scheme byte, publicKey crypto.PublicKey) Address

func NewAddressFromBytes

func NewAddressFromBytes(b []byte) (Address, error)

NewAddressFromBytes creates an Address from the slice of bytes and checks that the result address is valid address.

func NewAddressFromPublicKey

func NewAddressFromPublicKey(scheme byte, publicKey crypto.PublicKey) (Address, error)

NewAddressFromPublicKey produces an Address from given scheme and Public Key bytes.

func NewAddressFromString

func NewAddressFromString(s string) (Address, error)

NewAddressFromString creates an Address from its string representation. This function checks that the address is valid.

func NewAddressLikeFromAnyBytes added in v0.3.0

func NewAddressLikeFromAnyBytes(scheme byte, b []byte) (Address, error)

NewAddressFromPublicKey produces an Address from given scheme and Public Key bytes.

func RebuildAddress added in v0.3.0

func RebuildAddress(scheme byte, body []byte) (Address, error)

func (Address) Bytes added in v0.2.0

func (a Address) Bytes() []byte

Bytes converts the fixed-length byte array of the Address to a slice of bytes.

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

MarshalJSON is the custom JSON marshal function for the Address.

func (Address) String

func (a Address) String() string

String produces the BASE58 string representation of the Address.

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(value []byte) error

UnmarshalJSON tries to unmarshal an Address from it's JSON representation. This method does not perform validation of the result address.

func (*Address) Valid added in v0.3.0

func (a *Address) Valid() (bool, error)

Valid checks that version and checksum of the Address are correct.

type Alias

type Alias struct {
	Version byte
	Scheme  byte
	Alias   string
}

Alias represents the nickname tha could be attached to the Address.

func NewAlias

func NewAlias(scheme byte, alias string) *Alias

func NewAliasFromBytes

func NewAliasFromBytes(b []byte) (*Alias, error)

NewAliasFromBytes unmarshal an Alias from bytes and checks that it's valid.

func NewAliasFromString

func NewAliasFromString(s string) (*Alias, error)

NewAliasFromString creates an Alias from its string representation. Function does not check that the result is a valid Alias. String representation of an Alias should have a following format: "alias:<scheme>:<alias>". Scheme should be represented with a one-byte ASCII symbol.

func (*Alias) Bytes added in v0.2.0

func (a *Alias) Bytes() []byte

Bytes converts the Alias to the slice of bytes.

func (*Alias) MarshalBinary

func (a *Alias) MarshalBinary() ([]byte, error)

MarshalBinary converts the Alias to the slice of bytes. Just calls Bytes().

func (Alias) MarshalJSON

func (a Alias) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshalling function.

func (*Alias) Serialize added in v0.3.0

func (a *Alias) Serialize(s *serializer.Serializer) error

func (Alias) String

func (a Alias) String() string

String converts the Alias to its 3-part string representation.

func (*Alias) UnmarshalBinary

func (a *Alias) UnmarshalBinary(data []byte) error

Reads an Alias from its bytes representation. This function does not validate the result.

func (*Alias) UnmarshalJSON

func (a *Alias) UnmarshalJSON(value []byte) error

UnmarshalJSON reads an Alias from JSON.

func (Alias) Valid added in v0.3.0

func (a Alias) Valid() (bool, error)

Valid validates the Alias checking it length, version and symbols.

func (*Alias) WriteTo added in v0.3.0

func (a *Alias) WriteTo(w io.Writer) (int64, error)

type Argument added in v0.3.0

type Argument interface {
	GetValueType() ArgumentValueType
	MarshalBinary() ([]byte, error)

	Serialize(*serializer.Serializer) error
	// contains filtered or unexported methods
}

type ArgumentType added in v0.3.0

type ArgumentType struct {
	Type string `json:"type"`
}

DataEntryType is the assistive structure used to get the type of DataEntry while unmarshal form JSON.

type ArgumentValueType added in v0.3.0

type ArgumentValueType byte

ValueType is an alias for byte that encodes the value type.

const (
	ArgumentInteger ArgumentValueType = iota
	ArgumentBinary
	ArgumentString
	ArgumentBoolean
)

func (ArgumentValueType) String added in v0.3.0

func (vt ArgumentValueType) String() string

String translates ValueType value to human readable name.

type Arguments added in v0.3.0

type Arguments []Argument

func (*Arguments) Append added in v0.3.0

func (a *Arguments) Append(arg Argument)

Append adds an argument to the Arguments list.

func (Arguments) MarshalBinary added in v0.3.0

func (a Arguments) MarshalBinary() ([]byte, error)

func (Arguments) Serialize added in v0.3.0

func (a Arguments) Serialize(s *serializer.Serializer) error

func (*Arguments) UnmarshalBinary added in v0.3.0

func (a *Arguments) UnmarshalBinary(data []byte) error

func (*Arguments) UnmarshalJSON added in v0.3.0

func (a *Arguments) UnmarshalJSON(data []byte) error

UnmarshalJSON custom JSON deserialization method.

type AssetInfo added in v0.3.0

type AssetInfo struct {
	ID              crypto.Digest
	Quantity        uint64
	Decimals        byte
	Issuer          Address
	IssuerPublicKey crypto.PublicKey
	Reissuable      bool
	Scripted        bool
	Sponsored       bool
}

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) Bytes added in v0.3.0

func (a Attachment) Bytes() []byte

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) Bytes added in v0.2.0

func (b B58Bytes) Bytes() []byte

func (B58Bytes) MarshalJSON

func (b B58Bytes) MarshalJSON() ([]byte, error)

MarshalJSON writes B58Bytes Value as JSON string

func (B58Bytes) String

func (b B58Bytes) String() string

String represents underlying bytes as Base58 string

func (*B58Bytes) UnmarshalJSON

func (b *B58Bytes) UnmarshalJSON(value []byte) error

UnmarshalJSON reads B58Bytes from JSON string

type BinaryArgument added in v0.3.0

type BinaryArgument struct {
	Value []byte
}

BinaryArgument represents an argument that stores binary value.

func NewBinaryArgument added in v0.3.0

func NewBinaryArgument(b []byte) *BinaryArgument

func (BinaryArgument) GetValueType added in v0.3.0

func (a BinaryArgument) GetValueType() ArgumentValueType

GetValueType returns the type of value (Binary) stored in an argument.

func (BinaryArgument) MarshalBinary added in v0.3.0

func (a BinaryArgument) MarshalBinary() ([]byte, error)

MarshalBinary writes an argument to its byte representation.

func (BinaryArgument) MarshalJSON added in v0.3.0

func (a BinaryArgument) MarshalJSON() ([]byte, error)

MarshalJSON converts an argument to its JSON representation. Note that BASE64 is used to represent the binary value.

func (BinaryArgument) Serialize added in v0.3.0

func (a BinaryArgument) Serialize(s *serializer.Serializer) error

Serialize argument to its byte representation.

func (*BinaryArgument) UnmarshalBinary added in v0.3.0

func (a *BinaryArgument) UnmarshalBinary(data []byte) error

UnmarshalBinary reads an argument from a binary representation.

func (*BinaryArgument) UnmarshalJSON added in v0.3.0

func (a *BinaryArgument) UnmarshalJSON(value []byte) error

UnmarshalJSON converts JSON to a BinaryArgument structure. Value should be stored as BASE64 sting in JSON.

type BinaryDataEntry

type BinaryDataEntry struct {
	Key   string
	Value []byte
}

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() DataValueType

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) MarshalValue added in v0.3.0

func (e BinaryDataEntry) MarshalValue() ([]byte, error)

MarshalValue writes an entry value to its byte representation.

func (*BinaryDataEntry) SetKey added in v0.3.0

func (e *BinaryDataEntry) SetKey(key string)

SetKey sets the key of data entry.

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.

func (*BinaryDataEntry) UnmarshalValue added in v0.3.0

func (e *BinaryDataEntry) UnmarshalValue(data []byte) error

UnmarshalValue reads an entry value from a binary representation.

func (BinaryDataEntry) Valid added in v0.3.0

func (e BinaryDataEntry) Valid() (bool, error)

type Block added in v0.2.0

type Block struct {
	BlockHeader
	Transactions *TransactionsRepresentation `json:"transactions,omitempty"`
}

Block is a block of the blockchain

func CreateBlock added in v0.3.0

func CreateBlock(transactions *TransactionsRepresentation, timestamp Timestamp, parentSig crypto.Signature, publicKey crypto.PublicKey, NxtConsensus NxtConsensus, version BlockVersion) (*Block, error)

func (*Block) MarshalBinary added in v0.2.0

func (b *Block) MarshalBinary() ([]byte, error)

MarshalBinary encodes Block to binary form

func (*Block) Sign added in v0.3.0

func (b *Block) Sign(secret crypto.SecretKey) error

func (*Block) UnmarshalBinary added in v0.2.0

func (b *Block) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary decodes Block from binary form

func (*Block) VerifySignature added in v0.3.0

func (b *Block) VerifySignature() (bool, error)

func (*Block) WriteTo added in v0.3.0

func (b *Block) WriteTo(w io.Writer) (int64, error)

func (*Block) WriteToWithoutSignature added in v0.3.0

func (b *Block) WriteToWithoutSignature(w io.Writer) (int64, error)

WriteToWithoutSignature writes binary representation of block into Writer. It does not sign and write signature.

type BlockHeader added in v0.2.0

type BlockHeader struct {
	Version                BlockVersion     `json:"version"`
	Timestamp              uint64           `json:"timestamp"`
	Parent                 crypto.Signature `json:"reference"`
	FeaturesCount          int              `json:"-"`
	Features               []int16          `json:"features,omitempty"`
	RewardVote             int64            `json:"desiredReward"`
	ConsensusBlockLength   uint32           `json:"-"`
	NxtConsensus           `json:"nxt-consensus"`
	TransactionBlockLength uint32           `json:"transactionBlockLength,omitempty"`
	TransactionCount       int              `json:"transactionCount"`
	GenPublicKey           crypto.PublicKey `json:"-"`
	BlockSignature         crypto.Signature `json:"signature"`

	Height uint64 `json:"height"`
}

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) (err error)

type BlockInfo added in v0.3.0

type BlockInfo struct {
	Timestamp           uint64
	Height              uint64
	BaseTarget          uint64
	GenerationSignature crypto.Digest
	Generator           Address
	GeneratorPublicKey  crypto.PublicKey
}

func BlockInfoFromHeader added in v0.3.0

func BlockInfoFromHeader(scheme byte, header *BlockHeader, height uint64) (*BlockInfo, 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

func (*BlockMessage) WriteTo

func (m *BlockMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes BlockMessage to io.Writer

type BlockVersion added in v0.3.0

type BlockVersion byte
const (
	GenesisBlockVersion BlockVersion = iota + 1
	PlainBlockVersion
	NgBlockVersion
	RewardBlockVersion
)

type BooleanArgument added in v0.3.0

type BooleanArgument struct {
	Value bool
}

BooleanArgument represents a key-value pair that stores a bool value.

func NewBooleanArgument added in v0.3.0

func NewBooleanArgument(b bool) *BooleanArgument

func (BooleanArgument) GetValueType added in v0.3.0

func (a BooleanArgument) GetValueType() ArgumentValueType

GetValueType returns the data type (Boolean) of the argument.

func (BooleanArgument) MarshalBinary added in v0.3.0

func (a BooleanArgument) MarshalBinary() ([]byte, error)

MarshalBinary writes a byte representation of the boolean data entry.

func (BooleanArgument) MarshalJSON added in v0.3.0

func (a BooleanArgument) MarshalJSON() ([]byte, error)

MarshalJSON writes the argument to a JSON representation.

func (BooleanArgument) Serialize added in v0.3.0

func (a BooleanArgument) Serialize(s *serializer.Serializer) error

Serialize argument to its byte representation.

func (*BooleanArgument) UnmarshalBinary added in v0.3.0

func (a *BooleanArgument) UnmarshalBinary(data []byte) error

UnmarshalBinary reads a byte representation of the data entry.

func (*BooleanArgument) UnmarshalJSON added in v0.3.0

func (a *BooleanArgument) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the entry from its JSON representation.

type BooleanDataEntry

type BooleanDataEntry struct {
	Key   string
	Value bool
}

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() DataValueType

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) MarshalValue added in v0.3.0

func (e BooleanDataEntry) MarshalValue() ([]byte, error)

MarshalValue writes a byte representation of the boolean data entry value.

func (*BooleanDataEntry) SetKey added in v0.3.0

func (e *BooleanDataEntry) SetKey(key string)

SetKey sets the key of data entry.

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.

func (*BooleanDataEntry) UnmarshalValue added in v0.3.0

func (e *BooleanDataEntry) UnmarshalValue(data []byte) error

UnmarshalValue reads a byte representation of the data entry value.

func (BooleanDataEntry) Valid added in v0.3.0

func (e BooleanDataEntry) Valid() (bool, error)

type BulkMessage added in v0.3.0

type BulkMessage []Message

func (BulkMessage) MarshalBinary added in v0.3.0

func (a BulkMessage) MarshalBinary() (data []byte, err error)

func (BulkMessage) ReadFrom added in v0.3.0

func (BulkMessage) ReadFrom(r io.Reader) (n int64, err error)

func (BulkMessage) UnmarshalBinary added in v0.3.0

func (BulkMessage) UnmarshalBinary(data []byte) error

func (BulkMessage) WriteTo added in v0.3.0

func (BulkMessage) WriteTo(w io.Writer) (n int64, err error)

type Burn added in v0.3.0

type Burn struct {
	SenderPK  crypto.PublicKey `json:"senderPublicKey"`
	AssetID   crypto.Digest    `json:"assetId"`
	Amount    uint64           `json:"amount"`
	Timestamp uint64           `json:"timestamp,omitempty"`
	Fee       uint64           `json:"fee"`
}

func (Burn) GetFee added in v0.3.0

func (b Burn) GetFee() uint64

func (Burn) GetSenderPK added in v0.3.0

func (b Burn) GetSenderPK() crypto.PublicKey

func (Burn) GetTimestamp added in v0.3.0

func (b Burn) GetTimestamp() uint64

func (Burn) Valid added in v0.3.0

func (b Burn) Valid() (bool, error)

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"`
	Burn
}

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

NewUnsignedBurnV1 creates new BurnV1 transaction with no signature and ID.

func (*BurnV1) BodyMarshalBinary added in v0.3.0

func (tx *BurnV1) BodyMarshalBinary() ([]byte, error)

func (*BurnV1) Clone added in v0.3.0

func (tx *BurnV1) Clone() *BurnV1

func (*BurnV1) GenerateID added in v0.3.0

func (tx *BurnV1) GenerateID()

func (BurnV1) GetID added in v0.2.0

func (tx BurnV1) GetID() ([]byte, error)

func (BurnV1) GetTypeVersion added in v0.3.0

func (tx BurnV1) GetTypeVersion() TransactionTypeVersion

func (*BurnV1) MarshalBinary

func (tx *BurnV1) MarshalBinary() ([]byte, error)

MarshalBinary saves transaction to

func (*BurnV1) Sign

func (tx *BurnV1) Sign(secretKey crypto.SecretKey) error

Sign calculates and sets signature and ID of the transaction.

func (*BurnV1) UnmarshalBinary

func (tx *BurnV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction form its binary representation.

func (*BurnV1) Verify

func (tx *BurnV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature of the transaction is valid for the given public key.

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"`
	Burn
}

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

NewUnsignedBurnV2 creates new BurnV2 transaction without proofs and ID.

func (*BurnV2) BodyMarshalBinary added in v0.3.0

func (tx *BurnV2) BodyMarshalBinary() ([]byte, error)

func (*BurnV2) Clone added in v0.3.0

func (tx *BurnV2) Clone() *BurnV2

func (*BurnV2) GenerateID added in v0.3.0

func (tx *BurnV2) GenerateID()

func (BurnV2) GetID added in v0.2.0

func (tx BurnV2) GetID() ([]byte, error)

func (BurnV2) GetTypeVersion added in v0.3.0

func (tx BurnV2) GetTypeVersion() TransactionTypeVersion

func (*BurnV2) MarshalBinary added in v0.1.2

func (tx *BurnV2) MarshalBinary() ([]byte, error)

MarshalBinary writes BurnV2 transaction to its bytes representation.

func (*BurnV2) Sign added in v0.1.2

func (tx *BurnV2) Sign(secretKey crypto.SecretKey) error

Sign adds signature as a proof at first position.

func (*BurnV2) UnmarshalBinary added in v0.1.2

func (tx *BurnV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads BurnV2 from its bytes representation.

func (BurnV2) Valid added in v0.3.0

func (tx BurnV2) Valid() (bool, error)

func (*BurnV2) Verify added in v0.1.2

func (tx *BurnV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type ByVersion added in v0.3.0

type ByVersion []Version

func (ByVersion) Len added in v0.3.0

func (a ByVersion) Len() int

func (ByVersion) Less added in v0.3.0

func (a ByVersion) Less(i, j int) bool

func (ByVersion) Swap added in v0.3.0

func (a ByVersion) Swap(i, j int)

type Bytes added in v0.3.0

type Bytes []byte

func (Bytes) WriteTo added in v0.3.0

func (a Bytes) WriteTo(w io.Writer) (int64, error)

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

func (*CheckPointMessage) WriteTo

func (m *CheckPointMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes CheckPointMessage to io.Writer

type CheckpointItem

type CheckpointItem struct {
	Height    uint64
	Signature crypto.Signature
}

CheckpointItem represents a Checkpoint

type CreateAlias added in v0.3.0

type CreateAlias struct {
	SenderPK  crypto.PublicKey `json:"senderPublicKey"`
	Alias     Alias            `json:"alias"`
	Fee       uint64           `json:"fee"`
	Timestamp uint64           `json:"timestamp,omitempty"`
}

func (CreateAlias) GetFee added in v0.3.0

func (ca CreateAlias) GetFee() uint64

func (CreateAlias) GetSenderPK added in v0.3.0

func (ca CreateAlias) GetSenderPK() crypto.PublicKey

func (CreateAlias) GetTimestamp added in v0.3.0

func (ca CreateAlias) GetTimestamp() uint64

func (CreateAlias) Valid added in v0.3.0

func (ca CreateAlias) Valid() (bool, error)

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"`
	CreateAlias
}

func NewUnsignedCreateAliasV1

func NewUnsignedCreateAliasV1(senderPK crypto.PublicKey, alias Alias, fee, timestamp uint64) *CreateAliasV1

func (*CreateAliasV1) BodyMarshalBinary added in v0.3.0

func (tx *CreateAliasV1) BodyMarshalBinary() ([]byte, error)

func (*CreateAliasV1) Clone added in v0.3.0

func (tx *CreateAliasV1) Clone() *CreateAliasV1

func (*CreateAliasV1) GenerateID added in v0.3.0

func (tx *CreateAliasV1) GenerateID()

func (CreateAliasV1) GetID added in v0.2.0

func (tx CreateAliasV1) GetID() ([]byte, error)

func (CreateAliasV1) GetTypeVersion added in v0.3.0

func (tx CreateAliasV1) GetTypeVersion() TransactionTypeVersion

func (*CreateAliasV1) MarshalBinary

func (tx *CreateAliasV1) MarshalBinary() ([]byte, error)

func (*CreateAliasV1) Sign

func (tx *CreateAliasV1) Sign(secretKey crypto.SecretKey) error

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

func (*CreateAliasV1) Verify

func (tx *CreateAliasV1) Verify(publicKey crypto.PublicKey) (bool, 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"`
	CreateAlias
}

func NewUnsignedCreateAliasV2 added in v0.1.2

func NewUnsignedCreateAliasV2(senderPK crypto.PublicKey, alias Alias, fee, timestamp uint64) *CreateAliasV2

func (*CreateAliasV2) BodyMarshalBinary added in v0.3.0

func (tx *CreateAliasV2) BodyMarshalBinary() ([]byte, error)

func (*CreateAliasV2) Clone added in v0.3.0

func (tx *CreateAliasV2) Clone() *CreateAliasV2

func (*CreateAliasV2) GenerateID added in v0.3.0

func (tx *CreateAliasV2) GenerateID()

func (CreateAliasV2) GetID added in v0.2.0

func (tx CreateAliasV2) GetID() ([]byte, error)

func (CreateAliasV2) GetTypeVersion added in v0.3.0

func (tx CreateAliasV2) GetTypeVersion() TransactionTypeVersion

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) 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

func (*CreateAliasV2) Verify added in v0.1.2

func (tx *CreateAliasV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

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
	SetKey(string)

	GetValueType() DataValueType
	MarshalValue() ([]byte, error)
	UnmarshalValue([]byte) error

	MarshalBinary() ([]byte, error)
	UnmarshalBinary([]byte) error
	Valid() (bool, 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.

func NewDataEntryFromValueBytes added in v0.3.0

func NewDataEntryFromValueBytes(valueBytes []byte) (DataEntry, error)

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

func NewUnsignedData(senderPK crypto.PublicKey, fee, timestamp uint64) *DataV1

NewUnsignedData creates new Data transaction without proofs.

func (*DataV1) AppendEntry

func (tx *DataV1) AppendEntry(entry DataEntry) error

AppendEntry adds the entry to the transaction.

func (*DataV1) BodyMarshalBinary added in v0.2.0

func (tx *DataV1) BodyMarshalBinary() ([]byte, error)

func (*DataV1) Clone added in v0.3.0

func (tx *DataV1) Clone() *DataV1

func (*DataV1) GenerateID added in v0.3.0

func (tx *DataV1) GenerateID()

func (DataV1) GetFee added in v0.3.0

func (tx DataV1) GetFee() uint64

func (DataV1) GetID added in v0.2.0

func (tx DataV1) GetID() ([]byte, error)

func (DataV1) GetSenderPK added in v0.3.0

func (tx DataV1) GetSenderPK() crypto.PublicKey

func (DataV1) GetTimestamp added in v0.3.0

func (tx DataV1) GetTimestamp() uint64

func (DataV1) GetTypeVersion added in v0.3.0

func (tx DataV1) GetTypeVersion() TransactionTypeVersion

func (*DataV1) MarshalBinary

func (tx *DataV1) MarshalBinary() ([]byte, error)

MarshalBinary saves the transaction to bytes.

func (*DataV1) Sign

func (tx *DataV1) Sign(secretKey crypto.SecretKey) error

Sign use given secret key to calculate signature of the transaction.

func (*DataV1) UnmarshalBinary

func (tx *DataV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the transaction from the bytes.

func (DataV1) Valid added in v0.3.0

func (tx DataV1) Valid() (bool, error)

func (*DataV1) Verify

func (tx *DataV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature is valid for the given public key.

type DataValueType added in v0.3.0

type DataValueType byte

ValueType is an alias for byte that encodes the value type.

const (
	DataInteger DataValueType = iota
	DataBoolean
	DataBinary
	DataString
)

Supported value types.

func (DataValueType) String added in v0.3.0

func (vt DataValueType) String() string

String translates ValueType value to human readable name.

type Exchange added in v0.3.0

type Exchange interface {
	GetID() ([]byte, error)
	GetSenderPK() crypto.PublicKey
	GetBuyOrder() (OrderBody, error)
	GetSellOrder() (OrderBody, error)
	GetBuyOrderFull() Order
	GetSellOrderFull() Order
	GetPrice() uint64
	GetAmount() uint64
	GetBuyMatcherFee() uint64
	GetSellMatcherFee() uint64
	GetFee() uint64
	GetTimestamp() uint64
}

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

func (*ExchangeV1) BodyMarshalBinary added in v0.3.0

func (tx *ExchangeV1) BodyMarshalBinary() ([]byte, error)

func (*ExchangeV1) BodySerialize added in v0.3.0

func (tx *ExchangeV1) BodySerialize(s *serializer.Serializer) error

func (*ExchangeV1) Clone added in v0.3.0

func (tx *ExchangeV1) Clone() *ExchangeV1

func (*ExchangeV1) GenerateID added in v0.3.0

func (tx *ExchangeV1) GenerateID()

func (ExchangeV1) GetAmount added in v0.3.0

func (tx ExchangeV1) GetAmount() uint64

func (ExchangeV1) GetBuyMatcherFee added in v0.3.0

func (tx ExchangeV1) GetBuyMatcherFee() uint64

func (ExchangeV1) GetBuyOrder added in v0.3.0

func (tx ExchangeV1) GetBuyOrder() (OrderBody, error)

func (ExchangeV1) GetBuyOrderFull added in v0.3.0

func (tx ExchangeV1) GetBuyOrderFull() Order

func (ExchangeV1) GetFee added in v0.3.0

func (tx ExchangeV1) GetFee() uint64

func (ExchangeV1) GetID added in v0.2.0

func (tx ExchangeV1) GetID() ([]byte, error)

func (ExchangeV1) GetPrice added in v0.3.0

func (tx ExchangeV1) GetPrice() uint64

func (ExchangeV1) GetSellMatcherFee added in v0.3.0

func (tx ExchangeV1) GetSellMatcherFee() uint64

func (ExchangeV1) GetSellOrder added in v0.3.0

func (tx ExchangeV1) GetSellOrder() (OrderBody, error)

func (ExchangeV1) GetSellOrderFull added in v0.3.0

func (tx ExchangeV1) GetSellOrderFull() Order

func (ExchangeV1) GetSenderPK added in v0.3.0

func (tx ExchangeV1) GetSenderPK() crypto.PublicKey

func (ExchangeV1) GetTimestamp added in v0.3.0

func (tx ExchangeV1) GetTimestamp() uint64

func (ExchangeV1) GetTypeVersion added in v0.3.0

func (tx ExchangeV1) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary

func (tx *ExchangeV1) UnmarshalBinary(data []byte) error

UnmarshalBinary loads the transaction from its binary representation.

func (ExchangeV1) Valid added in v0.3.0

func (tx ExchangeV1) Valid() (bool, error)

func (*ExchangeV1) Verify

func (tx *ExchangeV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that signature of the transaction is valid.

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

func (*ExchangeV2) BodyMarshalBinary added in v0.3.0

func (tx *ExchangeV2) BodyMarshalBinary() ([]byte, error)

func (*ExchangeV2) Clone added in v0.3.0

func (tx *ExchangeV2) Clone() *ExchangeV2

func (*ExchangeV2) GenerateID added in v0.3.0

func (tx *ExchangeV2) GenerateID()

func (ExchangeV2) GetAmount added in v0.3.0

func (tx ExchangeV2) GetAmount() uint64

func (ExchangeV2) GetBuyMatcherFee added in v0.3.0

func (tx ExchangeV2) GetBuyMatcherFee() uint64

func (ExchangeV2) GetBuyOrder added in v0.3.0

func (tx ExchangeV2) GetBuyOrder() (OrderBody, error)

func (ExchangeV2) GetBuyOrderFull added in v0.3.0

func (tx ExchangeV2) GetBuyOrderFull() Order

func (ExchangeV2) GetFee added in v0.3.0

func (tx ExchangeV2) GetFee() uint64

func (ExchangeV2) GetID added in v0.2.0

func (tx ExchangeV2) GetID() ([]byte, error)

func (ExchangeV2) GetPrice added in v0.3.0

func (tx ExchangeV2) GetPrice() uint64

func (ExchangeV2) GetSellMatcherFee added in v0.3.0

func (tx ExchangeV2) GetSellMatcherFee() uint64

func (ExchangeV2) GetSellOrder added in v0.3.0

func (tx ExchangeV2) GetSellOrder() (OrderBody, error)

func (ExchangeV2) GetSellOrderFull added in v0.3.0

func (tx ExchangeV2) GetSellOrderFull() Order

func (ExchangeV2) GetSenderPK added in v0.3.0

func (tx ExchangeV2) GetSenderPK() crypto.PublicKey

func (ExchangeV2) GetTimestamp added in v0.3.0

func (tx ExchangeV2) GetTimestamp() uint64

func (ExchangeV2) GetTypeVersion added in v0.3.0

func (tx ExchangeV2) GetTypeVersion() TransactionTypeVersion

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) 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

func (ExchangeV2) Valid added in v0.3.0

func (tx ExchangeV2) Valid() (bool, error)

func (*ExchangeV2) Verify added in v0.1.2

func (tx *ExchangeV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the transaction signature is valid for given public key.

type FullScriptTransfer added in v0.3.0

type FullScriptTransfer struct {
	ScriptResultTransfer
	Sender    Address
	Timestamp uint64
	ID        *crypto.Digest
}

func NewFullScriptTransfer added in v0.3.0

func NewFullScriptTransfer(scheme byte, tr *ScriptResultTransfer, tx *InvokeScriptV1) (*FullScriptTransfer, error)

type FunctionCall added in v0.3.0

type FunctionCall struct {
	Default   bool
	Name      string
	Arguments Arguments
}

FunctionCall structure represents the description of function called in the InvokeScript transaction.

func (FunctionCall) MarshalBinary added in v0.3.0

func (c FunctionCall) MarshalBinary() ([]byte, error)

func (FunctionCall) MarshalJSON added in v0.3.0

func (c FunctionCall) MarshalJSON() ([]byte, error)

MarshalJSON writes the entry to its JSON representation.

func (FunctionCall) Serialize added in v0.3.0

func (c FunctionCall) Serialize(s *serializer.Serializer) error

func (*FunctionCall) UnmarshalBinary added in v0.3.0

func (c *FunctionCall) UnmarshalBinary(data []byte) error

func (*FunctionCall) UnmarshalJSON added in v0.3.0

func (c *FunctionCall) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the entry from JSON.

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

func NewUnsignedGenesis(recipient Address, amount, timestamp uint64) *Genesis

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) GenerateID added in v0.3.0

func (tx *Genesis) GenerateID()

func (*Genesis) GenerateSigID

func (tx *Genesis) GenerateSigID() error

GenerateSigID calculates hash of the transaction and use it as an ID. Also doubled hash is used as a signature.

func (Genesis) GetFee added in v0.3.0

func (tx Genesis) GetFee() uint64

func (Genesis) GetID added in v0.2.0

func (tx Genesis) GetID() ([]byte, error)

func (Genesis) GetSenderPK added in v0.3.0

func (tx Genesis) GetSenderPK() crypto.PublicKey

func (Genesis) GetTimestamp added in v0.3.0

func (tx Genesis) GetTimestamp() uint64

func (Genesis) GetTypeVersion added in v0.3.0

func (tx Genesis) GetTypeVersion() TransactionTypeVersion

func (*Genesis) MarshalBinary

func (tx *Genesis) MarshalBinary() ([]byte, error)

MarshalBinary writes transaction bytes to slice of bytes.

func (*Genesis) UnmarshalBinary

func (tx *Genesis) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction values from the slice of bytes.

func (Genesis) Valid added in v0.3.0

func (tx Genesis) Valid() (bool, error)

Valid checks the validity of transaction parameters and it's signature.

type GetBlockMessage

type GetBlockMessage struct {
	BlockID crypto.Signature
}

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

func (*GetBlockMessage) WriteTo

func (m *GetBlockMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes GetBlockMessage to io.Writer

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

func (*GetPeersMessage) WriteTo

func (m *GetPeersMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes GetPeersMessage to io.Writer

type GetSignaturesMessage

type GetSignaturesMessage struct {
	Blocks []crypto.Signature
}

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

func (*GetSignaturesMessage) WriteTo

func (m *GetSignaturesMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes GetSignaturesMessage to io.Writer

type Handshake

type Handshake struct {
	AppName      string
	Version      Version
	NodeName     string
	NodeNonce    uint64
	DeclaredAddr HandshakeTCPAddr
	Timestamp    uint64
}

Handshake is the handshake structure of the waves protocol

func (*Handshake) ReadFrom

func (a *Handshake) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads Handshake from io.Reader

func (*Handshake) WriteTo

func (a *Handshake) WriteTo(w io.Writer) (int64, error)

type HandshakeTCPAddr added in v0.3.0

type HandshakeTCPAddr TCPAddr

func NewHandshakeTCPAddr added in v0.3.0

func NewHandshakeTCPAddr(ip net.IP, port int) HandshakeTCPAddr

func ParseHandshakeTCPAddr added in v0.3.0

func ParseHandshakeTCPAddr(s string) HandshakeTCPAddr

func (HandshakeTCPAddr) Empty added in v0.3.0

func (a HandshakeTCPAddr) Empty() bool

func (HandshakeTCPAddr) Network added in v0.3.0

func (a HandshakeTCPAddr) Network() string

func (*HandshakeTCPAddr) ReadFrom added in v0.3.0

func (a *HandshakeTCPAddr) ReadFrom(r io.Reader) (int64, error)

func (HandshakeTCPAddr) String added in v0.3.0

func (a HandshakeTCPAddr) String() string

func (HandshakeTCPAddr) ToIpPort added in v0.3.0

func (a HandshakeTCPAddr) ToIpPort() IpPort

func (HandshakeTCPAddr) WriteTo added in v0.3.0

func (a HandshakeTCPAddr) WriteTo(w io.Writer) (int64, error)
type Header struct {
	Length        uint32
	Magic         uint32
	ContentID     uint8
	PayloadLength uint32
	PayloadCsum   [headerCsumLen]byte
}

func MakeHeader added in v0.3.0

func MakeHeader(contentID uint8, payload []byte) (Header, error)

func (*Header) Copy added in v0.3.0

func (h *Header) Copy(data []byte) int

func (*Header) HeaderLength added in v0.3.0

func (h *Header) HeaderLength() uint32

func (*Header) MarshalBinary added in v0.3.0

func (h *Header) MarshalBinary() ([]byte, error)

func (*Header) ReadFrom added in v0.3.0

func (h *Header) ReadFrom(r io.Reader) (int64, error)

func (*Header) UnmarshalBinary added in v0.3.0

func (h *Header) UnmarshalBinary(data []byte) error

func (*Header) WriteTo added in v0.3.0

func (h *Header) WriteTo(w io.Writer) (int64, error)

type Height added in v0.3.0

type Height = uint64

type IntegerArgument added in v0.3.0

type IntegerArgument struct {
	Value int64
}

func NewIntegerArgument added in v0.3.0

func NewIntegerArgument(i int64) *IntegerArgument

func (IntegerArgument) GetValueType added in v0.3.0

func (a IntegerArgument) GetValueType() ArgumentValueType

GetValueType returns the value type of the entry.

func (IntegerArgument) MarshalBinary added in v0.3.0

func (a IntegerArgument) MarshalBinary() ([]byte, error)

MarshalBinary marshals the integer argument in its bytes representation.

func (IntegerArgument) MarshalJSON added in v0.3.0

func (a IntegerArgument) MarshalJSON() ([]byte, error)

MarshalJSON writes a JSON representation of integer argument.

func (IntegerArgument) Serialize added in v0.3.0

func (a IntegerArgument) Serialize(s *serializer.Serializer) error

Serialize the integer argument in its bytes representation.

func (*IntegerArgument) UnmarshalBinary added in v0.3.0

func (a *IntegerArgument) UnmarshalBinary(data []byte) error

UnmarshalBinary reads binary representation of integer argument to the structure.

func (*IntegerArgument) UnmarshalJSON added in v0.3.0

func (a *IntegerArgument) UnmarshalJSON(value []byte) error

UnmarshalJSON reads an integer argument from its JSON representation.

type IntegerDataEntry

type IntegerDataEntry struct {
	Key   string
	Value int64
}

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() DataValueType

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) MarshalValue added in v0.3.0

func (e IntegerDataEntry) MarshalValue() ([]byte, error)

MarshalValue marshals the integer data entry value in its bytes representation.

func (*IntegerDataEntry) SetKey added in v0.3.0

func (e *IntegerDataEntry) SetKey(key string)

SetKey sets the key of 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.

func (*IntegerDataEntry) UnmarshalValue added in v0.3.0

func (e *IntegerDataEntry) UnmarshalValue(data []byte) error

UnmarshalBinary reads binary representation of integer data entry value to the structure.

func (IntegerDataEntry) Valid added in v0.3.0

func (e IntegerDataEntry) Valid() (bool, error)

type InvokeScriptV1 added in v0.3.0

type InvokeScriptV1 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"`
	ScriptRecipient Recipient        `json:"dApp"`
	FunctionCall    FunctionCall     `json:"call"`
	Payments        ScriptPayments   `json:"payment"`
	FeeAsset        OptionalAsset    `json:"feeAssetId"`
	Fee             uint64           `json:"fee"`
	Timestamp       uint64           `json:"timestamp,omitempty"`
}

func NewUnsignedInvokeScriptV1 added in v0.3.0

func NewUnsignedInvokeScriptV1(chain byte, senderPK crypto.PublicKey, scriptRecipient Recipient, call FunctionCall, payments ScriptPayments, feeAsset OptionalAsset, fee, timestamp uint64) *InvokeScriptV1

NewUnsignedSetAssetScriptV1 creates new unsigned SetAssetScriptV1 transaction.

func (*InvokeScriptV1) BodyMarshalBinary added in v0.3.0

func (tx *InvokeScriptV1) BodyMarshalBinary() ([]byte, error)

func (*InvokeScriptV1) BodySerialize added in v0.3.0

func (tx *InvokeScriptV1) BodySerialize(s *serializer.Serializer) error

func (*InvokeScriptV1) Clone added in v0.3.0

func (tx *InvokeScriptV1) Clone() *InvokeScriptV1

func (*InvokeScriptV1) GenerateID added in v0.3.0

func (tx *InvokeScriptV1) GenerateID()

func (InvokeScriptV1) GetFee added in v0.3.0

func (tx InvokeScriptV1) GetFee() uint64

func (InvokeScriptV1) GetID added in v0.3.0

func (tx InvokeScriptV1) GetID() ([]byte, error)

func (InvokeScriptV1) GetSenderPK added in v0.3.0

func (tx InvokeScriptV1) GetSenderPK() crypto.PublicKey

func (InvokeScriptV1) GetTimestamp added in v0.3.0

func (tx InvokeScriptV1) GetTimestamp() uint64

func (InvokeScriptV1) GetTypeVersion added in v0.3.0

func (tx InvokeScriptV1) GetTypeVersion() TransactionTypeVersion

func (*InvokeScriptV1) MarshalBinary added in v0.3.0

func (tx *InvokeScriptV1) MarshalBinary() ([]byte, error)

MarshalBinary writes InvokeScriptV1 transaction to its bytes representation.

func (*InvokeScriptV1) Serialize added in v0.3.0

func (tx *InvokeScriptV1) Serialize(s *serializer.Serializer) error

Serialize InvokeScriptV1 transaction to its bytes representation.

func (*InvokeScriptV1) Sign added in v0.3.0

func (tx *InvokeScriptV1) Sign(secretKey crypto.SecretKey) error

Sign adds signature as a proof at first position.

func (*InvokeScriptV1) UnmarshalBinary added in v0.3.0

func (tx *InvokeScriptV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads InvokeScriptV1 transaction from its binary representation.

func (InvokeScriptV1) Valid added in v0.3.0

func (tx InvokeScriptV1) Valid() (bool, error)

func (*InvokeScriptV1) Verify added in v0.3.0

func (tx *InvokeScriptV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type IpPort added in v0.3.0

type IpPort [IpPortLength]byte

func NewIpPortFromTcpAddr added in v0.3.0

func NewIpPortFromTcpAddr(a TCPAddr) IpPort

func (IpPort) Addr added in v0.3.0

func (a IpPort) Addr() net.IP

func (IpPort) Port added in v0.3.0

func (a IpPort) Port() int

func (*IpPort) String added in v0.3.0

func (a *IpPort) String() string

func (IpPort) ToTcpAddr added in v0.3.0

func (a IpPort) ToTcpAddr() TCPAddr

func (*IpPort) UnmarshalBinary added in v0.3.0

func (a *IpPort) UnmarshalBinary(b []byte) error

type Issue added in v0.3.0

type Issue struct {
	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"`
}

func (Issue) GetFee added in v0.3.0

func (i Issue) GetFee() uint64

func (Issue) GetSenderPK added in v0.3.0

func (i Issue) GetSenderPK() crypto.PublicKey

func (Issue) GetTimestamp added in v0.3.0

func (i Issue) GetTimestamp() uint64

func (Issue) Valid added in v0.3.0

func (i Issue) Valid() (bool, error)

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"`
	Issue
}

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

NewUnsignedIssueV1 creates new IssueV1 transaction without signature and ID.

func (*IssueV1) BodyMarshalBinary added in v0.3.0

func (tx *IssueV1) BodyMarshalBinary() ([]byte, error)

func (*IssueV1) Clone added in v0.3.0

func (tx *IssueV1) Clone() *IssueV1

func (*IssueV1) GenerateID added in v0.3.0

func (tx *IssueV1) GenerateID()

func (IssueV1) GetID added in v0.2.0

func (tx IssueV1) GetID() ([]byte, error)

func (IssueV1) GetTypeVersion added in v0.3.0

func (tx IssueV1) GetTypeVersion() TransactionTypeVersion

func (*IssueV1) MarshalBinary

func (tx *IssueV1) MarshalBinary() ([]byte, error)

MarshalBinary saves transaction's binary representation to slice of bytes.

func (*IssueV1) Sign

func (tx *IssueV1) Sign(secretKey crypto.SecretKey) error

Sign uses secretKey to sing the transaction.

func (*IssueV1) UnmarshalBinary

func (tx *IssueV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction from its binary representation.

func (*IssueV1) Verify

func (tx *IssueV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature of transaction is a valid signature for given public key.

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"`
	Script  Script          `json:"script"`
	Issue
}

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

NewUnsignedIssueV2 creates a new IssueV2 transaction with empty Proofs.

func (*IssueV2) BodyMarshalBinary added in v0.3.0

func (tx *IssueV2) BodyMarshalBinary() ([]byte, error)

func (*IssueV2) Clone added in v0.3.0

func (tx *IssueV2) Clone() *IssueV2

func (*IssueV2) GenerateID added in v0.3.0

func (tx *IssueV2) GenerateID()

func (IssueV2) GetID added in v0.2.0

func (tx IssueV2) GetID() ([]byte, error)

func (IssueV2) GetTypeVersion added in v0.3.0

func (tx IssueV2) GetTypeVersion() TransactionTypeVersion

func (*IssueV2) MarshalBinary added in v0.1.2

func (tx *IssueV2) MarshalBinary() ([]byte, error)

MarshalBinary converts transaction to its binary representation.

func (*IssueV2) NonEmptyScript added in v0.1.2

func (tx *IssueV2) NonEmptyScript() bool

NonEmptyScript returns true if the script of the transaction is not empty, otherwise false.

func (*IssueV2) Sign added in v0.1.2

func (tx *IssueV2) Sign(secretKey crypto.SecretKey) error

Sign calculates transaction signature using given secret key.

func (*IssueV2) UnmarshalBinary added in v0.1.2

func (tx *IssueV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction from its binary representation.

func (IssueV2) Valid added in v0.3.0

func (tx IssueV2) Valid() (bool, error)

func (*IssueV2) Verify added in v0.1.2

func (tx *IssueV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the transaction signature is valid for given public key.

type KeyPair added in v0.3.0

type KeyPair struct {
	// contains filtered or unexported fields
}

func NewKeyPair added in v0.3.0

func NewKeyPair(seed []byte) KeyPair

func (KeyPair) Addr added in v0.3.0

func (a KeyPair) Addr(scheme byte) (Address, error)

func (KeyPair) Private added in v0.3.0

func (a KeyPair) Private() (crypto.SecretKey, error)

func (KeyPair) Public added in v0.3.0

func (a KeyPair) Public() (crypto.PublicKey, error)

type Lease added in v0.3.0

type Lease struct {
	SenderPK  crypto.PublicKey `json:"senderPublicKey"`
	Recipient Recipient        `json:"recipient"`
	Amount    uint64           `json:"amount"`
	Fee       uint64           `json:"fee"`
	Timestamp uint64           `json:"timestamp,omitempty"`
}

func (Lease) GetFee added in v0.3.0

func (l Lease) GetFee() uint64

func (Lease) GetSenderPK added in v0.3.0

func (l Lease) GetSenderPK() crypto.PublicKey

func (Lease) GetTimestamp added in v0.3.0

func (l Lease) GetTimestamp() uint64

func (Lease) Valid added in v0.3.0

func (l Lease) Valid() (bool, error)

type LeaseCancel added in v0.3.0

type LeaseCancel struct {
	SenderPK  crypto.PublicKey `json:"senderPublicKey"`
	LeaseID   crypto.Digest    `json:"leaseId"`
	Fee       uint64           `json:"fee"`
	Timestamp uint64           `json:"timestamp,omitempty"`
}

func (LeaseCancel) GetFee added in v0.3.0

func (lc LeaseCancel) GetFee() uint64

func (LeaseCancel) GetSenderPK added in v0.3.0

func (lc LeaseCancel) GetSenderPK() crypto.PublicKey

func (LeaseCancel) GetTimestamp added in v0.3.0

func (lc LeaseCancel) GetTimestamp() uint64

func (LeaseCancel) Valid added in v0.3.0

func (lc LeaseCancel) Valid() (bool, error)

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"`
	LeaseCancel
}

LeaseCancelV1 transaction can be used to cancel previously created leasing.

func NewUnsignedLeaseCancelV1

func NewUnsignedLeaseCancelV1(senderPK crypto.PublicKey, leaseID crypto.Digest, fee, timestamp uint64) *LeaseCancelV1

NewUnsignedLeaseCancelV1 creates new LeaseCancelV1 transaction structure without a signature and an ID.

func (*LeaseCancelV1) BodyMarshalBinary added in v0.3.0

func (tx *LeaseCancelV1) BodyMarshalBinary() ([]byte, error)

func (*LeaseCancelV1) Clone added in v0.3.0

func (tx *LeaseCancelV1) Clone() *LeaseCancelV1

func (*LeaseCancelV1) GenerateID added in v0.3.0

func (tx *LeaseCancelV1) GenerateID()

func (LeaseCancelV1) GetID added in v0.2.0

func (tx LeaseCancelV1) GetID() ([]byte, error)

func (LeaseCancelV1) GetTypeVersion added in v0.3.0

func (tx LeaseCancelV1) GetTypeVersion() TransactionTypeVersion

func (*LeaseCancelV1) MarshalBinary

func (tx *LeaseCancelV1) MarshalBinary() ([]byte, error)

MarshalBinary saves transaction to its binary representation.

func (*LeaseCancelV1) Sign

func (tx *LeaseCancelV1) Sign(secretKey crypto.SecretKey) error

func (*LeaseCancelV1) UnmarshalBinary

func (tx *LeaseCancelV1) UnmarshalBinary(data []byte) error

func (*LeaseCancelV1) Verify

func (tx *LeaseCancelV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that signature of the transaction is valid for the given public key.

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"`
	LeaseCancel
}

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

NewUnsignedLeaseCancelV2 creates new LeaseCancelV2 transaction structure without a signature and an ID.

func (*LeaseCancelV2) BodyMarshalBinary added in v0.3.0

func (tx *LeaseCancelV2) BodyMarshalBinary() ([]byte, error)

func (*LeaseCancelV2) Clone added in v0.3.0

func (tx *LeaseCancelV2) Clone() *LeaseCancelV2

func (*LeaseCancelV2) GenerateID added in v0.3.0

func (tx *LeaseCancelV2) GenerateID()

func (LeaseCancelV2) GetID added in v0.2.0

func (tx LeaseCancelV2) GetID() ([]byte, error)

func (LeaseCancelV2) GetTypeVersion added in v0.3.0

func (tx LeaseCancelV2) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary added in v0.1.2

func (tx *LeaseCancelV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the transaction from bytes slice.

func (LeaseCancelV2) Valid added in v0.3.0

func (tx LeaseCancelV2) Valid() (bool, error)

func (*LeaseCancelV2) Verify added in v0.1.2

func (tx *LeaseCancelV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

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"`
	Lease
}

LeaseV1 is a transaction that allows to lease Waves to other account.

func NewUnsignedLeaseV1

func NewUnsignedLeaseV1(senderPK crypto.PublicKey, recipient Recipient, amount, fee, timestamp uint64) *LeaseV1

NewUnsignedLeaseV1 creates new LeaseV1 transaction without signature and ID set.

func (*LeaseV1) BodyMarshalBinary added in v0.3.0

func (tx *LeaseV1) BodyMarshalBinary() ([]byte, error)

func (*LeaseV1) Clone added in v0.3.0

func (tx *LeaseV1) Clone() *LeaseV1

func (*LeaseV1) GenerateID added in v0.3.0

func (tx *LeaseV1) GenerateID()

func (LeaseV1) GetID added in v0.2.0

func (tx LeaseV1) GetID() ([]byte, error)

func (LeaseV1) GetTypeVersion added in v0.3.0

func (tx LeaseV1) GetTypeVersion() TransactionTypeVersion

func (*LeaseV1) MarshalBinary

func (tx *LeaseV1) MarshalBinary() ([]byte, error)

MarshalBinary saves the transaction to its binary representation.

func (*LeaseV1) Sign

func (tx *LeaseV1) Sign(secretKey crypto.SecretKey) error

Sign calculates ID and Signature of the transaction.

func (*LeaseV1) UnmarshalBinary

func (tx *LeaseV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the transaction from bytes slice.

func (*LeaseV1) Verify

func (tx *LeaseV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature of the transaction is valid for the given public key.

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"`
	Lease
}

LeaseV2 is a second version of the LeaseV1 transaction.

func NewUnsignedLeaseV2 added in v0.1.2

func NewUnsignedLeaseV2(senderPK crypto.PublicKey, recipient Recipient, amount, fee, timestamp uint64) *LeaseV2

NewUnsignedLeaseV2 creates new LeaseV1 transaction without signature and ID set.

func (*LeaseV2) BodyMarshalBinary added in v0.3.0

func (tx *LeaseV2) BodyMarshalBinary() ([]byte, error)

func (*LeaseV2) Clone added in v0.3.0

func (tx *LeaseV2) Clone() *LeaseV2

func (*LeaseV2) GenerateID added in v0.3.0

func (tx *LeaseV2) GenerateID()

func (LeaseV2) GetID added in v0.2.0

func (tx LeaseV2) GetID() ([]byte, error)

func (LeaseV2) GetTypeVersion added in v0.3.0

func (tx LeaseV2) GetTypeVersion() TransactionTypeVersion

func (*LeaseV2) MarshalBinary added in v0.1.2

func (tx *LeaseV2) MarshalBinary() ([]byte, error)

MarshalBinary saves the transaction to its binary representation.

func (*LeaseV2) Sign added in v0.1.2

func (tx *LeaseV2) Sign(secretKey crypto.SecretKey) error

Sign adds signature as a proof at first position.

func (*LeaseV2) UnmarshalBinary added in v0.1.2

func (tx *LeaseV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the transaction from bytes slice.

func (*LeaseV2) Verify added in v0.1.2

func (tx *LeaseV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

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

NewUnsignedMassTransferV1 creates new MassTransferV1 transaction structure without signature and ID.

func (*MassTransferV1) BodyMarshalBinary added in v0.3.0

func (tx *MassTransferV1) BodyMarshalBinary() ([]byte, error)

func (*MassTransferV1) Clone added in v0.3.0

func (tx *MassTransferV1) Clone() *MassTransferV1

func (*MassTransferV1) GenerateID added in v0.3.0

func (tx *MassTransferV1) GenerateID()

func (MassTransferV1) GetFee added in v0.3.0

func (tx MassTransferV1) GetFee() uint64

func (MassTransferV1) GetID added in v0.2.0

func (tx MassTransferV1) GetID() ([]byte, error)

func (MassTransferV1) GetSenderPK added in v0.3.0

func (tx MassTransferV1) GetSenderPK() crypto.PublicKey

func (MassTransferV1) GetTimestamp added in v0.3.0

func (tx MassTransferV1) GetTimestamp() uint64

func (MassTransferV1) GetTypeVersion added in v0.3.0

func (tx MassTransferV1) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary

func (tx *MassTransferV1) UnmarshalBinary(data []byte) error

UnmarshalBinary loads transaction from its binary representation.

func (MassTransferV1) Valid added in v0.3.0

func (tx MassTransferV1) Valid() (bool, error)

func (*MassTransferV1) Verify

func (tx *MassTransferV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature is valid for the given public key.

type Message added in v0.3.0

func UnmarshalMessage added in v0.3.0

func UnmarshalMessage(b []byte) (Message, error)

UnmarshalMessage tries unmarshal bytes to proper type

type MicroBlock added in v0.3.0

type MicroBlock struct {
	VersionField          byte
	PrevResBlockSigField  crypto.Signature
	TotalResBlockSigField crypto.Signature
	TransactionCount      uint32
	Transactions          *TransactionsRepresentation
	SenderPK              crypto.PublicKey
	Signature             crypto.Signature
}

func (*MicroBlock) Sign added in v0.3.0

func (a *MicroBlock) Sign(secret crypto.SecretKey) error

func (*MicroBlock) UnmarshalBinary added in v0.3.0

func (a *MicroBlock) UnmarshalBinary(b []byte) error

func (*MicroBlock) VerifySignature added in v0.3.0

func (a *MicroBlock) VerifySignature() (bool, error)

func (*MicroBlock) WriteTo added in v0.3.0

func (a *MicroBlock) WriteTo(w io.Writer) (int64, error)

func (*MicroBlock) WriteWithoutSignature added in v0.3.0

func (a *MicroBlock) WriteWithoutSignature(w io.Writer) (int64, error)

type MicroBlockInv added in v0.3.0

type MicroBlockInv struct {
	PublicKey     crypto.PublicKey
	TotalBlockSig crypto.Signature
	PrevBlockSig  crypto.Signature
	Signature     crypto.Signature
}

func NewUnsignedMicroblockInv added in v0.3.0

func NewUnsignedMicroblockInv(
	PublicKey crypto.PublicKey,
	TotalBlockSig crypto.Signature,
	PrevBlockSig crypto.Signature) *MicroBlockInv

func (*MicroBlockInv) MarshalBinary added in v0.3.0

func (a *MicroBlockInv) MarshalBinary() ([]byte, error)

func (*MicroBlockInv) Sign added in v0.3.0

func (a *MicroBlockInv) Sign(key crypto.SecretKey, schema Scheme) error

func (*MicroBlockInv) UnmarshalBinary added in v0.3.0

func (a *MicroBlockInv) UnmarshalBinary(data []byte) error

func (*MicroBlockInv) Verify added in v0.3.0

func (a *MicroBlockInv) Verify(schema Scheme) (bool, error)

func (*MicroBlockInv) WriteTo added in v0.3.0

func (a *MicroBlockInv) WriteTo(w io.Writer) (int64, error)

type MicroBlockInvMessage added in v0.3.0

type MicroBlockInvMessage struct {
	Body []byte
}

func (*MicroBlockInvMessage) MarshalBinary added in v0.3.0

func (a *MicroBlockInvMessage) MarshalBinary() ([]byte, error)

func (*MicroBlockInvMessage) ReadFrom added in v0.3.0

func (a *MicroBlockInvMessage) ReadFrom(r io.Reader) (n int64, err error)

func (*MicroBlockInvMessage) UnmarshalBinary added in v0.3.0

func (a *MicroBlockInvMessage) UnmarshalBinary(data []byte) error

func (*MicroBlockInvMessage) WriteTo added in v0.3.0

func (a *MicroBlockInvMessage) WriteTo(w io.Writer) (n int64, err error)

type MicroBlockMessage added in v0.3.0

type MicroBlockMessage struct {
	Body io.WriterTo
}

CheckPointMessage represents a CheckPoint message

func (*MicroBlockMessage) MarshalBinary added in v0.3.0

func (a *MicroBlockMessage) MarshalBinary() ([]byte, error)

func (*MicroBlockMessage) ReadFrom added in v0.3.0

func (*MicroBlockMessage) ReadFrom(r io.Reader) (int64, error)

func (*MicroBlockMessage) UnmarshalBinary added in v0.3.0

func (a *MicroBlockMessage) UnmarshalBinary(data []byte) error

func (*MicroBlockMessage) WriteTo added in v0.3.0

func (a *MicroBlockMessage) WriteTo(w io.Writer) (int64, error)

type MicroBlockRequest added in v0.3.0

type MicroBlockRequest struct {
	TotalBlockSig crypto.Signature
}

func (*MicroBlockRequest) MarshalBinary added in v0.3.0

func (a *MicroBlockRequest) MarshalBinary() ([]byte, error)

func (*MicroBlockRequest) ReadFrom added in v0.3.0

func (a *MicroBlockRequest) ReadFrom(r io.Reader) (int64, error)

func (*MicroBlockRequest) UnmarshalBinary added in v0.3.0

func (a *MicroBlockRequest) UnmarshalBinary(data []byte) error

func (*MicroBlockRequest) WriteTo added in v0.3.0

func (a *MicroBlockRequest) WriteTo(w io.Writer) (int64, error)

type MicroBlockRequestMessage added in v0.3.0

type MicroBlockRequestMessage struct {
	Body io.WriterTo
}

func (*MicroBlockRequestMessage) MarshalBinary added in v0.3.0

func (a *MicroBlockRequestMessage) MarshalBinary() ([]byte, error)

func (*MicroBlockRequestMessage) ReadFrom added in v0.3.0

func (a *MicroBlockRequestMessage) ReadFrom(r io.Reader) (n int64, err error)

func (*MicroBlockRequestMessage) UnmarshalBinary added in v0.3.0

func (a *MicroBlockRequestMessage) UnmarshalBinary(data []byte) error

func (*MicroBlockRequestMessage) WriteTo added in v0.3.0

func (a *MicroBlockRequestMessage) WriteTo(w io.Writer) (int64, error)

type MicroblockTotalSig added in v0.3.0

type MicroblockTotalSig = crypto.Signature

type NxtConsensus added in v0.3.0

type NxtConsensus struct {
	BaseTarget   uint64        `json:"base-target"`
	GenSignature crypto.Digest `json:"generation-signature"`
}

type OptionalAsset

type OptionalAsset struct {
	Present bool
	ID      crypto.Digest
}

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

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) Serialize added in v0.3.0

func (a OptionalAsset) Serialize(s *serializer.Serializer) error

Serialize into binary representation.

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

func (OptionalAsset) WriteTo added in v0.3.0

func (a OptionalAsset) WriteTo(w io.Writer) (int64, error)

WriteTo writes its binary representation.

type Order

type Order interface {
	GetID() ([]byte, error)
	GetVersion() byte
	GetOrderType() OrderType
	GetMatcherPK() crypto.PublicKey
	GetAssetPair() AssetPair
	GetPrice() uint64
	GetExpiration() uint64
	Valid() (bool, error)
	GetAmount() uint64
	GetTimestamp() uint64
	GetMatcherFee() uint64
	GetMatcherFeeAsset() OptionalAsset
	GetSenderPK() crypto.PublicKey
	BodyMarshalBinary() ([]byte, error)
	GetProofs() (*ProofsV1, error)
	Verify(crypto.PublicKey) (bool, error)
}

type OrderBody added in v0.3.0

type OrderBody struct {
	SenderPK   crypto.PublicKey `json:"senderPublicKey"`
	MatcherPK  crypto.PublicKey `json:"matcherPublicKey"`
	AssetPair  AssetPair        `json:"assetPair"`
	OrderType  OrderType        `json:"orderType"`
	Price      uint64           `json:"price"`
	Amount     uint64           `json:"amount"`
	Timestamp  uint64           `json:"timestamp"`
	Expiration uint64           `json:"expiration"`
	MatcherFee uint64           `json:"matcherFee"`
}

func OrderToOrderBody added in v0.3.0

func OrderToOrderBody(o Order) (OrderBody, error)

func (OrderBody) GetSenderPK added in v0.3.0

func (o OrderBody) GetSenderPK() crypto.PublicKey

func (*OrderBody) ReceiveAmount added in v0.3.0

func (o *OrderBody) ReceiveAmount(matchAmount, matchPrice uint64) (uint64, error)

func (*OrderBody) Serialize added in v0.3.0

func (o *OrderBody) Serialize(s *serializer.Serializer) error

func (*OrderBody) SpendAmount added in v0.3.0

func (o *OrderBody) SpendAmount(matchAmount, matchPrice uint64) (uint64, error)

func (*OrderBody) SpendAsset added in v0.3.0

func (o *OrderBody) SpendAsset() OptionalAsset

func (OrderBody) Valid added in v0.3.0

func (o OrderBody) Valid() (bool, error)

type OrderType

type OrderType byte

OrderType an alias for byte that encodes the type of OrderV1 (BUY|SELL).

const (
	Buy OrderType = iota
	Sell
)

iota: reset

func (OrderType) MarshalJSON

func (o OrderType) MarshalJSON() ([]byte, error)

MarshalJSON writes value of OrderType to JSON representation.

func (OrderType) String

func (o OrderType) String() string

func (*OrderType) UnmarshalJSON

func (o *OrderType) UnmarshalJSON(value []byte) error

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"`
	OrderBody
}

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

NewUnsignedOrderV1 creates the new unsigned order.

func (OrderV1) BodyMarshalBinary added in v0.3.0

func (o OrderV1) BodyMarshalBinary() ([]byte, error)

func (OrderV1) BodySerialize added in v0.3.0

func (o OrderV1) BodySerialize(s *serializer.Serializer) error

func (OrderV1) GetAmount added in v0.3.0

func (o OrderV1) GetAmount() uint64

func (*OrderV1) GetAssetPair added in v0.3.0

func (o *OrderV1) GetAssetPair() AssetPair

func (*OrderV1) GetExpiration added in v0.3.0

func (o *OrderV1) GetExpiration() uint64

func (OrderV1) GetID added in v0.3.0

func (o OrderV1) GetID() ([]byte, error)

func (OrderV1) GetMatcherFee added in v0.3.0

func (o OrderV1) GetMatcherFee() uint64

func (OrderV1) GetMatcherFeeAsset added in v0.3.0

func (o OrderV1) GetMatcherFeeAsset() OptionalAsset

func (*OrderV1) GetMatcherPK added in v0.1.2

func (o *OrderV1) GetMatcherPK() crypto.PublicKey

func (*OrderV1) GetOrderType added in v0.1.2

func (o *OrderV1) GetOrderType() OrderType

func (*OrderV1) GetPrice added in v0.3.0

func (o *OrderV1) GetPrice() uint64

func (OrderV1) GetProofs added in v0.3.0

func (o OrderV1) GetProofs() (*ProofsV1, error)

func (OrderV1) GetTimestamp added in v0.3.0

func (o OrderV1) GetTimestamp() uint64

func (*OrderV1) GetVersion added in v0.1.2

func (o *OrderV1) GetVersion() byte

func (*OrderV1) MarshalBinary added in v0.1.2

func (o *OrderV1) MarshalBinary() ([]byte, error)

MarshalBinary writes order to its bytes representation.

func (*OrderV1) Serialize added in v0.3.0

func (o *OrderV1) Serialize(s *serializer.Serializer) error

Serialize order to its bytes representation.

func (*OrderV1) Sign added in v0.1.2

func (o *OrderV1) Sign(secretKey crypto.SecretKey) error

Sign adds a signature to the order.

func (*OrderV1) UnmarshalBinary added in v0.1.2

func (o *OrderV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads an order from its binary representation.

func (*OrderV1) Verify added in v0.1.2

func (o *OrderV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the order's signature is valid.

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"`
	OrderBody
}

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

NewUnsignedOrderV2 creates the new unsigned order.

func (OrderV2) BodyMarshalBinary added in v0.3.0

func (o OrderV2) BodyMarshalBinary() ([]byte, error)

func (OrderV2) GetAmount added in v0.3.0

func (o OrderV2) GetAmount() uint64

func (*OrderV2) GetAssetPair added in v0.3.0

func (o *OrderV2) GetAssetPair() AssetPair

func (*OrderV2) GetExpiration added in v0.3.0

func (o *OrderV2) GetExpiration() uint64

func (OrderV2) GetID added in v0.3.0

func (o OrderV2) GetID() ([]byte, error)

func (OrderV2) GetMatcherFee added in v0.3.0

func (o OrderV2) GetMatcherFee() uint64

func (OrderV2) GetMatcherFeeAsset added in v0.3.0

func (o OrderV2) GetMatcherFeeAsset() OptionalAsset

func (*OrderV2) GetMatcherPK added in v0.1.2

func (o *OrderV2) GetMatcherPK() crypto.PublicKey

func (*OrderV2) GetOrderType added in v0.1.2

func (o *OrderV2) GetOrderType() OrderType

func (*OrderV2) GetPrice added in v0.3.0

func (o *OrderV2) GetPrice() uint64

func (OrderV2) GetProofs added in v0.3.0

func (o OrderV2) GetProofs() (*ProofsV1, error)

func (OrderV2) GetTimestamp added in v0.3.0

func (o OrderV2) GetTimestamp() uint64

func (*OrderV2) GetVersion added in v0.1.2

func (o *OrderV2) GetVersion() byte

func (*OrderV2) MarshalBinary added in v0.1.2

func (o *OrderV2) MarshalBinary() ([]byte, error)

MarshalBinary writes order to its bytes representation.

func (*OrderV2) Sign added in v0.1.2

func (o *OrderV2) Sign(secretKey crypto.SecretKey) error

Sign adds a signature to the order.

func (*OrderV2) UnmarshalBinary added in v0.1.2

func (o *OrderV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads an order from its binary representation.

func (*OrderV2) Verify added in v0.1.2

func (o *OrderV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the order's signature is valid.

type OrderV3 added in v0.3.0

type OrderV3 struct {
	Version         byte           `json:"version"`
	ID              *crypto.Digest `json:"id,omitempty"`
	Proofs          *ProofsV1      `json:"proofs,omitempty"`
	MatcherFeeAsset OptionalAsset  `json:"matcherFeeAssetId"`
	OrderBody
}

OrderV3 is an order that supports matcher's fee in assets.

func NewUnsignedOrderV3 added in v0.3.0

func NewUnsignedOrderV3(senderPK, matcherPK crypto.PublicKey, amountAsset, priceAsset OptionalAsset, orderType OrderType, price, amount, timestamp, expiration, matcherFee uint64, matcherFeeAsset OptionalAsset) *OrderV3

NewUnsignedOrderV3 creates the new unsigned order.

func (*OrderV3) BodyMarshalBinary added in v0.3.0

func (o *OrderV3) BodyMarshalBinary() ([]byte, error)

func (OrderV3) GetAmount added in v0.3.0

func (o OrderV3) GetAmount() uint64

func (*OrderV3) GetAssetPair added in v0.3.0

func (o *OrderV3) GetAssetPair() AssetPair

func (*OrderV3) GetExpiration added in v0.3.0

func (o *OrderV3) GetExpiration() uint64

func (*OrderV3) GetID added in v0.3.0

func (o *OrderV3) GetID() ([]byte, error)

func (OrderV3) GetMatcherFee added in v0.3.0

func (o OrderV3) GetMatcherFee() uint64

func (OrderV3) GetMatcherFeeAsset added in v0.3.0

func (o OrderV3) GetMatcherFeeAsset() OptionalAsset

func (*OrderV3) GetMatcherPK added in v0.3.0

func (o *OrderV3) GetMatcherPK() crypto.PublicKey

func (*OrderV3) GetOrderType added in v0.3.0

func (o *OrderV3) GetOrderType() OrderType

func (*OrderV3) GetPrice added in v0.3.0

func (o *OrderV3) GetPrice() uint64

func (OrderV3) GetProofs added in v0.3.0

func (o OrderV3) GetProofs() (*ProofsV1, error)

func (OrderV3) GetTimestamp added in v0.3.0

func (o OrderV3) GetTimestamp() uint64

func (*OrderV3) GetVersion added in v0.3.0

func (o *OrderV3) GetVersion() byte

func (*OrderV3) MarshalBinary added in v0.3.0

func (o *OrderV3) MarshalBinary() ([]byte, error)

MarshalBinary writes order to its bytes representation.

func (*OrderV3) Sign added in v0.3.0

func (o *OrderV3) Sign(secretKey crypto.SecretKey) error

Sign adds a signature to the order.

func (*OrderV3) UnmarshalBinary added in v0.3.0

func (o *OrderV3) UnmarshalBinary(data []byte) error

UnmarshalBinary reads an order from its binary representation.

func (*OrderV3) Verify added in v0.3.0

func (o *OrderV3) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the order's signature is valid.

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

NewUnsignedPayment creates new Payment transaction with empty Signature and ID fields.

func (*Payment) BodyMarshalBinary added in v0.3.0

func (tx *Payment) BodyMarshalBinary() ([]byte, error)

func (*Payment) GenerateID added in v0.3.0

func (tx *Payment) GenerateID()

func (Payment) GetFee added in v0.3.0

func (tx Payment) GetFee() uint64

func (Payment) GetID added in v0.2.0

func (tx Payment) GetID() ([]byte, error)

func (Payment) GetSenderPK added in v0.3.0

func (tx Payment) GetSenderPK() crypto.PublicKey

func (Payment) GetTimestamp added in v0.3.0

func (tx Payment) GetTimestamp() uint64

func (Payment) GetTypeVersion added in v0.3.0

func (tx Payment) GetTypeVersion() TransactionTypeVersion

func (*Payment) MarshalBinary

func (tx *Payment) MarshalBinary() ([]byte, error)

MarshalBinary returns a bytes representation of Payment transaction.

func (*Payment) MarshalBinary2 added in v0.3.0

func (tx *Payment) MarshalBinary2(buf []byte) ([]byte, error)

MarshalBinary returns a bytes representation of Payment transaction.

func (*Payment) Sign

func (tx *Payment) Sign(secretKey crypto.SecretKey) error

Sign calculates transaction signature and set it as an ID.

func (*Payment) UnmarshalBinary

func (tx *Payment) UnmarshalBinary(data []byte) error

UnmarshalBinary reads Payment transaction from its binary representation.

func (Payment) Valid added in v0.3.0

func (tx Payment) Valid() (bool, error)

func (*Payment) Verify

func (tx *Payment) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the Signature is valid for given public key.

type PeerInfo

type PeerInfo struct {
	Addr net.IP
	Port uint16
}

PeerInfo represents the address of a single peer

func NewPeerInfoFromString added in v0.3.0

func NewPeerInfoFromString(addr string) (PeerInfo, error)

func (*PeerInfo) Empty added in v0.3.0

func (m *PeerInfo) Empty() bool

func (*PeerInfo) MarshalBinary

func (m *PeerInfo) MarshalBinary() ([]byte, error)

MarshalBinary encodes PeerInfo message to binary form

func (PeerInfo) MarshalJSON

func (m PeerInfo) MarshalJSON() ([]byte, error)

MarshalJSON writes PeerInfo Value as JSON string

func (*PeerInfo) ReadFrom added in v0.3.0

func (a *PeerInfo) ReadFrom(r io.Reader) (int64, error)

func (PeerInfo) String added in v0.2.0

func (m PeerInfo) String() string

String() implements Stringer interface for PeerInfo

func (*PeerInfo) UnmarshalBinary

func (m *PeerInfo) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes PeerInfo message from binary form

func (*PeerInfo) UnmarshalJSON

func (m *PeerInfo) UnmarshalJSON(value []byte) error

UnmarshalJSON reads PeerInfo from JSON string

func (PeerInfo) WriteTo added in v0.3.0

func (a PeerInfo) WriteTo(w io.Writer) (int64, error)

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

func (*PeersMessage) WriteTo

func (m *PeersMessage) WriteTo(w io.Writer) (int64, error)

type ProofsV1

type ProofsV1 struct {
	Version byte
	Proofs  []B58Bytes
}

ProofsV1 is a collection of proofs.

func NewProofs added in v0.3.0

func NewProofs() *ProofsV1

func (*ProofsV1) MarshalBinary

func (p *ProofsV1) MarshalBinary() ([]byte, error)

MarshalBinary writes the proofs to its binary form.

func (ProofsV1) MarshalJSON

func (p ProofsV1) MarshalJSON() ([]byte, error)

MarshalJSON writes the proofs to JSON.

func (*ProofsV1) Serialize added in v0.3.0

func (p *ProofsV1) Serialize(s *serializer.Serializer) error

Serialize proofs to its binary form.

func (*ProofsV1) Sign

func (p *ProofsV1) Sign(pos int, key crypto.SecretKey, data []byte) error

Sign creates a signature and stores it as a proof at given position.

func (ProofsV1) String

func (p ProofsV1) String() string

String gives a string representation of the proofs collection.

func (*ProofsV1) UnmarshalBinary

func (p *ProofsV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the proofs from its binary representation.

func (*ProofsV1) UnmarshalJSON

func (p *ProofsV1) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the proofs from JSON.

func (*ProofsV1) Verify

func (p *ProofsV1) Verify(pos int, key crypto.PublicKey, data []byte) (bool, error)

Verify checks that the proof at given position is a valid signature.

type Recipient added in v0.2.0

type Recipient struct {
	Address *Address
	Alias   *Alias
	// contains filtered or unexported fields
}

Recipient could be an Alias or an Address.

func NewRecipientFromAddress added in v0.2.0

func NewRecipientFromAddress(a Address) Recipient

NewRecipientFromAddress creates the Recipient from given address.

func NewRecipientFromAlias added in v0.2.0

func NewRecipientFromAlias(a Alias) Recipient

NewRecipientFromAlias creates a Recipient with the given Alias inside.

func NewRecipientFromString added in v0.3.0

func NewRecipientFromString(s string) (Recipient, error)

func (*Recipient) MarshalBinary added in v0.2.0

func (r *Recipient) MarshalBinary() ([]byte, error)

MarshalBinary makes bytes of the Recipient.

func (Recipient) MarshalJSON added in v0.2.0

func (r Recipient) MarshalJSON() ([]byte, error)

MarshalJSON converts the Recipient to its JSON representation.

func (*Recipient) Serialize added in v0.3.0

func (r *Recipient) Serialize(s *serializer.Serializer) error

func (*Recipient) String added in v0.2.0

func (r *Recipient) String() string

String gives the string representation of the Recipient.

func (*Recipient) UnmarshalBinary added in v0.2.0

func (r *Recipient) UnmarshalBinary(data []byte) error

UnmarshalBinary reads the Recipient from bytes. Validates the result.

func (*Recipient) UnmarshalJSON added in v0.2.0

func (r *Recipient) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the Recipient from its JSON representation.

func (Recipient) Valid added in v0.3.0

func (r Recipient) Valid() (bool, error)

Valid checks that either an Address or an Alias is set then checks the validity of the set field.

func (*Recipient) WriteTo added in v0.3.0

func (r *Recipient) WriteTo(w io.Writer) (int64, error)

type Reissue added in v0.3.0

type Reissue struct {
	SenderPK   crypto.PublicKey `json:"senderPublicKey"`
	AssetID    crypto.Digest    `json:"assetId"`
	Quantity   uint64           `json:"quantity"`
	Reissuable bool             `json:"reissuable"`
	Timestamp  uint64           `json:"timestamp,omitempty"`
	Fee        uint64           `json:"fee"`
}

func (Reissue) GetFee added in v0.3.0

func (r Reissue) GetFee() uint64

func (Reissue) GetSenderPK added in v0.3.0

func (r Reissue) GetSenderPK() crypto.PublicKey

func (Reissue) GetTimestamp added in v0.3.0

func (r Reissue) GetTimestamp() uint64

func (Reissue) Valid added in v0.3.0

func (r Reissue) Valid() (bool, error)

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"`
	Reissue
}

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

NewUnsignedReissueV1 creates new ReissueV1 transaction without signature and ID.

func (*ReissueV1) BodyMarshalBinary added in v0.3.0

func (tx *ReissueV1) BodyMarshalBinary() ([]byte, error)

func (*ReissueV1) Clone added in v0.3.0

func (tx *ReissueV1) Clone() *ReissueV1

func (*ReissueV1) GenerateID added in v0.3.0

func (tx *ReissueV1) GenerateID()

func (ReissueV1) GetID added in v0.2.0

func (tx ReissueV1) GetID() ([]byte, error)

func (ReissueV1) GetTypeVersion added in v0.3.0

func (tx ReissueV1) GetTypeVersion() TransactionTypeVersion

func (*ReissueV1) MarshalBinary

func (tx *ReissueV1) MarshalBinary() ([]byte, error)

MarshalBinary saves the transaction to its binary representation.

func (*ReissueV1) Sign

func (tx *ReissueV1) Sign(secretKey crypto.SecretKey) error

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) UnmarshalBinary

func (tx *ReissueV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction from its binary representation.

func (*ReissueV1) Verify

func (tx *ReissueV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that the signature of the transaction is valid for given public key.

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"`
	Reissue
}

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

NewUnsignedReissueV2 creates new ReissueV2 transaction without signature and ID.

func (*ReissueV2) BodyMarshalBinary added in v0.3.0

func (tx *ReissueV2) BodyMarshalBinary() ([]byte, error)

func (*ReissueV2) Clone added in v0.3.0

func (tx *ReissueV2) Clone() *ReissueV2

func (*ReissueV2) GenerateID added in v0.3.0

func (tx *ReissueV2) GenerateID()

func (ReissueV2) GetID added in v0.2.0

func (tx ReissueV2) GetID() ([]byte, error)

func (ReissueV2) GetTypeVersion added in v0.3.0

func (tx ReissueV2) GetTypeVersion() TransactionTypeVersion

func (*ReissueV2) MarshalBinary added in v0.1.2

func (tx *ReissueV2) MarshalBinary() ([]byte, error)

MarshalBinary writes ReissueV2 transaction to its bytes representation.

func (*ReissueV2) Sign added in v0.1.2

func (tx *ReissueV2) Sign(secretKey crypto.SecretKey) error

Sign adds signature as a proof at first position.

func (*ReissueV2) UnmarshalBinary added in v0.1.2

func (tx *ReissueV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads ReissueV2 from its bytes representation.

func (ReissueV2) Valid added in v0.3.0

func (tx ReissueV2) Valid() (bool, error)

func (*ReissueV2) Verify added in v0.1.2

func (tx *ReissueV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type Scheme added in v0.3.0

type Scheme = byte

type Score added in v0.3.0

type Score = big.Int

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

func (*ScoreMessage) WriteTo

func (m *ScoreMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes ScoreMessage to io.Writer

type Script

type Script []byte

func (Script) MarshalJSON added in v0.2.0

func (s Script) MarshalJSON() ([]byte, error)

MarshalJSON writes Script as JSON

func (Script) String added in v0.2.0

func (s Script) String() string

String gives a string representation of Script bytes, script bytes encoded as BASE64 with prefix

func (*Script) UnmarshalJSON added in v0.2.0

func (s *Script) UnmarshalJSON(value []byte) error

UnmarshalJSON reads Script from it's JSON representation

type ScriptPayment added in v0.3.0

type ScriptPayment struct {
	Amount uint64        `json:"amount"`
	Asset  OptionalAsset `json:"assetId"`
}

func (ScriptPayment) MarshalBinary added in v0.3.0

func (p ScriptPayment) MarshalBinary() ([]byte, error)

func (ScriptPayment) Serialize added in v0.3.0

func (p ScriptPayment) Serialize(s *serializer.Serializer) error

func (*ScriptPayment) UnmarshalBinary added in v0.3.0

func (p *ScriptPayment) UnmarshalBinary(data []byte) error

type ScriptPayments added in v0.3.0

type ScriptPayments []ScriptPayment

func (*ScriptPayments) Append added in v0.3.0

func (sps *ScriptPayments) Append(sp ScriptPayment)

func (ScriptPayments) MarshalBinary added in v0.3.0

func (sps ScriptPayments) MarshalBinary() ([]byte, error)

func (ScriptPayments) Serialize added in v0.3.0

func (sps ScriptPayments) Serialize(s *serializer.Serializer) error

func (*ScriptPayments) UnmarshalBinary added in v0.3.0

func (sps *ScriptPayments) UnmarshalBinary(data []byte) error

type ScriptResult added in v0.3.0

type ScriptResult struct {
	Transfers TransferSet
	Writes    WriteSet
}

func (*ScriptResult) Valid added in v0.3.0

func (sr *ScriptResult) Valid() error

type ScriptResultTransfer added in v0.3.0

type ScriptResultTransfer struct {
	Recipient Recipient
	Amount    int64
	Asset     OptionalAsset
}

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

NewUnsignedSetAssetScriptV1 creates new unsigned SetAssetScriptV1 transaction.

func (*SetAssetScriptV1) BodyMarshalBinary added in v0.3.0

func (tx *SetAssetScriptV1) BodyMarshalBinary() ([]byte, error)

func (*SetAssetScriptV1) Clone added in v0.3.0

func (tx *SetAssetScriptV1) Clone() *SetAssetScriptV1

func (*SetAssetScriptV1) GenerateID added in v0.3.0

func (tx *SetAssetScriptV1) GenerateID()

func (SetAssetScriptV1) GetFee added in v0.3.0

func (tx SetAssetScriptV1) GetFee() uint64

func (SetAssetScriptV1) GetID added in v0.2.0

func (tx SetAssetScriptV1) GetID() ([]byte, error)

func (SetAssetScriptV1) GetSenderPK added in v0.3.0

func (tx SetAssetScriptV1) GetSenderPK() crypto.PublicKey

func (SetAssetScriptV1) GetTimestamp added in v0.3.0

func (tx SetAssetScriptV1) GetTimestamp() uint64

func (SetAssetScriptV1) GetTypeVersion added in v0.3.0

func (tx SetAssetScriptV1) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary added in v0.2.0

func (tx *SetAssetScriptV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads SetAssetScriptV1 transaction from its binary representation.

func (SetAssetScriptV1) Valid added in v0.3.0

func (tx SetAssetScriptV1) Valid() (bool, error)

func (*SetAssetScriptV1) Verify added in v0.2.0

func (tx *SetAssetScriptV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

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

NewUnsignedSetScriptV1 creates new unsigned SetScriptV1 transaction.

func (*SetScriptV1) BodyMarshalBinary added in v0.3.0

func (tx *SetScriptV1) BodyMarshalBinary() ([]byte, error)

func (*SetScriptV1) GenerateID added in v0.3.0

func (tx *SetScriptV1) GenerateID()

func (SetScriptV1) GetFee added in v0.3.0

func (tx SetScriptV1) GetFee() uint64

func (SetScriptV1) GetID added in v0.2.0

func (tx SetScriptV1) GetID() ([]byte, error)

func (SetScriptV1) GetSenderPK added in v0.3.0

func (tx SetScriptV1) GetSenderPK() crypto.PublicKey

func (SetScriptV1) GetTimestamp added in v0.3.0

func (tx SetScriptV1) GetTimestamp() uint64

func (SetScriptV1) GetTypeVersion added in v0.3.0

func (tx SetScriptV1) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary

func (tx *SetScriptV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads SetScriptV1 transaction from its binary representation.

func (SetScriptV1) Valid added in v0.3.0

func (tx SetScriptV1) Valid() (bool, error)

func (*SetScriptV1) Verify

func (tx *SetScriptV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type SignaturesMessage

type SignaturesMessage struct {
	Signatures []crypto.Signature
}

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

func (*SignaturesMessage) WriteTo

func (m *SignaturesMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes SignaturesMessage to 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

NewUnsignedSponsorshipV1 creates new unsigned SponsorshipV1 transaction

func (*SponsorshipV1) BodyMarshalBinary added in v0.3.0

func (tx *SponsorshipV1) BodyMarshalBinary() ([]byte, error)

func (*SponsorshipV1) Clone added in v0.3.0

func (tx *SponsorshipV1) Clone() *SponsorshipV1

func (*SponsorshipV1) GenerateID added in v0.3.0

func (tx *SponsorshipV1) GenerateID()

func (SponsorshipV1) GetFee added in v0.3.0

func (tx SponsorshipV1) GetFee() uint64

func (SponsorshipV1) GetID added in v0.2.0

func (tx SponsorshipV1) GetID() ([]byte, error)

func (SponsorshipV1) GetSenderPK added in v0.3.0

func (tx SponsorshipV1) GetSenderPK() crypto.PublicKey

func (SponsorshipV1) GetTimestamp added in v0.3.0

func (tx SponsorshipV1) GetTimestamp() uint64

func (SponsorshipV1) GetTypeVersion added in v0.3.0

func (tx SponsorshipV1) GetTypeVersion() TransactionTypeVersion

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) UnmarshalBinary

func (tx *SponsorshipV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads SponsorshipV1 from its bytes representation.

func (SponsorshipV1) Valid added in v0.3.0

func (tx SponsorshipV1) Valid() (bool, error)

func (*SponsorshipV1) Verify

func (tx *SponsorshipV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type StringArgument added in v0.3.0

type StringArgument struct {
	Value string
}

StringArgument structure is an argument that store a string value.

func NewStringArgument added in v0.3.0

func NewStringArgument(s string) *StringArgument

func (StringArgument) GetValueType added in v0.3.0

func (a StringArgument) GetValueType() ArgumentValueType

GetValueType returns the type of value of the argument.

func (StringArgument) MarshalBinary added in v0.3.0

func (a StringArgument) MarshalBinary() ([]byte, error)

MarshalBinary converts the argument to its byte representation.

func (StringArgument) MarshalJSON added in v0.3.0

func (a StringArgument) MarshalJSON() ([]byte, error)

MarshalJSON writes the entry to its JSON representation.

func (StringArgument) Serialize added in v0.3.0

func (a StringArgument) Serialize(s *serializer.Serializer) error

Serialize argument to its byte representation.

func (*StringArgument) UnmarshalBinary added in v0.3.0

func (a *StringArgument) UnmarshalBinary(data []byte) error

UnmarshalBinary reads an StringArgument structure from bytes.

func (*StringArgument) UnmarshalJSON added in v0.3.0

func (a *StringArgument) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the entry from JSON.

type StringDataEntry

type StringDataEntry struct {
	Key   string
	Value string
}

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() DataValueType

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) MarshalValue added in v0.3.0

func (e StringDataEntry) MarshalValue() ([]byte, error)

MarshalValue converts the data entry value to its byte representation.

func (*StringDataEntry) SetKey added in v0.3.0

func (e *StringDataEntry) SetKey(key string)

SetKey sets the key of data entry.

func (*StringDataEntry) UnmarshalBinary

func (e *StringDataEntry) UnmarshalBinary(data []byte) error

UnmarshalBinary reads StringDataEntry structure from bytes.

func (*StringDataEntry) UnmarshalJSON

func (e *StringDataEntry) UnmarshalJSON(value []byte) error

UnmarshalJSON reads the entry from JSON.

func (*StringDataEntry) UnmarshalValue added in v0.3.0

func (e *StringDataEntry) UnmarshalValue(data []byte) error

UnmarshalValue reads StringDataEntry value from bytes.

func (StringDataEntry) Valid added in v0.3.0

func (e StringDataEntry) Valid() (bool, error)

type TCPAddr added in v0.3.0

type TCPAddr net.TCPAddr

func NewTCPAddr added in v0.3.0

func NewTCPAddr(ip net.IP, port int) TCPAddr

func NewTCPAddrFromString added in v0.3.0

func NewTCPAddrFromString(s string) TCPAddr

func (TCPAddr) Empty added in v0.3.0

func (a TCPAddr) Empty() bool

func (TCPAddr) String added in v0.3.0

func (a TCPAddr) String() string

func (TCPAddr) ToIpPort added in v0.3.0

func (a TCPAddr) ToIpPort() IpPort

func (TCPAddr) WriteTo added in v0.3.0

func (a TCPAddr) WriteTo(w io.Writer) (int64, error)

type Timestamp added in v0.3.0

type Timestamp = uint64

type Transaction added in v0.1.2

type Transaction interface {
	GetTypeVersion() TransactionTypeVersion
	GetID() ([]byte, error)
	GetSenderPK() crypto.PublicKey
	Valid() (bool, error)
	MarshalBinary() ([]byte, error)
	UnmarshalBinary([]byte) error
	GetFee() uint64
	GetTimestamp() uint64
	GenerateID()
}

Transaction is a set of common transaction functions.

func BytesToTransaction added in v0.2.0

func BytesToTransaction(tx []byte) (Transaction, error)

func BytesToTransactions added in v0.3.0

func BytesToTransactions(count int, txs []byte) ([]Transaction, error)

func GuessTransactionType added in v0.3.0

func GuessTransactionType(t *TransactionTypeVersion) (Transaction, error)

Guess transaction from type and version

type TransactionMessage

type TransactionMessage struct {
	Transaction []byte
}

TransactionMessage represents TransactionsSend 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

func (*TransactionMessage) WriteTo

func (m *TransactionMessage) WriteTo(w io.Writer) (int64, error)

WriteTo writes TransactionMessage to io.Writer

type TransactionType

type TransactionType byte

TransactionType

const (
	GenesisTransaction        TransactionType = iota + 1 // 1 - Genesis transaction
	PaymentTransaction                                   // 2 - Payment transaction
	IssueTransaction                                     // 3 - Issue transaction
	TransferTransaction                                  // 4 - Transfer transaction
	ReissueTransaction                                   // 5 - Reissue transaction
	BurnTransaction                                      // 6 - Burn transaction
	ExchangeTransaction                                  // 7 - Exchange transaction
	LeaseTransaction                                     // 8 - Lease transaction
	LeaseCancelTransaction                               // 9 - LeaseCancel transaction
	CreateAliasTransaction                               // 10 - CreateAlias transaction
	MassTransferTransaction                              // 11 - MassTransfer transaction
	DataTransaction                                      // 12 - Data transaction
	SetScriptTransaction                                 // 13 - SetScript transaction
	SponsorshipTransaction                               // 14 - Sponsorship transaction
	SetAssetScriptTransaction                            // 15 - SetAssetScript transaction
	InvokeScriptTransaction                              // 16 - InvokeScript transaction
)

All transaction types supported.

type TransactionTypeVersion added in v0.3.0

type TransactionTypeVersion struct {
	Type    TransactionType `json:"type"`
	Version byte            `json:"version,omitempty"`
}

type Transactions added in v0.3.0

type Transactions []Transaction

func (Transactions) Count added in v0.3.0

func (a Transactions) Count() int

func (Transactions) WriteTo added in v0.3.0

func (a Transactions) WriteTo(w io.Writer) (int64, error)

type TransactionsRepresentation added in v0.3.0

type TransactionsRepresentation struct {
	// contains filtered or unexported fields
}

func NewReprFromBytes added in v0.3.0

func NewReprFromBytes(b []byte, count int) *TransactionsRepresentation

func NewReprFromTransactions added in v0.3.0

func NewReprFromTransactions(t Transactions) *TransactionsRepresentation

func (*TransactionsRepresentation) Bytes added in v0.3.0

func (a *TransactionsRepresentation) Bytes() ([]byte, error)

func (*TransactionsRepresentation) BytesUnchecked added in v0.3.0

func (a *TransactionsRepresentation) BytesUnchecked() []byte

func (*TransactionsRepresentation) Count added in v0.3.0

func (a *TransactionsRepresentation) Count() int

func (TransactionsRepresentation) Join added in v0.3.0

func (TransactionsRepresentation) MarshalJSON added in v0.3.0

func (a TransactionsRepresentation) MarshalJSON() ([]byte, error)

func (*TransactionsRepresentation) Transactions added in v0.3.0

func (a *TransactionsRepresentation) Transactions() (Transactions, error)

func (*TransactionsRepresentation) UnmarshalJSON added in v0.3.0

func (a *TransactionsRepresentation) UnmarshalJSON(data []byte) error

type Transfer added in v0.3.0

type Transfer struct {
	SenderPK    crypto.PublicKey `json:"senderPublicKey"`
	AmountAsset OptionalAsset    `json:"assetId"`
	FeeAsset    OptionalAsset    `json:"feeAssetId"`
	Timestamp   uint64           `json:"timestamp,omitempty"`
	Amount      uint64           `json:"amount"`
	Fee         uint64           `json:"fee"`
	Recipient   Recipient        `json:"recipient"`
	Attachment  Attachment       `json:"attachment,omitempty"`
}

func (Transfer) GetFee added in v0.3.0

func (tr Transfer) GetFee() uint64

func (Transfer) GetSenderPK added in v0.3.0

func (tr Transfer) GetSenderPK() crypto.PublicKey

func (Transfer) GetTimestamp added in v0.3.0

func (tr Transfer) GetTimestamp() uint64

func (*Transfer) Serialize added in v0.3.0

func (tr *Transfer) Serialize(s *serializer.Serializer) error

func (Transfer) Valid added in v0.3.0

func (tr Transfer) Valid() (bool, error)

type TransferSet added in v0.3.0

type TransferSet []ScriptResultTransfer

func (*TransferSet) Valid added in v0.3.0

func (ts *TransferSet) Valid() 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"`
	Transfer
}

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 Recipient, attachment string) *TransferV1

NewUnsignedTransferV1 creates new TransferV1 transaction without signature and ID.

func (*TransferV1) BodyMarshalBinary added in v0.3.0

func (tx *TransferV1) BodyMarshalBinary() ([]byte, error)

func (*TransferV1) BodySerialize added in v0.3.0

func (tx *TransferV1) BodySerialize(s *serializer.Serializer) error

func (*TransferV1) Clone added in v0.3.0

func (tx *TransferV1) Clone() *TransferV1

func (*TransferV1) GenerateID added in v0.3.0

func (tx *TransferV1) GenerateID()

func (TransferV1) GetID added in v0.2.0

func (tx TransferV1) GetID() ([]byte, error)

func (TransferV1) GetTypeVersion added in v0.3.0

func (tx TransferV1) GetTypeVersion() TransactionTypeVersion

func (*TransferV1) MarshalBinary

func (tx *TransferV1) MarshalBinary() ([]byte, error)

MarshalBinary saves transaction to its binary representation.

func (*TransferV1) Serialize added in v0.3.0

func (tx *TransferV1) Serialize(s *serializer.Serializer) error

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) UnmarshalBinary

func (tx *TransferV1) UnmarshalBinary(data []byte) error

UnmarshalBinary reads transaction from its binary representation.

func (*TransferV1) Verify

func (tx *TransferV1) Verify(publicKey crypto.PublicKey) (bool, error)

Verify use given public key to verify that the signature is valid.

func (*TransferV1) WriteTo added in v0.3.0

func (tx *TransferV1) WriteTo(w io.Writer) (int64, error)

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"`
	Transfer
}

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 Recipient, attachment string) *TransferV2

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) BodySerialize added in v0.3.0

func (tx *TransferV2) BodySerialize(s *serializer.Serializer) error

func (*TransferV2) BodyUnmarshalBinary added in v0.2.0

func (tx *TransferV2) BodyUnmarshalBinary(data []byte) error

func (*TransferV2) Clone added in v0.3.0

func (tx *TransferV2) Clone() *TransferV2

func (*TransferV2) GenerateID added in v0.3.0

func (tx *TransferV2) GenerateID()

func (TransferV2) GetID added in v0.2.0

func (tx TransferV2) GetID() ([]byte, error)

func (TransferV2) GetTypeVersion added in v0.3.0

func (tx TransferV2) GetTypeVersion() TransactionTypeVersion

func (*TransferV2) MarshalBinary added in v0.1.2

func (tx *TransferV2) MarshalBinary() ([]byte, error)

MarshalBinary writes TransferV2 transaction to its bytes representation.

func (*TransferV2) Serialize added in v0.3.0

func (tx *TransferV2) Serialize(s *serializer.Serializer) error

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) UnmarshalBinary added in v0.1.2

func (tx *TransferV2) UnmarshalBinary(data []byte) error

UnmarshalBinary reads TransferV2 from its bytes representation.

func (TransferV2) Valid added in v0.3.0

func (tx TransferV2) Valid() (bool, error)

func (*TransferV2) Verify added in v0.1.2

func (tx *TransferV2) Verify(publicKey crypto.PublicKey) (bool, error)

Verify checks that first proof is a valid signature.

type U32 added in v0.3.0

type U32 uint32

func (*U32) ReadFrom added in v0.3.0

func (a *U32) ReadFrom(r io.Reader) (int64, error)

func (U32) WriteTo added in v0.3.0

func (a U32) WriteTo(w io.Writer) (int64, error)

type U64 added in v0.3.0

type U64 uint64

func (*U64) ReadFrom added in v0.3.0

func (a *U64) ReadFrom(r io.Reader) (int64, error)

func (U64) WriteTo added in v0.3.0

func (a U64) WriteTo(w io.Writer) (int64, error)

type U8String added in v0.3.0

type U8String struct {
	S string
}

func NewU8String added in v0.3.0

func NewU8String(s string) U8String

func (U8String) MarshalBinary added in v0.3.0

func (a U8String) MarshalBinary() ([]byte, error)

MarshalBinary encodes U8String to binary form

func (*U8String) ReadFrom added in v0.3.0

func (a *U8String) ReadFrom(r io.Reader) (int64, error)

func (U8String) WriteTo added in v0.3.0

func (a U8String) WriteTo(w io.Writer) (int64, error)

MarshalBinary encodes U8String to binary form

type Version

type Version struct {
	Major, Minor, Patch uint32
}

Version represents the version of the protocol

func NewVersionFromString added in v0.3.0

func NewVersionFromString(version string) (*Version, error)

func (*Version) MarshalJSON added in v0.3.0

func (a *Version) MarshalJSON() ([]byte, error)

func (*Version) ReadFrom added in v0.3.0

func (a *Version) ReadFrom(r io.Reader) (int64, error)

func (Version) String added in v0.3.0

func (a Version) String() string

func (Version) WriteTo added in v0.3.0

func (a Version) WriteTo(writer io.Writer) (int64, error)

type WrapWriteTo added in v0.3.0

type WrapWriteTo struct {
	// contains filtered or unexported fields
}

func (WrapWriteTo) Read added in v0.3.0

func (a WrapWriteTo) Read(b []byte) (int, error)

type WriteSet added in v0.3.0

type WriteSet []DataEntry

func (*WriteSet) Valid added in v0.3.0

func (ws *WriteSet) Valid() error

Jump to

Keyboard shortcuts

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