Fee Delegation
TxTypeFeeDelegatedValueTransfer
TxTypeFeeDelegatedValueTransfer is used when a user wants to send KAIA. As Kaia provides multiple transaction types to make each transaction type serve a single purpose, TxTypeFeeDelegatedValueTransfer is limited to send KAIA to an externally owned account. Therefore, TxTypeFeeDelegatedValueTransfer is accepted only if to
is an externally owned account. To transfer KAIA to a smart contract account, use TxTypeFeeDelegatedSmartContractExecution instead. The following changes will be made by this transaction type.
- The fee payer's balance decreases by the amount of the transaction fee.
- The sender's nonce increases by one.
value
KAIA is transferred from the sender to the recipient.
Attributes
Attribute | Type | Description |
---|---|---|
type | uint8 (Go) | The type of TxTypeFeeDelegatedValueTransfer. This must be 0x09. |
nonce | uint64 (Go) | A value used to uniquely identify a sender’s transaction. If two transactions with the same nonce are generated by a sender, only one is executed. |
gasPrice | *big.Int (Go) | A unit price of gas in kei the sender will pay for a transaction fee. The amount of transaction fee is calculated as gas * gasPrice . For example, if the transaction consumes 10 units of gas and gasPrice is 10^18, the transaction fee will be 10 KAIA. See Unit of KAIA. |
gas | uint64 (Go) | The maximum amount of gas the transaction is allowed to use. |
to | common.Address (Go) | The account address that will receive the transferred value. |
value | *big.Int (Go) | The amount of KAIA in kei to be transferred. |
from | common.Address (Go) | The address of the sender. For more details, see Signature Validation. |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | The sender's signatures. For more details, see Signature Validation. |
feePayer | common.Address (Go) | The address of the fee payer. |
feePayerSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | The fee payer's signatures. |
RLP Encoding for Signature of the Sender
To make a signature of the sender, RLP serialization should be done like the following:
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from]), chainid, 0, 0])SigHash = keccak256(SigRLP)Signature = sign(SigHash, <the sender's private key>)
RLP Encoding for Signature of the Fee Payer
To make a signature of the fee payer, RLP serialization should be done like the following:
SigFeePayerRLP = encode([ encode([type, nonce, gasPrice, gas, to, value, from]), feePayer, chainid, 0, 0 ])SigFeePayerHash = keccak256(SigFeePayerRLP)SignatureFeePayer = sign(SigFeePayerHash, <the fee payer's private key>)
RLP Encoding for SenderTxHash
To make a SenderTxHash, RLP serialization should be done like the following:
txSignatures (a single signature) = [[v, r, s]]txSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]SenderTxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, txSignatures])SenderTxHash = keccak256(SenderTxHashRLP)
RLP Encoding for Transaction Hash
To make a transaction hash, RLP serialization should be done like the following:
txSignatures (a single signature) = [[v, r, s]]txSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]feePayerSignatures (a single signature) = [[v, r, s]]feePayerSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, txSignatures, feePayer, feePayerSignatures])`TxHash = keccak256(TxHashRLP)
RLP Encoding (Example)
The following shows the result of RLP serialization and the transaction object:
ChainID 0x1PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33dPublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3SigRLP 0xf839b5f4098204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b018080SigHash 0xb86e4cc0955f7c2cda1b36038c9d43a2724fc956c11e09c37625379b7eb2bd21Signature f845f84325a09f8e49e2ad84b0732984398749956e807e4b526c786af3c5f7416b293e638956a06bf88342092f6ff9fabe31739b2ebfa1409707ce54a54693e91a6b9bb77df0e7FeePayerPrivateKey 0xb9d5558443585bca6f225b935950e3f6e69f9da8a5809a83f51c3365dff53936FeePayerPublicKey.X 0x327434d4cfc66ef8857d431419e9deebdc53a3e415edcc55382e2d417b8dd102FeePayerPublicKey.Y 0x65fc97045707faf7b8f81ac65089d4cc71f69ad0bf1bc8559bc24f13fc284cedSigRLPFeePayer 0xf84eb5f4098204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b945a0043070275d9f6054307ee7348bd660849d90f018080SigHashFeePayer 0x3e7c5f40e826d1d22493be59bf62928dc397de5c972bd9bfa3fe5206c24a5f82SignatureFeePayer f845f84326a0f45cf8d7f88c08e6b6ec0b3b562f34ca94283e4689021987abb6b0772ddfd80aa0298fe2c5aeabb6a518f4cbb5ff39631a5d88be505d3923374f65fdcf63c2955bTxHashRLP 0x09f8d68204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a09f8e49e2ad84b0732984398749956e807e4b526c786af3c5f7416b293e638956a06bf88342092f6ff9fabe31739b2ebfa1409707ce54a54693e91a6b9bb77df0e7945a0043070275d9f6054307ee7348bd660849d90ff845f84326a0f45cf8d7f88c08e6b6ec0b3b562f34ca94283e4689021987abb6b0772ddfd80aa0298fe2c5aeabb6a518f4cbb5ff39631a5d88be505d3923374f65fdcf63c2955bTxHash e1e07f9971153499fc8c7bafcdaf7abc20b37aa4c18fb1e53a9bfcc259e3644cSenderTxHashRLP 0x09f87a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a09f8e49e2ad84b0732984398749956e807e4b526c786af3c5f7416b293e638956a06bf88342092f6ff9fabe31739b2ebfa1409707ce54a54693e91a6b9bb77df0e7SenderTxHash 40f8c94e01e07eb5353f6cd4cd3eabd5893215dd53a50ba4b8ff9a447ac51731 TX(e1e07f9971153499fc8c7bafcdaf7abc20b37aa4c18fb1e53a9bfcc259e3644c) Type: TxTypeFeeDelegatedValueTransfer From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0 Nonce: 1234 GasPrice: 0x19 GasLimit: 0xf4240 Value: 0xa Signature: [{"V":"0x25","R":"0x9f8e49e2ad84b0732984398749956e807e4b526c786af3c5f7416b293e638956","S":"0x6bf88342092f6ff9fabe31739b2ebfa1409707ce54a54693e91a6b9bb77df0e7"}] FeePayer: 0x5A0043070275d9f6054307Ee7348bD660849D90f FeePayerSig: [{"V":"0x26","R":"0xf45cf8d7f88c08e6b6ec0b3b562f34ca94283e4689021987abb6b0772ddfd80a","S":"0x298fe2c5aeabb6a518f4cbb5ff39631a5d88be505d3923374f65fdcf63c2955b"}] Hex: 09f8d68204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a09f8e49e2ad84b0732984398749956e807e4b526c786af3c5f7416b293e638956a06bf88342092f6ff9fabe31739b2ebfa1409707ce54a54693e91a6b9bb77df0e7945a0043070275d9f6054307ee7348bd660849d90ff845f84326a0f45cf8d7f88c08e6b6ec0b3b562f34ca94283e4689021987abb6b0772ddfd80aa0298fe2c5aeabb6a518f4cbb5ff39631a5d88be505d3923374f65fdcf63c2955b
RPC Output (Example)
The following shows a transaction object returned via JSON RPC.
{ "blockHash": "0x7ad6ed1f9955be00db8fb5452125f0e9a3c0856abb5b4cc4aed91ffc134321da", "blockNumber": "0x1", "contractAddress": null, "feePayer": "0x029fdce0457db02f05c4be9f67b7115cb8ea15ca", "feePayerSignatures": [ { "V": "0x26", "R": "0x984e9d43c496ef39ef2d496c8e1aee695f871e4f6cfae7f205ddda1589ca5c9e", "S": "0x46647d1ce8755cd664f5fb4eba3082dd1a13817488029f3869662986b7b1a5ae" } ], "from": "0x0fcda0f2efbe1b4e61b487701ce4f2f8abc3723d", "gas": "0x174876e800", "gasPrice": "0x5d21dba00", "gasUsed": "0x7918", "logs": [], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "nonce": "0x2", "senderTxHash": "0x6a8cf9a2f6d16561303445309d4f210c8be862f0d0c0e6f4998775fef9b4f957", "signatures": [ { "V": "0x25", "R": "0x368b3324b37831b51711a2eba2a7608438a2bd5956ccecbcdb07d9163ff8bc87", "S": "0x7ee2e86ad6f01c867b2ced9d69e614ba22e539726451400fccdd56acbbc7a6f7" } ], "status": "0x1", "to": "0x75c3098be5e4b63fbac05838daaee378dd48098d", "transactionHash": "0xea4341b5c95fd5a0c3a8a15a4177ab6394725c24f722a9e31f53474a6dcf086a", "transactionIndex": "0x2", "type": "TxTypeFeeDelegatedValueTransfer", "typeInt": 9, "value": "0x21e19e0c9bab2400000"}
TxTypeFeeDelegatedValueTransferMemo
TxTypeFeeDelegatedValueTransferMemo is used when a user wants to send KAIA with a specific message. TxTypeFeeDelegatedValueTransferMemo is accepted only if to
is an externally owned account. To transfer KAIA to a smart contract account, use TxTypeFeeDelegatedSmartContractExecution instead. The following changes will be made by this transaction type.
- The fee payer's balance decreases by the amount of the transaction fee.
- The sender's nonce increases by one.
value
KAIA is transferred from the sender to the recipient.
Attributes
Attribute | Description | Type | An example value |
---|---|---|---|
type | uint8 (Go) | The type of TxTypeFeeDelegatedValueTransferMemo. This must be 0x11. | |
nonce | uint64 (Go) | A value used to uniquely identify a sender’s transaction. If two transactions with the same nonce are generated by a sender, only one is executed. | |
gasPrice | *big.Int (Go) | A unit price of gas in kei the sender will pay for a transaction fee. The amount of transaction fee is calculated as gas * gasPrice . For example, if the transaction consumes 10 units of gas and gasPrice is 10^18, the transaction fee will be 10 KAIA. See Unit of KAIA. | |
gas | uint64 (Go) | The maximum amount of gas the transaction is allowed to use. | |
to | common.Address (Go) | The account address that will receive the transferred value. | |
value | *big.Int (Go) | The amount of KAIA in kei to be transferred. | |
from | common.Address (Go) | The address of the sender. For more details, see Signature Validation. | |
input | []byte (Go) | Data attached to the transaction. The message should be passed to this attribute. | |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | The sender's signatures. For more details, see Signature Validation. | |
feePayer | common.Address (Go) | The address of the fee payer. | |
feePayerSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | The fee payer's signatures. |
RLP Encoding for Signature of the Sender
To make a signature of the sender, RLP serialization should be done like the following:
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, input]), chainid, 0, 0])SigHash = keccak256(SigRLP)Signature = sign(SigHash, <the sender's private key>)
RLP Encoding for Signature of the Fee Payer
To make a signature of the fee payer, RLP serialization should be done like the following:
SigFeePayerRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, input]), feePayer, chainid, 0, 0])SigFeePayerHash = keccak256(SigFeePayerRLP)SignatureFeePayer = sign(SigFeePayerHash, <the fee payer's private key>)