Documentation ¶
Index ¶
- func GetCurrentTimeWithOffset(offset int64) uint32
- type Asset
- type CastVoteAsset
- type CreateDappAsset
- type Dapp
- type DataAsset
- type RegisterDelegateAsset
- type RegisterMultisignatureAccountAsset
- type RegisterSecondSignatureAsset
- type Transaction
- func NewMultisignatureRegistrationTransaction(recipientID string, secret string, secondSecret string, timeOffset int64, ...) (*Transaction, error)
- func NewSecondSignatureTransaction(recipientID string, secret string, newSecondSecret string, timeOffset int64) (*Transaction, error)
- func NewTransaction(recipientID string, amount uint64, secret string, secondSecret string, ...) (*Transaction, error)
- func NewTransactionWithData(recipientID string, amount uint64, secret string, secondSecret string, ...) (*Transaction, error)
- func NewVoteTransaction(recipientID string, secret string, secondSecret string, timeOffset int64, ...) (*Transaction, error)
- func (t *Transaction) Fee() (uint32, error)
- func (t *Transaction) Hash() ([]byte, error)
- func (t *Transaction) ID() (string, error)
- func (t *Transaction) IsValid() (bool, error)
- func (t *Transaction) MarshalJSON() ([]byte, error)
- func (t *Transaction) SecondSign(privateKey []byte) error
- func (t *Transaction) Serialize() ([]byte, error)
- func (t *Transaction) Sign(privateKey []byte) error
- type TransactionType
- type TransferInDappAsset
- type TransferOutDappAsset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentTimeWithOffset ¶
GetCurrentTimeWithOffset returns the current blockchain time with an offset
Types ¶
type CastVoteAsset ¶
type CastVoteAsset struct { // Votes is a slice of the public keys of the delegates to vote for Votes [][]byte // Unvotes is a slice of the public keys of the delegates to remove votes from Unvotes [][]byte }
CastVoteAsset is the asset needed for a TransactionTypeVote The maximum number of votes is 33
func (*CastVoteAsset) IsValid ¶
func (c *CastVoteAsset) IsValid() (bool, error)
IsValid returns whether the asset is valid
func (*CastVoteAsset) MarshalJSON ¶
func (c *CastVoteAsset) MarshalJSON() ([]byte, error)
MarshalJSON marshals the asset to the lisk JSON format
type CreateDappAsset ¶
type CreateDappAsset struct { // Dapp is the dapp that should be registered Dapp *Dapp }
CreateDappAsset is the asset needed for a TransactionTypeDappRegistration
type Dapp ¶
type Dapp struct { Name string Link string Type string Category string Description string Tags []string Icon string }
Dapp represents a Dapp on the Lisk blockchain
type DataAsset ¶
type DataAsset string
DataAsset is an asset that is used to attach data to a normal transaction
func (DataAsset) MarshalJSON ¶
MarshalJSON marshals the asset to the lisk JSON format
type RegisterDelegateAsset ¶
type RegisterDelegateAsset struct { // Username is the username for the delegate Username string // PublicKey is the public key of the delegate PublicKey []byte }
RegisterDelegateAsset is the asset needed for a TransactionTypeDelegateRegistration
func (*RegisterDelegateAsset) IsValid ¶
func (r *RegisterDelegateAsset) IsValid() (bool, error)
IsValid returns whether the asset is valid
func (*RegisterDelegateAsset) MarshalJSON ¶
func (r *RegisterDelegateAsset) MarshalJSON() ([]byte, error)
MarshalJSON marshals the asset to the lisk JSON format
type RegisterMultisignatureAccountAsset ¶
type RegisterMultisignatureAccountAsset struct { // Min is the minimum number of signatures that is required for a transaction Min byte `json:"min"` // Lifetime is the lifetime of the transaction in which it can be signed Lifetime byte `json:"lifetime"` // AddKeys is a slice of keys to add to the multisignature wallet AddKeys [][]byte `json:"_"` // AddKeys is a slice of keys to remove from the multisignature wallet RemoveKeys [][]byte `json:"_"` }
RegisterMultisignatureAccountAsset is the asset needed for a TransactionTypeMultisignatureRegistration
func (*RegisterMultisignatureAccountAsset) IsValid ¶
func (r *RegisterMultisignatureAccountAsset) IsValid() (bool, error)
IsValid returns whether the asset is valid
func (*RegisterMultisignatureAccountAsset) MarshalJSON ¶
func (r *RegisterMultisignatureAccountAsset) MarshalJSON() ([]byte, error)
MarshalJSON marshals the asset to the lisk JSON format
type RegisterSecondSignatureAsset ¶
type RegisterSecondSignatureAsset struct { // PublicKey is the public key for the second secret PublicKey []byte }
RegisterSecondSignatureAsset is the asset needed for a TransactionTypeSecondSecretRegistration
func (*RegisterSecondSignatureAsset) IsValid ¶
func (r *RegisterSecondSignatureAsset) IsValid() (bool, error)
IsValid returns whether the asset is valid
func (*RegisterSecondSignatureAsset) MarshalJSON ¶
func (r *RegisterSecondSignatureAsset) MarshalJSON() ([]byte, error)
MarshalJSON marshals the asset to the lisk JSON format
type Transaction ¶
type Transaction struct { Type TransactionType Amount uint64 RecipientID string Timestamp uint32 Asset Asset SenderPublicKey []byte TransactionRequesterPublicKey []byte // contains filtered or unexported fields }
Transaction represents a lisk network transaction
func NewMultisignatureRegistrationTransaction ¶
func NewMultisignatureRegistrationTransaction(recipientID string, secret string, secondSecret string, timeOffset int64, addKeys [][]byte, removeKeys [][]byte, Lifetime byte, min byte) ( *Transaction, error)
NewMultisignatureRegistrationTransaction creates a new transaction to create/update multisignature accounts and signs it using the given secrets. The second secret is optional and only required for lisk wallets with a second signature. The keys are binary representations of the public keys of the relevant delegates. Lifetime is the pending transaction lifetime. Min is the minimum number of signatures required.
func NewSecondSignatureTransaction ¶
func NewSecondSignatureTransaction( recipientID string, secret string, newSecondSecret string, timeOffset int64) ( *Transaction, error)
NewSecondSignatureTransaction creates a new transaction to create a second signature and signs it using the given secrets.
func NewTransaction ¶
func NewTransaction(recipientID string, amount uint64, secret string, secondSecret string, timeOffset int64) ( *Transaction, error)
NewTransaction creates a new value transfer transaction and signs it using the given secrets. The second secret is optional and only required for lisk wallets with a second signature.
func NewTransactionWithData ¶
func NewTransactionWithData( recipientID string, amount uint64, secret string, secondSecret string, timeOffset int64, data interface{}) ( *Transaction, error)
NewTransactionWithData creates a new value transfer transaction with data and signs it using the given secrets. The second secret is optional and only required for lisk wallets with a second signature. Data can be a string or byte slice with a maximum length of 64 bytes.
func NewVoteTransaction ¶
func NewVoteTransaction(recipientID string, secret string, secondSecret string, timeOffset int64, votes [][]byte, unvotes [][]byte) ( *Transaction, error)
NewVoteTransaction creates a new vote transaction and signs it using the given secrets. The second secret is optional and only required for lisk wallets with a second signature. The votes and unvotes are binary representations of the public keys of the relevant delegates.
func (*Transaction) Fee ¶
func (t *Transaction) Fee() (uint32, error)
Fee returns the calculated fee of the transaction
func (*Transaction) Hash ¶
func (t *Transaction) Hash() ([]byte, error)
Hash returns the SHA256 hash of the transaction bytes
func (*Transaction) ID ¶
func (t *Transaction) ID() (string, error)
ID returns the ID of the transaction
func (*Transaction) IsValid ¶
func (t *Transaction) IsValid() (bool, error)
IsValid returns whether the transaction is valid
func (*Transaction) MarshalJSON ¶
func (t *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON converts the transaction to a JSON payload that can be sent to the node
func (*Transaction) SecondSign ¶
func (t *Transaction) SecondSign(privateKey []byte) error
SecondSign adds a second signature to the transaction using the given privateKey. This has to be redone when any fields of the transaction are changed.
func (*Transaction) Serialize ¶
func (t *Transaction) Serialize() ([]byte, error)
Serialize serializes the transaction in the binary format used
func (*Transaction) Sign ¶
func (t *Transaction) Sign(privateKey []byte) error
Sign signs the transaction with the given privateKey. This has to be redone when any fields of the transaction are changed.
type TransactionType ¶
type TransactionType byte
TransactionType represents a transaction type and specifies the associated action
const ( // TransactionTypeNormal is used to transfer Lisk TransactionTypeNormal TransactionType = 0 // TransactionTypeSecondSecretRegistration is used to register a second secret TransactionTypeSecondSecretRegistration TransactionType = 1 // TransactionTypeDelegateRegistration is used to register a delegate TransactionTypeDelegateRegistration TransactionType = 2 // TransactionTypeVote is used to change vote for delegates TransactionTypeVote TransactionType = 3 // TransactionTypeMultisignatureRegistration is used to register and modify a multisignature wallet TransactionTypeMultisignatureRegistration TransactionType = 4 // TransactionTypeDappRegistration is used to register a DApp TransactionTypeDappRegistration TransactionType = 5 // TransactionTypeTransferInSidechain is used to transfer lisk into a sidechain TransactionTypeTransferInSidechain TransactionType = 6 // TransactionTypeTransferOutSidechain is used to transfer lisk out of a sidechain TransactionTypeTransferOutSidechain TransactionType = 7 )
type TransferInDappAsset ¶
type TransferInDappAsset struct { // DappID is the ID of the DApp to transfer lisk in DappID string `json:"dappId"` }
TransferInDappAsset is the asset needed for a TransactionTypeTransferInSidechain
type TransferOutDappAsset ¶
type TransferOutDappAsset struct { // DappID is the ID of the DApp to transfer lisk out of DappID string `json:"dappId"` // TransactionID is the ID of the withdrawal transaction on the sidechain TransactionID string `json:"transactionId"` }
TransferOutDappAsset is the asset needed for a TransactionTypeTransferOutSidechain