Transactions¶
Semantic¶
Transactions in Minter are RLP-encoded structures.
Example of a signed transaction:
f873230101aae98a4d4e540000000000000094a93163fdf10724dc4785ff5cbfb9
ac0b5949409f880de0b6b3a764000080801ba06838db4a2197cfd70ede8d8d184d
bf332932ca051a243eb7886791250e545dd3a04b63fb1d1b5ef5f2cbd2ea12530c
da520b3280dcb75bfd45a873629109f24b29
Each transaction has:
- Nonce - int, used for prevent transaction reply.
- Gas Price - big int, used for managing transaction fees.
- Gas Coin - 10 bytes, symbol of a coin to pay fee
- Type - type of transaction (see below).
- Data - data of transaction (depends on transaction type).
- Payload (arbitrary bytes) - arbitrary user-defined bytes.
- Service Data - reserved field.
- Signature Type - single or multisig transaction.
- Signature Data - digital signature of transaction.
type Transaction struct {
Nonce uint64
GasPrice *big.Int
GasCoin [10]byte
Type byte
Data []byte
Payload []byte
ServiceData []byte
SignatureType byte
SignatureData Signature
}
type Signature struct {
V *big.Int
R *big.Int
S *big.Int
}
type MultiSignature struct {
MultisigAddress [20]byte
Signatures []Signature
}
Signature Types¶
Type Name | Byte |
---|---|
TypeSingle | 0x01 |
TypeMulti | 0x02 |
Types¶
Type of transaction is determined by a single byte.
Type Name | Byte |
---|---|
TypeSend | 0x01 |
TypeSellCoin | 0x02 |
TypeSellAllCoin | 0x03 |
TypeBuyCoin | 0x04 |
TypeCreateCoin | 0x05 |
TypeDeclareCandidacy | 0x06 |
TypeDelegate | 0x07 |
TypeUnbond | 0x08 |
TypeRedeemCheck | 0x09 |
TypeSetCandidateOnline | 0x0A |
TypeSetCandidateOffline | 0x0B |
TypeCreateMultisig | 0x0C |
Send transaction¶
Type: 0x01
Transaction for sending arbitrary coin.
Data field contents:
type SendData struct {
Coin [10]byte
To [20]byte
Value *big.Int
}
Sell coin transaction¶
Type: 0x02
Transaction for selling one coin (owned by sender) in favour of another coin in a system.
Data field contents:
type SellCoinData struct {
CoinToSell [10]byte
ValueToSell *big.Int
CoinToBuy [10]byte
}
Sell all coin transaction¶
Type: 0x03
Transaction for selling all existing coins of one type (owned by sender) in favour of another coin in a system.
Data field contents:
type SellAllCoinData struct {
CoinToSell [10]byte
CoinToBuy [10]byte
}
Buy coin transaction¶
Type: 0x04
Transaction for buy a coin paying another coin (owned by sender).
Data field contents:
type BuyCoinData struct {
CoinToBuy [10]byte
ValueToBuy *big.Int
CoinToSell [10]byte
}
Create coin transaction¶
Type: 0x05
Transaction for creating new coin in a system.
Data field contents:
type CreateCoinData struct {
Name string
Symbol [10]byte
InitialAmount *big.Int
InitialReserve *big.Int
ConstantReserveRatio uint
}
Declare candidacy transaction¶
Type: 0x06
Transaction for declaring new validator candidacy.
Data field contents:
type DeclareCandidacyData struct {
Address [20]byte
PubKey []byte
Commission uint
Coin [10]byte
Stake *big.Int
}
Delegate transaction¶
Type: 0x07
Transaction for delegating funds to validator.
Data field contents:
type DelegateData struct {
PubKey []byte
Coin [10]byte
Stake *big.Int
}
Unbond transaction¶
Type: 0x08
Transaction for unbonding funds from validator’s stake.
Data field contents:
type UnbondData struct {
PubKey []byte
Coin [10]byte
Value *big.Int
}
Redeem check transaction¶
Type: 0x09
Transaction for redeeming a check.
Data field contents:
type RedeemCheckData struct {
RawCheck []byte
Proof [65]byte
}
Set candidate online transaction¶
Type: 0x0A
Transaction for turning candidate on. This transaction should be sent from address which is set in the “Declare candidacy transaction”.
Data field contents:
type SetCandidateOnData struct {
PubKey []byte
}
Set candidate offline transaction¶
Type: 0x0B
Transaction for turning candidate off. This transaction should be sent from address which is set in the “Declare candidacy transaction”.
Data field contents:
type SetCandidateOffData struct {
PubKey []byte
}
Create multisig address¶
Type: 0x0C
Transaction for creating multisignature address.
Data field contents:
type CreateMultisigData struct {
Threshold uint
Weights []uint
Addresses [][20]byte
}