기본
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.
- 4.
value
KLAY가 발신자로부터 수신자로 전송됩니다. - 5.
to
가 nil이라면 스마트컨 트랙트 배포를 위한 트랜잭션으로 간주됩니다. 스마트 컨트랙트 코드는input
을 통해 전달되어야 합니다. - 6.
to
가 스마트 컨트랙트라면input
에 명시된 스마트 컨트랙트 함수가 실행됩니다.
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 직렬화를 수행해야합니다.
SigRLP = encode([nonce, gasPrice, gas, to, value, input, chainid, 0, 0])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)
SenderTxHash를 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.
SenderTxHashRLP = encode([nonce, gasPrice, gas, to, value, input, v, r, s])
SenderTxHash = keccak256(SenderTxHashRLP)
트랜잭션 해시를 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.
TxHashRLP = encode([nonce, gasPrice, gas, to, value, input, v, r, s])
TxHash = keccak256(TxHashRLP)
다음은 RLP 직렬화의 결과와 트랜잭션 오브젝트를 보여줍니다.
ChainID 0x1
PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d
PublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3
SigRLP 0xe68204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a8431323334018080
SigHash 0x40e73366650cddb7affcf5af39efa864b2c68c42b5329044fc86a12b26c4edc7
Signature f845f84325a0b2a5a15550ec298dc7dddde3774429ed75f864c82caeb5ee24399649ad731be9a029da1014d16f2011b3307f7bbe1035b6e699a4204fc416c763def6cefd976567
TxHashRLP 0xf8668204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a843132333425a0b2a5a15550ec298dc7dddde3774429ed75f864c82caeb5ee24399649ad731be9a029da1014d16f2011b3307f7bbe1035b6e699a4204fc416c763def6cefd976567
TxHash e434257753bf31a130c839fec0bd34fc6ea4aa256b825288ee82db31c2ed7524
SenderTxHashRLP 0xf8668204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a843132333425a0b2a5a15550ec298dc7dddde3774429ed75f864c82caeb5ee24399649ad731be9a029da1014d16f2011b3307f7bbe1035b6e699a4204fc416c763def6cefd976567
SenderTxHash e434257753bf31a130c839fec0bd34fc6ea4aa256b825288ee82db31c2ed7524
TX(e434257753bf31a130c839fec0bd34fc6ea4aa256b825288ee82db31c2ed7524)
Contract: false
From: a94f5374fce5edbc8e2a8697c15331677e6ebf0b
To: 7b65b75d204abed71587c9e519a89277766ee1d0
Nonce: 1234
GasPrice: 0x19
GasLimit 0xf4240
Value: 0xa
Data: 0x31323334
V: 0x25
R: 0xb2a5a15550ec298dc7dddde3774429ed75f864c82caeb5ee24399649ad731be9
S: 0x29da1014d16f2011b3307f7bbe1035b6e699a4204fc416c763def6cefd976567
Hex: f8668204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a843132333425a0b2a5a15550ec298dc7dddde3774429ed75f864c82caeb5ee24399649ad731be9a029da1014d16f2011b3307f7bbe1035b6e699a4204fc416c763def6cefd976567
다음은 JSON RPC를 통해 반환된 트랜잭션 오브젝트를 보여줍니다.
{
"blockHash": "0xeff95d8c57d668aa274a0eaeff942ecc2cfca4c71f71ae9fdaba92735cd79b9e",
"blockNumber": "0x1",
"contractAddress": null,
"from": "0x33c97827c33d8c5e07eb263ed6ec5c229e8b4752",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"gasUsed": "0x5208",
"input": "0x",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0",
"senderTxHash": "0xff0e9a45aa8741d528baf84069cd3b52c43a51bf7cf69d896672c3c909507888",
"signatures": [
{
"V": "0x25",
"R": "0xed8aa552324101a99792860d479cd488b7f67af0b9205968748bddcda52da6de",
"S": "0x524dbf481ea1d77c20f4d4354cc208c3149ddfa06f7ab53a03ad82d2d7fed3"
}
],
"status": "0x1",
"to": "0xd03227635c90c7986f0e3a4e551cefbca8c55316",
"transactionHash": "0xff0e9a45aa8741d528baf84069cd3b52c43a51bf7cf69d896672c3c909507888",
"transactionIndex": "0x0",
"type": "TxTypeLegacyTransaction",
"typeInt": 0,
"value": "0x174876e800"
}
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.
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) | |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) |
트랜잭션 서명을 만들려면 다음과 같이 RLP 직렬화를 수행해야합니다.
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from]), chainid, 0, 0])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)
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)
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]]
TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, txSignatures])
TxHash = keccak256(TxHashRLP)
다음은 주어진 인수에 대한 RLP 직렬화의 결과와 트랜잭션 오브젝트의 정보를 보여줍니다.
ChainID 0x1
PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d
PublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3
SigRLP 0xf839b5f4088204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b018080
SigHash 0xaa7665566c9508140bb91e36a948fc8f61c4518400a69562432d17e064f3ce43
Signature f845f84325a0f3d0cd43661cabf53425535817c5058c27781f478cb5459874feaa462ed3a29aa06748abe186269ff10b8100a4b7d7fea274b53ea2905acbf498dc8b5ab1bf4fbc
TxHashRLP 0x08f87a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a0f3d0cd43661cabf53425535817c5058c27781f478cb5459874feaa462ed3a29aa06748abe186269ff10b8100a4b7d7fea274b53ea2905acbf498dc8b5ab1bf4fbc
TxHash 762f130342569e9669a4d8547f1248bd2554fbbf3062d63a97ce28bfa97aa9d7
SenderTxHashRLP 0x08f87a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a0f3d0cd43661cabf53425535817c5058c27781f478cb5459874feaa462ed3a29aa06748abe186269ff10b8100a4b7d7fea274b53ea2905acbf498dc8b5ab1bf4fbc
SenderTxHash 762f130342569e9669a4d8547f1248bd2554fbbf3062d63a97ce28bfa97aa9d7
TX(762f130342569e9669a4d8547f1248bd2554fbbf3062d63a97ce28bfa97aa9d7)
Type: TxTypeValueTransfer
From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B
To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0
Nonce: 1234
GasPrice: 0x19
GasLimit: 0xf4240
Value: 0xa
Signature: [{"V":"0x25","R":"0xf3d0cd43661cabf53425535817c5058c27781f478cb5459874feaa462ed3a29a","S":"0x6748abe186269ff10b8100a4b7d7fea274b53ea2905acbf498dc8b5ab1bf4fbc"}]
Hex: 08f87a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bf845f84325a0f3d0cd43661cabf53425535817c5058c27781f478cb5459874feaa462ed3a29aa06748abe186269ff10b8100a4b7d7fea274b53ea2905acbf498dc8b5ab1bf4fbc
The following shows a transaction object returned via JSON RPC.
{
"blockHash": "0xeff95d8c57d668aa274a0eaeff942ecc2cfca4c71f71ae9fdaba92735cd79b9e",
"blockNumber": "0x1",
"contractAddress": null,
"from": "0x33c97827c33d8c5e07eb263ed6ec5c229e8b4752",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"gasUsed": "0x5208",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x1",
"senderTxHash": "0x8c18c9a609d2b22c921ce0b282e64924bf073e84f7c3850d99ec71da4054f79d",
"signatures": [
{
"V": "0x25",
"R": "0x94e059980bce9f3ba5f09e5021ad4f32d7d9cfda938c2d38c989cd4a406e7ba",
"S": "0x3ca52ee9d23954a278e6a30f3ec40951b26fb8b3f784c236c5bb1d5c9a8b2c82"
}
],
"status": "0x1",
"to": "0x75c3098be5e4b63fbac05838daaee378dd48098d",
"transactionHash": "0x8c18c9a609d2b22c921ce0b282e64924bf073e84f7c3850d99ec71da4054f79d",
"transactionIndex": "0x1",
"type": "TxTypeValueTransfer",
"typeInt": 8,
"value": "0x21e19e0c9bab2400000"
}
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.
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) | |
input | []byte (Go) | Data attached to the transaction. 메시지는 이 속성으로 전달되어야 합니다. |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) |
To make a transaction signature, 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, <private key>)
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, input, txSignatures])
SenderTxHash = keccak256(SenderTxHashRLP)
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]]
TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, input, txSignatures])
TxHash = keccak256(TxHashRLP)
The following shows the result of RLP serialization and the transaction object:
ChainID 0x1
PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d
PublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3
SigRLP 0xf841b83cf83a108204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b8568656c6c6f018080
SigHash 0x23dd6ca2c023a152cad636ac8ed0a1a7962d3eb4cb7f3c50e34c0cc42e37d48a
Signature f845f84325a07d2b0c89ee8afa502b3186413983bfe9a31c5776f4f820210cffe44a7d568d1ca02b1cbd587c73b0f54969f6b76ef2fd95cea0c1bb79256a75df9da696278509f3
TxHashRLP 0x10f8808204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b8568656c6c6ff845f84325a07d2b0c89ee8afa502b3186413983bfe9a31c5776f4f820210cffe44a7d568d1ca02b1cbd587c73b0f54969f6b76ef2fd95cea0c1bb79256a75df9da696278509f3
TxHash 6c7ee543c24e5b928b638a9f4502c1eca69103f5467ed4b6a2ed0ea5aede2e6b
SenderTxHashRLP 0x10f8808204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b8568656c6c6ff845f84325a07d2b0c89ee8afa502b3186413983bfe9a31c5776f4f820210cffe44a7d568d1ca02b1cbd587c73b0f54969f6b76ef2fd95cea0c1bb79256a75df9da696278509f3
SenderTxHash 6c7ee543c24e5b928b638a9f4502c1eca69103f5467ed4b6a2ed0ea5aede2e6b
TX(6c7ee543c24e5b928b638a9f4502c1eca69103f5467ed4b6a2ed0ea5aede2e6b)
Type: TxTypeValueTransferMemo
From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B
To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0
Nonce: 1234
GasPrice: 0x19
GasLimit: 0xf4240
Value: 0xa
Signature: [{"V":"0x25","R":"0x7d2b0c89ee8afa502b3186413983bfe9a31c5776f4f820210cffe44a7d568d1c","S":"0x2b1cbd587c73b0f54969f6b76ef2fd95cea0c1bb79256a75df9da696278509f3"}]
Data: 36383635366336633666
Hex: 10f8808204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b8568656c6c6ff845f84325a07d2b0c89ee8afa502b3186413983bfe9a31c5776f4f820210cffe44a7d568d1ca02b1cbd587c73b0f54969f6b76ef2fd95cea0c1bb79256a75df9da696278509f3
The following shows a transaction object returned via JSON RPC.
{
"blockHash": "0x7ad6ed1f9955be00db8fb5452125f0e9a3c0856abb5b4cc4aed91ffc134321da",
"blockNumber": "0x1",
"contractAddress": null,
"from": "0x0fcda0f2efbe1b4e61b487701ce4f2f8abc3723d",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"gasUsed": "0x53fc",
"input": "0x68656c6c6f",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x4",
"senderTxHash": "0x7311ef305064f2a6997c16cc8b5fc3fdf301549e7b7d0baa3a995a8e79479e5e",
"signatures": [
{
"V": "0x25",
"R": "0xd63673e1be7919e7ca42de64931c853fc568557b151e9b335df94b22de3a600f",
"S": "0x57bc916a50856b4d197f6856f16370f72f3bb0ac411b1da793fdb5bb7066966f"
}
],
"status": "0x1",
"to": "0x75c3098be5e4b63fbac05838daaee378dd48098d",
"transactionHash": "0x7311ef305064f2a6997c16cc8b5fc3fdf301549e7b7d0baa3a995a8e79479e5e",
"transactionIndex": "0x4",
"type": "TxTypeValueTransferMemo",
"typeInt": 16,
"value": "0x989680"
}
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.
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) | |
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) |
To make a signature of this transaction type, RLP serialization should be done like the following:
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, input, humanReadable, codeFormat]), chainid, 0, 0])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)
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, input, humanReadable, codeFormat, txSignatures])
SenderTxHash = keccak256(SenderTxHashRLP)
수수료 납부자의 서명을 만들려면 RLP 직렬화를 다음과 같이 수행해야합니다.
txSignatures (a single signature) = [[v, r, s]]
txSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]
TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, input, humanReadable, codeFormat, txSignatures])
TxHash = keccak256(TxHashRLP)
The following shows the result of RLP serialization and the transaction object:
ChainID 0x1
PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d
PublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3
SigRLP 0xf90240b9023af90237288204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bb901fe608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f00290180018080
SigHash 0xa921fa892d5dec0837bd32c1fb77fc3b2df57ec0b0c4eea79192c79883ed543c
Signature f845f84325a0fcd107738fb47750ba727610aefd6d5f51ac8163d62ce500e7ab7e15defe7088a0383d68220d0266490ea4173c1d7847f22fcbe22f8c8125e1c0589189845c902a
TxHashRLP 0x28f9027d8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bb901fe608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f00290180f845f84325a0fcd107738fb47750ba727610aefd6d5f51ac8163d62ce500e7ab7e15defe7088a0383d68220d0266490ea4173c1d7847f22fcbe22f8c8125e1c0589189845c902a
TxHash e983f38b814891990f3ca57028c2230dc7e907eb313c827e7c99fadcc9b4c58b
SenderTxHashRLP 0x28f9027d8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bb901fe608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f00290180f845f84325a0fcd107738fb47750ba727610aefd6d5f51ac8163d62ce500e7ab7e15defe7088a0383d68220d0266490ea4173c1d7847f22fcbe22f8c8125e1c0589189845c902a
SenderTxHash e983f38b814891990f3ca57028c2230dc7e907eb313c827e7c99fadcc9b4c58b
TX(e983f38b814891990f3ca57028c2230dc7e907eb313c827e7c99fadcc9b4c58b)
Type: TxTypeSmartContractDeploy
From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B
To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0
Nonce: 1234
GasPrice: 0x19
GasLimit: 0xf4240
Value: 0xa
Signature: [{"V":"0x25","R":"0xfcd107738fb47750ba727610aefd6d5f51ac8163d62ce500e7ab7e15defe7088","S":"0x383d68220d0266490ea4173c1d7847f22fcbe22f8c8125e1c0589189845c902a"}]
Data: 363038303630343035323334383031353631303031303537363030303830666435623530363130316465383036313030323036303030333936303030663330303630383036303430353236303034333631303631303036313537363366666666666666663763303130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630303033353034313636333161333964386566383131343631303038303537383036333633353335383662313436313030613735373830363337306130383233313134363130306361353738303633666436623765663831343631303066383537356233333630303039303831353236303031363032303532363034303831323038303534333439303831303139303931353538313534303139303535303035623334383031353631303038633537363030303830666435623530363130303935363130313064353635623630343038303531393138323532353139303831393030333630323030313930663335623631303063383733666666666666666666666666666666666666666666666666666666666666666666666666666666663630303433353136363130313133353635623030356233343830313536313030643635373630303038306664356235303631303039353733666666666666666666666666666666666666666666666666666666666666666666666666666666663630303433353136363130313437353635623334383031353631303130343537363030303830666435623530363130306338363130313539353635623630303035343831353635623733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363030303930383135323630303136303230353236303430383132303830353433343930383130313930393135353831353430313930353535363562363030313630323035323630303039303831353236303430393032303534383135363562333336303030393038313532363030313630323035323630343038313230383035343930383239303535393038313131313536313031616635373630343035313333393038323135363130386663303239303833393036303030383138313831383538383838663139333530353035303530313536313031396335373631303161663536356233333630303039303831353236303031363032303532363034303930323038313930353535623530353630306131363536323761376137323330353832303632376361343662623039343738613031353736323830366363303063343331323330353031313138633763323663333061633538633465303965353163346630303239
HumanReadable: true
CodeFormat: CodeFormatEVM
Hex: 28f9027d8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0bb901fe608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f00290180f845f84325a0fcd107738fb47750ba727610aefd6d5f51ac8163d62ce500e7ab7e15defe7088a0383d68220d0266490ea4173c1d7847f22fcbe22f8c8125e1c0589189845c902a
The following shows a transaction object returned via JSON RPC.
{
"blockHash": "0x82983fe294d286e76486760e6904369285554e1744af16786c2393a956fb4ec4",
"blockNumber": "0x2",
"codeFormat": "0x0",
"contractAddress": "0x636f6e74726163742e6b6c6179746e0000000000",
"from": "0x0fcda0f2efbe1b4e61b487701ce4f2f8abc3723d",
"gas": "0x174876e800",
"gasPrice": "0x0",
"gasUsed": "0xee6e343d",
"humanReadable": true,
"input": "0x608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f0029",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0xa",
"senderTxHash": "0x78a5633ee5b453ed2f00937e65945a3b76e96623634e1555e2f15d44930168af",
"signatures": [
{
"V": "0x25",
"R": "0x369d892dc24786111fd8f0308e8a6518708727257e95b3281865508faa0a768b",
"S": "0x12fc22c390a89484d1cb70e1f19c4fa8a203b1406044ee9c263264876f0dd724"
}
],
"status": "0x1",
"to": "0x636f6e74726163742e6b6c6179746e0000000000",
"transactionHash": "0x78a5633ee5b453ed2f00937e65945a3b76e96623634e1555e2f15d44930168af",
"transactionIndex": "0x3",
"type": "TxTypeSmartContractDeploy",
"typeInt": 40,
"value": "0x0"
}
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
에 값이 입력되었으면 발신자에서to
로value
KLAY가 전송됩니다. 컨트랙트가 KLAY를 받기 위해서는 컨트랙트는 payable fallback function을 가져야 합니다.
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) | |
input | []byte (Go) | Data attached to the transaction, used for transaction execution. |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) |
To make a signature of this transaction type, 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, <private key>)
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, input, txSignatures])
SenderTxHash = keccak256(SenderTxHashRLP)
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]]
TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, input, txSignatures])
TxHash = keccak256(TxHashRLP)
The following shows the result of RLP serialization and the transaction object:
ChainID 0x1
PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d
PublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3
SigRLP 0xf860b85bf859308204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0ba46353586b000000000000000000000000bc5951f055a85f41a3b62fd6f68ab7de76d299b2018080
SigHash 0x197ea7d262f74489934d6cbcf8baa3bec169c16ad672fef4a9f8148864c9cdce
Signature f845f84326a0e4276df1a779274fbb04bc18a0184809eec1ce9770527cebb3d64f926dc1810ba04103b828a0671a48d64fe1a3879eae229699f05a684d9c5fd939015dcdd9709b
TxHashRLP 0x30f89f8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0ba46353586b000000000000000000000000bc5951f055a85f41a3b62fd6f68ab7de76d299b2f845f84326a0e4276df1a779274fbb04bc18a0184809eec1ce9770527cebb3d64f926dc1810ba04103b828a0671a48d64fe1a3879eae229699f05a684d9c5fd939015dcdd9709b
TxHash 23bb192bd58d56527843eb63225c5213f3aded95e4c9776f1ff0bdd8ee0b6826
SenderTxHashRLP 0x30f89f8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0ba46353586b000000000000000000000000bc5951f055a85f41a3b62fd6f68ab7de76d299b2f845f84326a0e4276df1a779274fbb04bc18a0184809eec1ce9770527cebb3d64f926dc1810ba04103b828a0671a48d64fe1a3879eae229699f05a684d9c5fd939015dcdd9709b
SenderTxHash 23bb192bd58d56527843eb63225c5213f3aded95e4c9776f1ff0bdd8ee0b6826
TX(23bb192bd58d56527843eb63225c5213f3aded95e4c9776f1ff0bdd8ee0b6826)
Type: TxTypeSmartContractExecution
From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B
To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0
Nonce: 1234
GasPrice: 0x19
GasLimit: 0xf4240
Value: 0xa
Signature: [{"V":"0x26","R":"0xe4276df1a779274fbb04bc18a0184809eec1ce9770527cebb3d64f926dc1810b","S":"0x4103b828a0671a48d64fe1a3879eae229699f05a684d9c5fd939015dcdd9709b"}]
Data: 363335333538366230303030303030303030303030303030303030303030303062633539353166303535613835663431613362363266643666363861623764653736643239396232
Hex: 30f89f8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0ba46353586b000000000000000000000000bc5951f055a85f41a3b62fd6f68ab7de76d299b2f845f84326a0e4276df1a779274fbb04bc18a0184809eec1ce9770527cebb3d64f926dc1810ba04103b828a0671a48d64fe1a3879eae229699f05a684d9c5fd939015dcdd9709b
The following shows a transaction object returned via JSON RPC.
{
"blockHash": "0x82983fe294d286e76486760e6904369285554e1744af16786c2393a956fb4ec4",
"blockNumber": "0x2",
"contractAddress": null,
"from": "0x0fcda0f2efbe1b4e61b487701ce4f2f8abc3723d",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"gasUsed": "0xfedc",
"input": "0x6353586b0000000000000000000000000fcda0f2efbe1b4e61b487701ce4f2f8abc3723d",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0xd",
"senderTxHash": "0xe216873dedd72d8d67a9f5e51eb5a7ed2b5f34bca334adff7a3601d6d3e2e132",
"signatures": [
{
"V": "0x26",
"R": "0x68fe3dfd1ff3ea14427f157b5837cb6eb0b00fd0497e1c80897de1935200f0",
"S": "0x6b84fbedcb4ff785120890596fad3f797c178cda8908f3b02ee0a4442fbf4189"
}
],
"status": "0x1",
"to": "0x636f6e74726163742e6b6c6179746e0000000000",
"transactionHash": "0xe216873dedd72d8d67a9f5e51eb5a7ed2b5f34bca334adff7a3601d6d3e2e132",
"transactionIndex": "0x6",
"type": "TxTypeSmartContractExecution",
"typeInt": 48,
"value": "0xa"
}
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
로 검증됩니다.
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) | |
key | AccountKey (Go) | |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) |
To make a signature of this transaction type, RLP serialization should be done like the following:
SigRLP = encode([encode([type, nonce, gasPrice, gas, from, rlpEncodedKey]), chainid, 0, 0])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)
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, from, rlpEncodedKey, txSignatures])
SenderTxHash = keccak256(SenderTxHashRLP)
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]]
TxHashRLP = type + encode([nonce, gasPrice, gas, from, rlpEncodedKey, txSignatures])
TxHash = keccak256(TxHashRLP)
The following shows the result of RLP serialization and the transaction object: