본문으로 건너뛰기
이 페이지는 영어로 된 기계 번역을 사용하므로 오류나 불명확한 언어가 포함될 수 있습니다. 가장 정확한 정보는 영어 원문을 참조하시기 바랍니다. 잦은 업데이트로 인해 일부 콘텐츠는 원래 영어로 되어 있을 수 있습니다. Crowdin에서 이 페이지의 번역을 개선하는 데 동참하여 도움을 주세요. (Crowdin translation page, Contributing guide)

Implementing Transactions

This guide provides a comprehensive overview of implementing transactions on the Kaia network, covering various transaction types, encoding, signing, and network interaction.

Kaia Transaction Components

Kaia transactions generally include the following components:

ComponentsDescription
fromThe sender's address. Required for most Kaia transaction types due to the decoupling of key pairs and addresses.
toThe account address that will receive the transferred value.
valueThe amount of KAIA in kei to be transferred.
inputData attached to the transaction, used for transaction execution.
v, r, sThe cryptographic signature generated by the sender to let the receiver obtain the sender's address.
nonceA 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.
gasThe maximum amount of transaction fee the transaction is allowed to use.
gasPriceA 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 KAIA for a transaction fee if gas is 10 and gasPrice is 10^18. Unit of KAIA is described here.

Signature Validation

Because Kaia decouples key pairs from addresses, signature validation differs from typical blockchains. The from field is crucial, as it identifies the sender. The AccountKey associated with the from address is used to validate the signature.

Fee Delegation and SenderTxHash

Kaia's fee delegation feature allows a third party to pay transaction fees. This requires two signatures – one from the sender and one from the fee payer. The SenderTxHash is crucial for tracking fee-delegated transactions. It's a hash of the transaction without the fee payer's information, allowing the sender to track the transaction before the fee payer signs it. The sender can use the SenderTxHash to retrieve the complete transaction via the kaia_getTransactionBySenderTxHash RPC method.

Transaction Types

While typical Blockchain platforms provide a single transaction type, Kaia provides multiple transaction types that empower transactions with new capabilities and optimizations for memory footprint and performance. The following table provides an overview of the transaction types available on Kaia:

BasicFee DelegationPartial Fee Delegation
LegacyTxTypeLegacyTransactionN/AN/A
ValueTransferTxTypeValueTransferTxTypeFeeDelegatedValueTransferTxTypeFeeDelegatedValueTransferWithRatio
ValueTransferMemoTxTypeValueTransferMemoTxTypeFeeDelegatedValueTransferMemoTxTypeFeeDelegatedValueTransferMemoWithRatio
SmartContractDeployTxTypeSmartContractDeployTxTypeFeeDelegatedSmartContractDeployTxTypeFeeDelegatedSmartContractDeployWithRatio
SmartContractExecutionTxTypeSmartContractExecutionTxTypeFeeDelegatedSmartContractExecutionTxTypeFeeDelegatedSmartContractExecutionWithRatio
AccountUpdateTxTypeAccountUpdateTxTypeFeeDelegatedAccountUpdateTxTypeFeeDelegatedAccountUpdateWithRatio
CancelTxTypeCancelTxTypeFeeDelegatedCancelTxTypeFeeDelegatedCancelWithRatio
ChainDataAnchoringTxTypeChainDataAnchoringTxTypeFeeDelegatedChainDataAnchoringTxTypeFeeDelegatedChainDataAnchoringWithRatio

Implementation Details

  • RLP Encoding: Transactions are serialized using Recursive Length Prefix (RLP) encoding before submission.
  • Signatures: Transactions are signed using [Specify signature algorithm, e.g., ECDSA] to ensure authenticity.
  • Examples and RPC Outputs: This section will provide practical examples and expected RPC outputs for each transaction type. (Note: TxTypeValueTransfer sends KAIA without any additional data, while TxTypeValueTransferMemo allows for including a short memo field along with the transfer.)

By understanding these components and implementation details, developers can effectively build applications on the Kaia network.

페이지를 개선해 주세요