기본

TxTypeLegacyTransaction

TxTypeLegacyTransaction은 이전에 Klaytn에 존재했던 트랜잭션 유형을 의미합니다. Since this transaction type exists to support compatibility, it only works with EOAs associated with AccountKeyLegacy. 다른 계정 키 유형과 연결된 EOA는 TxTypeValueTransfer, TxTypeSmartContractExecution 같은 다른 트랜잭션 유형을 사용해야 합니다. 이 유형의 트랜잭션은 계정 생성, 토큰 전송, 스마트 컨트랙트 배포, 스마트 컨트랙트 실행 또는 앞에서 언급한 것들을 혼합하여 실행할 수 있습니다. 이 트랜잭션 유형은 다음과 같은 변경 사항을 만듭니다.

  1. 발신자의 잔고는 트랜잭션 수수료만큼 줄어듭니다.

  2. 발신자의 논스가 1 증가합니다.

  3. If to does not exist on Klaytn, an EOA associated with AccountKeyLegacy is created.

  4. value KLAY가 발신자로부터 수신자로 전송됩니다.

  5. to가 nil이라면 스마트컨 트랙트 배포를 위한 트랜잭션으로 간주됩니다. 스마트 컨트랙트 코드는 input을 통해 전달되어야 합니다.

  6. to가 스마트 컨트랙트라면 input에 명시된 스마트 컨트랙트 함수가 실행됩니다.

Attributes

Attribute
Type
Description

value

*big.Int (Go)

The amount of KLAY in peb to be transferred.

to

*common.Address (Go)

The account address that will receive the transferred value.

input

[]byte (Go)

Data attached to the transaction, used for transaction execution.

v, r, s

*big.Int (Go)

The cryptographic signature generated by the sender to let the receiver obtain the sender's address.

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.

gas

uint64 (Go)

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

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.

서명 RLP 인코딩

이 트랜잭션 유형의 서명을 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.

SenderTxHash를 위한 RLP 인코딩

SenderTxHash를 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.

트랜잭션 해시를 위한 RLP 인코딩

트랜잭션 해시를 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.

RLP Encoding (Example)

다음은 RLP 직렬화의 결과와 트랜잭션 오브젝트를 보여줍니다.

RPC Output (예시)

다음은 JSON RPC를 통해 반환된 트랜잭션 오브젝트를 보여줍니다.

TxTypeValueTransfer

TxTypeValueTransfer is used when a user wants to send KLAY. Klaytn은 각 목적에 맞는 여러가지 트랜잭션 유형들을 제공하는데, TxTypeValueTransfer는 KLAY를 EOA에 전송할 때 사용하는 기능입니다. 따라서 TxTypeValueTransfer는 to가 EOA일때만 작동합니다. KLAY를 스마트 컨트랙트로 전송하려면 TxTypeSmartContractExecution를 대신 사용하여야 합니다. 이 트랜잭션 유형은 다음과 같은 변경 사항을 만듭니다.

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

  2. The sender's nonce increases by one.

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

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeValueTransfer의 유형입니다. 이는 0x08이어야 합니다.

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)

발신자가 트랜잭션 수수료로 지불하는 가스의 단가입니다(단위는 peb). 트랜잭션 수수료는 gas * gasPrice으로 계산됩니다. 예를 들어, 만약 가스가 10이 필요하고 gasPrice가 10^18이라면 발신자는 트랜잭션을 위해 10 KLAY를 지급해야 합니다. See Unit of KLAY.

gas

uint64 (Go)

트랜잭션에서 사용하도록 허락된 최대 트랜잭션 수수료입니다.

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. 자세한 내용은 트랜잭션의 서명 검증을 참고해주세요.

txSignatures

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

발신자의 서명입니다. For more details, see Signature Validation of Transactions.

RLP Encoding for Signature

트랜잭션 서명을 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.

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)

다음은 주어진 인수에 대한 RLP 직렬화의 결과와 트랜잭션 오브젝트의 정보를 보여줍니다.

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

TxTypeValueTransferMemo

TxTypeValueTransferMemo is used when a user wants to send KLAY with a specific message. 따라서 TxTypeValueTransferMemo는 to가 EOA일때만 작동합니다. To transfer KLAY to a smart contract account, use TxTypeSmartContractExecution instead. The following changes will be made by this transaction type.

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

  2. The sender's nonce increases by one.

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

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeValueTransferMemo의 유형입니다. 이는 0x10이어야 합니다.

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. 메시지는 이 속성으로 전달되어야 합니다.

txSignatures

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

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

RLP Encoding for Signature

To make a transaction signature, 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.

TxTypeSmartContractDeploy

TxTypeSmartContractDeploy deploys a smart contract to the given address. The following changes will be made by this transaction type.

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

  2. The sender's nonce increases by one.

  3. input에 기입된 코드로 스마트 컨트랙트가 배포됩니다. 배포된 주소는 영수증의 contractAddress를 통해 반환됩니다.

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

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeSmartContractDeploy의 유형입니다. 이는 0x28이어야 합니다.

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. 현재 이 값은 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)

Human-readable address는 아직 지원되지 않으므로 이 값은 false여야 합니다. 이 값이 true라면 트랜잭션은 실패합니다.

codeFormat

uint8 (Go)

The code format of smart contract code. 현재는 오직 EVM(0x00)만 지원됩니다.

txSignatures

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

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

RLP Encoding for Signature

To make a signature of this transaction type, 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

수수료 납부자의 서명을 만들려면 RLP 직렬화를 다음과 같이 수행해야합니다.

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.

TxTypeSmartContractExecution

TxTypeSmartContractExecution executes a smart contract with the given data in input. TxTypeSmartContractExecution는 to가 스마트 컨트랙트 계정일 때만 실행됩니다. KLAY를 외부 소유 계정으로 전송하려면 TxTypeValueTransfer를 대신 사용하십시오. The following changes will be made by this transaction type.

  1. to가 스마트 컨트랙트라면 input을 이용하여 코드가 실행됩니다. 그렇지 않으면 트랜잭션은 거절됩니다.

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

  3. The sender's nonce increases by one.

  4. value에 값이 입력되었으면 발신자에서 tovalue KLAY가 전송됩니다. 컨트랙트가 KLAY를 받기 위해서는 컨트랙트는 payable fallback function을 가져야 합니다.

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeSmartContractExecution의 유형입니다. 이는 0x30이어야 합니다.

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.

txSignatures

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

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

RLP Encoding for Signature

To make a signature of this transaction type, 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.

TxTypeAccountUpdate

TxTypeAccountUpdate updates the key of the given account. 이 트랜잭션 유형은 다음과 같은 변경 사항을 만듭니다.

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

  2. The sender's nonce increases by one.

  3. 계정의 키는 key로 업데이트됩니다.

  4. 이 유형의 트랜잭션이 실행되고 나면 계정에서 전송된 트랜잭션은 새 key로 검증됩니다.

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeAccountUpdate의 유형입니다. 이는 0x20이어야 합니다.

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.

txSignatures

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

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

RLP Encoding for Signature

To make a signature of this transaction type, 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.

TxTypeCancel

TxTypeCancel cancels the execution of the transaction with the same nonce in the transaction pool. 이 트랜잭션 유형은 제출된 트랜잭션이 일정 시간 동안 처리되지 않은 것으로 보일 때 유용합니다. 트랜잭션이 처리되지 않은 것처럼 보이는 경우가 몇 가지 있습니다: 1. 트랜잭션이 어딘가에서 손실되어 컨센서스 노드에 도달하지 못하는 경우 2. 어떤 컨센서스 노드에서도 아직 트랜잭션이 처리되지 않은 경우 3. 트랜잭션이 처리되었지만 트랜잭션이 포함된 블록이 전달되지 않은 경우

클라이언트 쪽에서는 정확한 원인을 파악하기가 매우 어렵습니다. 이유를 파악하려면 모든 컨센서스 노드를 살펴봐야 합니다. 단, 일반 사람들이 컨센서스 노드에 연결하는 것은 금지됩니다. 이러한 상황에서 일반적인 블록체인 플랫폼에서는 사용자가 이전 트랜잭션을 대체하기 위해 다른 트랜잭션을 더 높은 가스 가격으로 제출하는 경우가 많습니다. 다만, Klaytn에서는 가스 가격이 고정돼 있기 때문에, 기존 트랜잭션을 더 높은 가스 가격으로 대체하는 것은 불가능합니다.

트랜잭션이 처리되지 않은 상태로 유지되는 경우, 더 높은 논스를 가진 다른 트랜잭션이 처리될 수 없습니다. 논스로 트랜잭션 실행 순서가 결정되기 때문입니다.

이 문제를 해결하기 위해 Klaytn은 트랜잭션 유형 TxTypeCancel을 제공합니다. 사용자는 이러한 상황에 직면하면 TxTypeCancel 트랜잭션을 전송할 수 있습니다.

위의 각 상황은 다음과 같이 처리됩니다. 1. 이전 트랜잭션이 손실된 경우 TxTypeCancel 트랜잭션이 실행되어 블록에 포함됩니다. 2. 이전 트랜잭션이 아직 처리되지 않은 경우 TxTypeCancel은 이전 트랜잭션을 대체합니다. 그런 다음 실행되어 블록에 포함됩니다. 3. 이전 트랜잭션이 이미 실행된 경우, 논스가 증가했으므로 TxTypeCancel 트랜잭션은 논스가 낮아서 삭제됩니다.

TxTypeCancel 트랜잭션은 동일한 논스의 트랜잭션을 대체 할 수 있는 유일한 트랜잭션입니다. 다른 트랜잭션 유형은동일한 논스의 트랜잭션으로 바꿀 수 없습니다.

이 트랜잭션 유형은 다음과 같은 변경 사항을 만듭니다. 1. The sender's balance decreases by the amount of the transaction fee. 2. The sender's nonce increases by one.

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeCancel의 유형입니다. 이는 0x38이어야 합니다.

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. TxTypeCancel을 사용할 때 이 값은 취소할 타겟 트랜잭션의 논스 값과 같아야 합니다.

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.

txSignatures

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

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

결과:

  1. 같은 논스를 가진 트랜잭션이 있으면, 이 취소 트랜잭션으로 대체됩니다.

  2. 만약 같은 논스가 없으면 이 트랜잭션은 보통 트랜잭션으로 삽입됩니다.

  3. 취소 트랜잭션은 다른 트랜잭션 유형으로 대체되지 않습니다.

RLP Encoding for Signature

To make a transaction signature, 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.

TxTypeChainDataAnchoring

TxTypeChainDataAnchoringTransaction는 서비스체인 데이터를 Klaytn 메인체인에 앵커링하는 트랜잭션입니다. 서비스체인은 주기적으로 이러한 종류의 트랜잭션을 Klaytn 메인체인에 보내어 자신의 데이터 보안과 신뢰성을 검증받습니다. 데이터 앵커링에 관한 더 자세한 내용은 Anchoring을 참조하시기 바랍니다. 이 트랜잭션은 RPC 호출로 전송하시면 안 된다는 점을 유의하시기 바랍니다. 현재 이 트랜잭션은 보안상의 이유로 비공개 p2p 채널을 통해 실행됩니다. 이 트랜잭션은 발신자의 논스를 1씩 증가시키는 것을 제외하고는 Klaytn 블록 체인의 상태를 변경하지 않습니다.

Attributes

Attribute
Type
Description

type

uint8 (Go)

TxTypeChainDataAnchoringTransaction의 유형입니다. 이는 0x48이어야 합니다.

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.

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.

RLP Encoding for Signature

To make a signature of this transaction type, 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

Was this helpful?