Partial Fee Delegation

TxTypeFeeDelegatedValueTransferWithRatio

TxTypeFeeDelegatedValueTransferWithRatio is used when a user wants to send KLAY. As Klaytn provides multiple transaction types to make each transaction type serve a single purpose, TxTypeFeeDelegatedValueTransferWithRatio is limited to send KLAY to an externally owned account. Therefore, TxTypeFeeDelegatedValueTransferWithRatio is accepted only if to is an externally owned account. To transfer KLAY to a smart contract account, use TxTypeFeeDelegatedSmartContractExecutionWithRatio instead. The following changes will be made by this transaction type.

  1. The fee payer's balance decreases by the given ratio of the transaction fee.

  2. The sender's balance decreases by the remaining transaction fee. e.g., If the feeRatio is 30, 30% of the fee will be paid by the fee payer, and the remaining 70% of the fee will be paid by the sender.

  3. The sender's nonce increases by one.

  4. value KLAY is transferred from the sender to the recipient.

Attributes

Attribute
Type
Description

type

uint8 (Go)

The type of TxTypeFeeDelegatedValueTransferWithRatio. This must be 0x0a.

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 peb 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 KLAY. See Unit of KLAY.

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 KLAY in peb to be transferred.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedValueTransferMemoWithRatio

TxTypeFeeDelegatedValueTransferMemoWithRatio is used when a user wants to send KLAY with a specific message. TxTypeFeeDelegatedValueTransferMemoWithRatio is accepted only if to is an externally owned account. To transfer KLAY to a smart contract account, use TxTypeFeeDelegatedSmartContractExecutionWithRatio instead. The following changes will be made by this transaction type.

  1. The fee payer's balance decreases by the fee ratio of the amount of the transaction fee.

  2. The sender's balance decreases by the remaining transaction fee. e.g., If the feeRatio is 30, 30% of the fee will be paid by the fee payer, and the remaining 70% of the fee will be paid by the sender.k

  3. The sender's nonce increases by one.

  4. value KLAY is transferred from the sender to the recipient.

Attributes

Attribute
Description
Type

type

uint8 (Go)

The type of TxTypeFeeDelegatedValueTransferMemoWithRatio. This must be 0x12.

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 peb 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 KLAY. See Unit of KLAY.

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 KLAY in peb to be transferred.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

input

[]byte (Go)

Data attached to the transaction. The message should be passed to this attribute.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedSmartContractDeployWithRatio

TxTypeFeeDelegatedSmartContractDeployWithRatio deploys a smart contract. The given ratio of the transaction fee is paid by the fee payer. The following changes will be made by this transaction type.

  1. The fee payer's balance decreases by the fee ratio of the amount of the transaction fee.

  2. The sender's balance decreases by the remaining transaction fee. e.g., If the feeRatio is 30, 30% of the fee will be paid by the fee payer, and the remaining 70% of the fee will be paid by the sender.

  3. The sender's nonce increases by one.

  4. A smart contract is deployed with the code in input. The deployed address will be returned via contractAddress in the receipt.

  5. value KLAY is transferred from the sender to the recipient.

Attributes

Attribute
Type
Description

type

uint8 (Go)

The type of TxTypeFeeDelegatedSmartContractDeployWithRatio. This must be 0x2a.

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 peb 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 KLAY. See Unit of KLAY.

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. Currently, this value must be nil. Specifying the address will be supported in the future.

value

*big.Int (Go)

The amount of KLAY in peb to be transferred.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

input

[]byte (Go)

Data attached to the transaction, used for transaction execution.

humanReadable

bool (Go)

This must be false since human-readable address is not supported yet. If true, the transaction will be rejected.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

codeFormat

uint8 (Go)

The code format of smart contract code. The supported value for now is EVM(0x00) only.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedSmartContractExecutionWithRatio

TxTypeFeeDelegatedSmartContractExecution executes a smart contract with the given data in input. TxTypeFeeDelegatedSmartContractExecutionWithRatio is accepted only if to is a smart contract account. To transfer KLAY to an externally owned account, use TxTypeFeeDelegatedValueTransferWithRatio instead. The following changes will be made by this transaction type.

  1. If to is a smart contract account, the code is executed based on input. Otherwise, this transaction will be rejected.

  2. The fee payer's balance decreases by the fee ratio of the amount of the transaction fee.

  3. The sender's balance decreases by the remaining transaction fee. e.g., If the feeRatio is 30, 30% of the fee will be paid by the fee payer, and the remaining 70% of the fee will be paid by the sender.

  4. The sender's nonce increases by one.

  5. If value was provided, value KLAY is transferred from the sender to the to smart contract. The contract should have a payable fallback function to receive KLAY.

Attributes

Attribute
Type
Description

type

uint8 (Go)

The type of TxTypeFeeDelegatedSmartContractExecutionWithRatio. This must be 0x32.

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 peb 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 KLAY. See Unit of KLAY.

gas

uint64 (Go)

The maximum amount of gas the transaction is allowed to use.

to

common.Address (Go)

The address of the smart contract account to be executed.

value

*big.Int (Go)

The amount of KLAY in peb to be transferred.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

input

[]byte (Go)

Data attached to the transaction, used for transaction execution.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedAccountUpdateWithRatio

TxTypeFeeDelegatedAccountUpdateWithRatio updates the key of the given account. The given ratio of the transaction fee is paid by the fee payer. The following changes will take place by this transaction type.

  1. The fee payer's balance decreases by the fee ratio of the amount of the transaction fee.

  2. The sender's balance decreases by the remaining transaction fee. e.g., If the feeRatio is 30, 30% of the fee will be paid by the fee payer, and the remaining 70% of the fee will be paid by the sender.

  3. The sender's nonce increases by one.

  4. The account's key is updated with key.

  5. Transactions sent from the account afterward will be validated with this key, once this transaction is executed.

Attributes

Attribute
Type
Description

type

uint8 (Go)

The type of TxTypeFeeDelegatedAccountUpdateWithRatio. This must be 0x22.

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 multiplier to get how much the sender will pay in tokens. The amount of tokens the sender will pay is calculated via gas * gasPrice. For example, the sender will pay 10 KLAY for a transaction fee if gas is 10 and gasPrice is 10^18. See Unit of KLAY.

gas

uint64 (Go)

The maximum amount of transaction fee the transaction is allowed to use.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

key

AccountKey (Go)

AccountKey to be updated to the account.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedCancelWithRatio

TxTypeFeeDelegatedCancelWithRatio cancels the execution of the transaction with the same nonce in the transaction pool. For more details, see TxTypeCancel.

The following changes will apply by this transaction type. 1. The fee payer's balance decreases by the given fee ratio of the amount of the transaction fee. 2. The sender's balance decreases by the remaining transaction fee. 3. The sender's nonce increases by one.

Attributes

Attribute
Description
Type

type

uint8 (Go)

The type of TxTypeFeeDelegatedCancelWithRatio. This must be 0x3a.

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 peb 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 KLAY. See Unit of KLAY.

gas

uint64 (Go)

The maximum amount of transaction fee the transaction is allowed to use.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeFeeDelegatedChainDataAnchoringWithRatio

TxTypeFeeDelegatedChainDataAnchoringWithRatio is a fee-delegated transaction, with the ratio, that anchors service chain data to the Klaytn mainchain. Service chains periodically send this type of transaction to the Klaytn mainchain to ensure its security and credibility of data. For more details about the data anchoring, see Anchoring. As it is a fee-delegated transaction with the given ratio as well, the fee payer bears only the given portion of the transaction fee based on the given ratio and the sender pays the rest. Be mindful that it is not allowed to send this transaction via RPC. Currently, this transaction is executed through private p2p channels for security reasons. This transaction does not change the state of the Klaytn blockchain except the sender's nonce being increased by one.

Attributes

Attribute
Type
Description

type

uint8 (Go)

The type of TxTypeFeeDelegatedChainDataAnchoringWithRatio. This must be 0x4a.

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 peb 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 KLAY. See Unit of KLAY.

gas

uint64 (Go)

The maximum amount of transaction fee the transaction is allowed to use.

from

common.Address (Go)

The address of the sender. For more details, see Signature Validation of Transactions.

feeRatio

uint8 (Go)

Fee ratio of the fee payer. The valid range is between 1 and 99. Zero(0) is not allowed. 100 and above are not allowed as well.

input

[]byte (Go)

Data of the service chain.

txSignatures

[]{*big.Int, *big.Int, *big.Int} (Go)

The sender's signatures. For more details, see Signature Validation of Transactions.

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:

RLP Encoding for Signature of the Fee Payer

To make a signature of the fee payer, RLP serialization should be done like the following:

RLP Encoding for SenderTxHash

To make a SenderTxHash, RLP serialization should be done like the following:

RLP Encoding for Transaction Hash

To make a transaction hash, RLP serialization should be done like the following:

RLP Encoding (Example)

The following shows the result of RLP serialization and the transaction object:

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

Last updated