Transaction Type - zoobc/zoobc-core GitHub Wiki
Transaction type is the sets of action that can be taken on the core node by consuming PostTransaction API.
-
Transaction type list
No | Transaction Name | Byte | Integer |
---|---|---|---|
0 | Empty | [0, 0] | 0 |
1 | Send Money | [1, 0] | 1 |
2 | Node Registration | [2, 0] | 2 |
3 | Update Node Registration | [2, 1] | 258 |
4 | Remove Node Registration | [2, 2] | 514 |
5 | Claim Node Registration | [2, 3] | 770 |
6 | Setup Account Dataset | [3, 0] | 3 |
7 | Remove Account Dataset | [3, 1] | 259 |
8 | Escrow Approval | [4, 0] | 4 |
9 | Multi Signature | [5, 0] | 5 |
10 | Liquid Payment | [6, 0] | 6 |
11 | Liquid Payment Stop | [6, 1] | 262 |
12 | Fee Vote Commitment Phase | [7, 0] | 7 |
13 | Fee Vote Reveal Phase | [7, 1] | 263 |
-
Flow
Every transaction type will be executed in the following order:
-
Validate(): Every transaction type can add additional validation depending on its need on top of the general transaction validation
-
ApplyUnconfirmed: Sets of action that triggered for a before saved to mempool. This action include taking fee from the sender spendable balance.
-
UndoApplyUnconfirmed(): Undo the
ApplyUnconfirmed()
which mean the oposite of whatApplyUnconfirmed()
is, this is usefull in pre-ApplyConfirmed() and rollback situation. -
ApplyConfirmed: The actual logic to execute of a transaction type.
-
-
Escrow
Transaction can include escrow fields and which mean transaction will expected as escrowed transaction. Escrowed transaction has different
Validate
,Apply Unconfirmed
,Undo Apply Unconfirmed
, andApply Confirmed
.:- EscrowValidate()
escrow.Amount > 0
escrow.ApproverAddress != empty
escrow.RecipientAddress != empty
escrow.SenderAddress != empty
escrow.Timeout >= block.Height
sender must exist in account balance table
sender.SpendableBalance >= (escrow.Amount + transaction.Fee + escrow.Commission)
- EscrowApplyUnconfirmed()
sender.SpendableBalance -= (transaction.Fee + escrow.Amount + escrow.Commission)
- EscrowUndoApplyUnconfirmed
sender.SpendableBalance += (transaction.Fee + Escrow.Amount + escrow.Commission)
- EscrowApplyConfirmed
sender.SpendableBalance -= (transaction.Fee + escrow.Amount + escrow.Commission)
sender.Balance -= (transaction.fee + escrow.amount + escrow.Commission)
- EscrowApproval()
The action to be taken on receiving
escrow-transaction
approval transaction type.
- EscrowValidate()
-
Implementations
The description of every transaction type below will be formated to:
|data-format-table| description
Where
data-format
will be structured in an ordered manner where client can follow the exact order to build the transaction bytes sequence.-
Send Money
No Name Length Type 0 Amount 8 int64 Transfer fund of
Amount
torecipient
. -
Escrow Approval
No Name Length Type 0 Approval 4 int32 1 TransactionID 8 int64 Approve / reject escrowed transaction. Approver will get the commission if approve / reject the escrowed transaction. On escrow timeout, the commission will go back to the transaction sender.
-
Setup Account Dataset
No Name Length Type 0 Property Length 4 int32 1 Property Property Length string 2 Value Length 4 int32 3 Value Value Length string This transaction used to assigned a set of properties to an account by itself or other accounts. The names and values of these properties maybe arbitrary, while in other cases certain property names maybe given particular rules for how they are set and how they affect to the consensus logic.
-
Remove Account Dataset
No Name Length Type 0 Property Length 4 int32 1 Property Property Length string 2 Value Length 4 int32 3 Value Value Length string This transaction used to removed a set of property that already assigned to an account. Only account who assigned a set of property can removed that set property of account.
-
-
Node
-
see Register Node, Update Node, UnRegister Node, Claim Nodehttps://github.com/zoobc/zoobc-core/wiki/Node-Registration
-
-
Fee Vote Commit
No Name Length Type 0 commit hash 32 []byte Commit hash is the
sha3_256
of the FeeVoteInfo bytes. The FeeVoteInfo object will later be needed in the Reveal Phase, so user should save this piece of information until so. -
Fee Vote Reveal
No Name Length Type 0 recent block hash length 4 uint32 1 recent block hash 32 RecentBlockHash 2 recent block height 4 uint32 3 fee vote 4 int64 4 voter signature variable * VoterSignature * depends on tx sender account type
Voter signature is the signature from signing FeeVoteInfo bytes with the owner private key.
There are some rules / validation that must be passed:
- Sender address must be as node owner and also must already be in Commit Phase
Timestamp
when the transaction must be inFeeVotePhase_FeeVotePhaseReveal
.recent_block_hash
must match with block that was get byrecent_block_height
.
-
Liquid Payment and Liquid Payment Stop
-
Multisignature
General
No Name Length Type 0 MultisigInfoFieldPresent 4 byte 1 MultisigInfo n []string 2 TransactionBytesLength 4 uint32 3 TransactionBytes n []byte 4 SignatureInfoFieldPresent 4 byte 5 SignatureInfo n []byte Specific bytes sequence:
-
Multisig Info
Only supplied when
MultisigInfoFieldPresent
is 1.No Name Length Type 0 MinimumSignatures 4 uint32 1 Nonce 8 int64 2 ParticipantCount 4 uint32 3 Participants n []string Participants (
sorted
[ref: multisig address]) are looped and inserted as length-value pairs:No Name Length Type 0 Address variable * []byte
* first 4 bytes of the address are the transaction type, on which address (public key) length can be calculated
-
-
Transaction Bytes
Only supplied when
TransactionBytesLength
is more than zero.No Name Length Type 0 TransactionBytes TransactionBytesLength byte -
Signature Info
Only supplied when
SignatureInfoFieldPresent
is 1.No Name Length Type 0 TransactionHash 32 []byte 1 SignatureCount 4 uint32 2 Signatures n byte Signatures are represented in address-signature pair:
No Name Length Type 0 Address variable * []byte 1 Signature variable ** []byte * first 4 bytes of the address are the transaction type, on which address (public key) length can be calculated ** signature length depends on Address' account type