Nhảy tới nội dung
This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)

Ethereum Compatibility

Kaia provides wrapped transaction types to support Ethereum compatibility. Ethereum transaction types in Kaia have the same attributes and RLP encoding schemes with Ethereum's design except for the single-byte type delimiter called EthereumTxTypeEnvelope. Therefore, users can successfully deploy transactions generated by Ethereum development tools on Kaia. The type delimiter is also omitted when users use eth namespace APIs, so they can use Kaia just as if they were using Ethereum. Using kaia namespace APIs, users can deploy and retrieve Ethereum formatted transactions as a type of Kaia transactions without getting confused with the existing Kaia transaction types.

EthereumTxTypeEnvelope

EthereumTxTypeEnvelope is a single-byte prefix for raw transactions that denotes Ethereum transaction types. Ethereum has adopted an extendable transaction type scheme from EIP-2718 and it uses a type numbering system that conflicts with Kaia's. To resolve the conflict between two different transaction type schemes, Kaia has introduced EthereumTxTypeEnvelope which allows for separation and expansion for future Ethereum transaction types.

EthereumTxTypeEnvelope is an additional type delimiter and used only for raw transactions and type numbering. It is not used for transaction hash or signature hash. For that purpose, EthereumTransactionType as defined in EIPs is used.

  • EthereumTxTypeEnvelope: 0x78
  • TxHashRLP : EthereumTransactionType || TransactionPayload
  • RawTransaction : EthereumTxTypeEnvelope || EthereumTransactionType || TransactionPayload

TxTypeEthereumAccessList

TxTypeEthereumAccessList represents a type of Ethereum transaction specified in EIP-2930. This transactions type contains an access list, a list of addresses and storage keys that the transaction is supposed to access. Since this transaction type exists to support compatibility, it only works with EOAs associated with [AccountKeyLegacy]. EOAs associated with other account key types should use other transaction types such as TxTypeValueTransfer, TxTypeSmartContractExecution, and so on. This transaction type can create accounts, transfer tokens, deploy/execute smart contracts or a mix of the aforementioned.

ghi chú

Kaia networks can process this transaction type after the EthTxTypeCompatibleBlock

ghi chú

NOTE: This transaction type only supports the format of the Ethereum transaction type. Unlike EIP-2930, there are no benefits in terms of transaction fee from using access list.

Attributes

AttributeTypeDescription
typeuint8 (Go)The type of TxTypeEthereumAccessList that is a concatenation of EthereumTxTypeEnvelope and EthereumTransactionType. This must be 0x7801.
chainId*big.Int (Go)The destination chain ID.
nonceuint64 (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 KAIA for a transaction fee if gas is 10 and gasPrice is 10^18. See Unit of KAIA.
gasuint64 (Go)The maximum amount of transaction fee 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.
data[]byte (Go)Data attached to the transaction, used for transaction execution.
accessListtype.AccessList (Go)A list of addresses and storage keys consisting of [](common.Address, []common.Hash).
v, r, s*big.Int (Go)The cryptographic signature generated by the sender to let the receiver obtain the sender's address.

RLP Encoding for Signature

To make a signature for this transaction type, the RLP serialization proceeds as follows:

ghi chú

This type of transaction should be signed with London Signer


SigRLP = EthereumTransactionType || encode([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)

RLP Encoding for SenderTxHash

To obtain SenderTxHash for this transaction type, the RLP serialization proceeds as follows:


SenderTxHashRLP = EthereumTransactionType || encode([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s])
SenderTxHash = keccak256(SenderTxHashRLP)
Signature = sign(SenderTxHash, <private key>)

RLP Encoding for Transaction Hash

To make a transaction hash, the RLP serialization proceeds as follows:


TxHashRLP = EthereumTransactionType || encode([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s])
TxHash = keccak256(TxHashRLP)

Raw Transaction


RawTx = EthereumTxTypeEnvelope || EthereumTransactionType || encode([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s])

RLP Encoding (Example)

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


TX(3a3ab67168de40b1f8a2141a70a4e2f551f90d7814b2fbcb3ac99ad8d8d0b641)
Contract: false
Chaind: 0x2
From: a94f5374fce5edbc8e2a8697c15331677e6ebf0b
To: 7b65b75d204abed71587c9e519a89277766ee1d0
Nonce: 1234
GasPrice: 0x19
GasLimit 0xf4240
Value: 0xa
Data: 0x31323334
AccessList: [{0000000000000000000000000000000000000001 [0000000000000000000000000000000000000000000000000000000000000000]}]
V: 0x1
R: 0xbfc80a874c43b71b67c68fa5927d1443407f31aef4ec6369bbecdb76fc39b0c0
S: 0x193e62c1dd63905aee7073958675dcb45d78c716a9a286b54a496e82cb762f26
Hex: 7801f8a1028204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a8431323334f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000001a0bfc80a874c43b71b67c68fa5927d1443407f31aef4ec6369bbecdb76fc39b0c0a0193e62c1dd63905aee7073958675dcb45d78c716a9a286b54a496e82cb762f26

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

The return of eth_getTransactionByHash


{
"blockHash": "0x7bd7e8a92ecaa5781a15a8b6fff589f8ac8a79325b517a1ba5d5f2f3d7af1b00",
"blockNumber": "0x1c8f4b",
"from": "0x5618e15ec2916bbe6cf2cce20ce31e61d6062cac",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"hash": "0x3f67e48c2090f560234f555cd4edf7853b6327aa9a6a795be1efe3f360dac118",
"input": "0x1122",
"nonce": "0x11",
"to": "0x5dce87b5bfcde54023811b168dc97a9f10913957",
"transactionIndex": "0x0",
"value": "0x186a0",
"type": "0x1",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000001",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
}
],
"chainId": "0x2710",
"v": "0x1",
"r": "0xebb2d2144293c257e27aaa1d22156f322b0d2d7385257f186c117899d791f174",
"s": "0x5cea970287c9f0f9754050a552c458c066d8f3b3e4639f561b22ce4cb7553ac0"
}

The return of kaia_getTransactionByHash


{
"accessList": [
{
"address": "0x0000000000000000000000000000000000000001",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
}
],
"blockHash": "0x7bd7e8a92ecaa5781a15a8b6fff589f8ac8a79325b517a1ba5d5f2f3d7af1b00",
"blockNumber": "0x1c8f4b",
"chainID": "0x2710",
"from": "0x5618e15ec2916bbe6cf2cce20ce31e61d6062cac",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"hash": "0x3f67e48c2090f560234f555cd4edf7853b6327aa9a6a795be1efe3f360dac118",
"input": "0x1122",
"nonce": "0x11",
"senderTxHash": "0x3f67e48c2090f560234f555cd4edf7853b6327aa9a6a795be1efe3f360dac118",
"signatures": [
{
"V": "0x1",
"R": "0xebb2d2144293c257e27aaa1d22156f322b0d2d7385257f186c117899d791f174",
"S": "0x5cea970287c9f0f9754050a552c458c066d8f3b3e4639f561b22ce4cb7553ac0"
}
],
"to": "0x5dce87b5bfcde54023811b168dc97a9f10913957",
"transactionIndex": "0x0",
"type": "TxTypeEthereumAccessList",
"typeInt": 30721,
"value": "0x186a0"
}

TxTypeEthereumDynamicFee

TxTypeEthereumDynamicFee represents a type of Ethereum transaction specified in EIP-1559. This transaction type contains gasTipCap and gasFeeCap instead of gasPrice. Since this transaction type exists to support compatibility, it only works with EOAs associated with [AccountKeyLegacy]. EOAs associated with other account key types should use other transaction types such as TxTypeValueTransfer, TxTypeSmartContractExecution, and so on. This type of transaction can create accouns, transfer tokens, deploy/execute smart contracts, or a mix of the aforementioned.

ghi chú

NOTE: Kaia networks can process this transaction type after the EthTxTypeCompatibleBlock

ghi chú

Currently, this type of transaction only supports the format of the Ethereum transaction type. Unlike EIP-2930, there are no benefits in terms of transaction fees from using access list.

ghi chú

NOTE: Since Kaia has a fixed gas price, gasTipCap and gasFeeCap should take the gas price for the respective network, which is 250 Gkei at the time of writing.

Attributes

AttributeTypeDescription
typeuint8 (Go)The type of TxTypeEthereumDynamicFee that is a concatenation of EthereumTxTypeEnvelope and EthereumTransactionType. It must be 0x7802.
chainId*big.Int (Go)The destination chain ID.
nonceuint64 (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.
gasTipCap*big.Int (Go)A multiplier to get how much the sender will pay in addition to baseFee. Since Kaia has a fixed gas price, gasTipCap and gasFeeCap should take the gas price for the respective network, which is 250 Gkei at the time of writing.
gasFeeCap*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 * gasFeeCap. Since Kaia has a fixed gas price, gasTipCap and gasFeeCap should take the gas price for the respective network, which is 250 Gkei at the time of writing.
gasuint64 (Go)The maximum amount of transaction fee 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.
data[]byte (Go)Data attached to the transaction, used for transaction execution.
accessListtype.AccessList (Go)A list of addresses and storage keys consisting of [](common.Address, []common.Hash).
v, r, s*big.Int (Go)The cryptographic signature generated by the sender to let the receiver obtain the sender's address.

RLP Encoding for Signature

To make a signature for this transaction type, the RLP serialization proceeds as follows:

ghi chú

This type of transaction should be signed with London Signer


SigRLP = EthereumTransactionType || encode([chainId, nonce, gasTipCap, gasFeeCap, gasLimit, to, value, data, accessList])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)

RLP Encoding for SenderTxHash

To obtain SenderTxHash for this transaction type, the RLP serialization proceeds as follows:


SenderTxHashRLP = EthereumTransactionType || encode([chainId, nonce, gasTipCap, gasFeeCap, gasLimit, to, value, data, accessList, v, r, s])
SenderTxHash = keccak256(SenderTxHashRLP)
Signature = sign(SenderTxHash, <private key>)

RLP Encoding for Transaction Hash

To obtain a transaction hash, the RLP serialization proceeds as follows:


TxHashRLP = EthereumTransactionType || encode([chainId, nonce, gasTipCap, gasFeeCap, gasLimit, to, value, data, accessList, v, r, s])
TxHash = keccak256(TxHashRLP)

Raw Transaction


RawTx = EthereumTxTypeEnvelope || EthereumTransactionType || encode([chainId, nonce, gasTipCap, gasFeeCap, gasLimit, to, value, data, accessList, v, r, s])

RLP Encoding (Example)

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


TX(be74e122acf00c2f257e8698ecf01140b58b2880de3f24d0875730425eccb45a)
Contract: false
Chaind: 0x2
From: a94f5374fce5edbc8e2a8697c15331677e6ebf0b
To: 7b65b75d204abed71587c9e519a89277766ee1d0
Nonce: 1234
GasTipCap: 0x19
GasFeeCap: 0x19
GasLimit 0xf4240
Value: 0xa
Data: 0x31323334
AccessList: [{0000000000000000000000000000000000000001 [0000000000000000000000000000000000000000000000000000000000000000]}]
V: 0x0
R: 0xca14aa0bada2da7ca1b143c16e2dd4a69f2a1e77ce54c7f6d440fe828a777f4f
S: 0x117f0f78aed398b2995b5ee7c67ace25d52be3c72c1384c2aaa9683b351556
Hex: 7802f8a1028204d21919830f4240947b65b75d204abed71587c9e519a89277766ee1d00a8431323334f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a0ca14aa0bada2da7ca1b143c16e2dd4a69f2a1e77ce54c7f6d440fe828a777f4f9f117f0f78aed398b2995b5ee7c67ace25d52be3c72c1384c2aaa9683b351556

RPC Output (Example)

The following shows a transaction object returned via JSON RPC.

The return of eth_getTransactionByHash


{
"blockHash": "0x55792fe186e3d1515fe35a68c2c8d7977b2d7db184d80526f906c53222b77833",
"blockNumber": "0x1c944d",
"from": "0x5618e15ec2916bbe6cf2cce20ce31e61d6062cac",
"gas": "0x174876e800",
"gasPrice": "0x5d21dba00",
"maxFeePerGas": "0x5d21dba00",
"maxPriorityFeePerGas": "0x5d21dba00",
"hash": "0x5db239963029ad9ef6c3331b10ae455638316e330b0efdae2cc1f8e86884e66e",
"input": "0x1122",
"nonce": "0x13",
"to": "0xa0f1633f4c666d7fe5ba912bd5caf03d3655ac31",
"transactionIndex": "0x0",
"value": "0x186a0",
"type": "0x2",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000001",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
}
],
"chainId": "0x2710",
"v": "0x1",
"r": "0x27e007cbe79fd8cc9b89dd798bdd5aa62d038273bf006c7c3b40e13a938ab807",
"s": "0x6209bb328855f02fa2671fecb41efd9f191b03ecab5e580227fa2a0674879384"
}

The return of kaia_getTransactionByHash


{
"accessList": [
{
"address": "0x0000000000000000000000000000000000000001",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
}
],
"blockHash": "0x55792fe186e3d1515fe35a68c2c8d7977b2d7db184d80526f906c53222b77833",
"blockNumber": "0x1c944d",
"chainId": "0x2710",
"from": "0x5618e15ec2916bbe6cf2cce20ce31e61d6062cac",
"gas": "0x174876e800",
"hash": "0x5db239963029ad9ef6c3331b10ae455638316e330b0efdae2cc1f8e86884e66e",
"input": "0x1122",
"maxFeePerGas": "0x5d21dba00",
"maxPriorityFeePerGas": "0x5d21dba00",
"nonce": "0x13",
"senderTxHash": "0x5db239963029ad9ef6c3331b10ae455638316e330b0efdae2cc1f8e86884e66e",
"signatures": [
{
"V": "0x1",
"R": "0x27e007cbe79fd8cc9b89dd798bdd5aa62d038273bf006c7c3b40e13a938ab807",
"S": "0x6209bb328855f02fa2671fecb41efd9f191b03ecab5e580227fa2a0674879384"
}
],
"to": "0xa0f1633f4c666d7fe5ba912bd5caf03d3655ac31",
"transactionIndex": "0x0",
"type": "TxTypeEthereumDynamicFee",
"typeInt": 30722,
"value": "0x186a0"
}

Loại dữ liệu Ethereum Blob

TxTypeEthereumBlob đại diện cho một loại giao dịch Ethereum được quy định trong EIP-4844KIP-279. Loại giao dịch này truyền tải các đối tượng dữ liệu nhị phân lớn (blobs), cung cấp một lớp khả dụng dữ liệu hiệu quả về chi phí cho các rollup Lớp 2 trên Kaia. Bằng cách tách dữ liệu blob khỏi bộ nhớ calldata cố định, các rollup có thể đăng tải dữ liệu với chi phí thấp hơn thông qua một thị trường phí blob độc lập. Bản thân dữ liệu blob không thể được EVM truy cập; chỉ các cam kết blobVersionedHashes mới có thể được truy cập trên chuỗi. Vì loại giao dịch này được thiết kế để đảm bảo tính tương thích, nên nó chỉ hoạt động với các EOA được liên kết với [AccountKeyLegacy]. Loại giao dịch này không thể được sử dụng để tạo hợp đồng — trường to không được để trống.

ghi chú

Mạng Kaia có thể xử lý loại giao dịch này sau khối OsakaCompatibleBlock

ghi chú

Các thông số khí blob của Kaia được điều chỉnh cho các khối 1 giây. Chỉ được phép có một khối trong mỗi khối. Chỉ chấp nhận định dạng sidecar EIP-7594 (phiên bản V1) — các sidecar phiên bản V0 sẽ bị từ chối. Các khối phụ Blob được lưu giữ trong 1.814.400 khối (~21 ngày).

ghi chú

eth_sendRawTransaction yêu cầu giao dịch blob đầy đủ kèm theo sidecar (BlobTxWithBlobs). Tham số blobVersionedHashes phải sử dụng tiền tố phiên bản 0x01.

Thuộc tính

Thuộc tínhLoạiMô tả
loạiuint8 (Go)Loại TxTypeEthereumBlob là kết hợp của EthereumTxTypeEnvelopeEthereumTransactionType. Đây chắc hẳn là 0x7803.
ID chuỗi*big.Int (Go)ID chuỗi điểm đến.
giá trị ngẫu nhiênuint64 (Go)Một giá trị được sử dụng để xác định duy nhất giao dịch của người gửi. Nếu người gửi tạo ra hai giao dịch có cùng giá trị nonce, thì chỉ có một giao dịch được thực hiện.
Phí ưu tiên tối đa trên mỗi đơn vị Gas*big.Int (Go)Hệ số nhân để tính số tiền người gửi phải trả ngoài baseFee. Vì Kaia có mức phí gas cố định, nên hệ thống sẽ tự động áp dụng mức phí gas của mạng lưới tương ứng.
Phí tối đa trên mỗi đơn vị Gas*big.Int (Go)Số tiền tối đa mà người gửi sẵn sàng trả cho mỗi đơn vị gas. Vì Kaia có mức phí gas cố định, nên hệ thống sẽ tự động áp dụng mức phí gas của mạng lưới tương ứng.
khíuint64 (Go)Số tiền phí giao dịch tối đa mà giao dịch được phép sử dụng.
đến*common.Address (Go)Địa chỉ tài khoản sẽ nhận số tiền được chuyển. Không được để trống — các giao dịch blob không thể tạo hợp đồng.
giá trị*big.Int (Go)Số lượng KAIA trong kei cần chuyển.
dữ liệu[]byte (Go)Dữ liệu đi kèm với giao dịch, được sử dụng để thực hiện giao dịch.
danh sách truy cậptype.AccessList (Go)Một danh sách các địa chỉ và khóa lưu trữ bao gồm [](common.Address, []common.Hash).
Phí tối đa cho mỗi khối dữ liệu*big.Int (Go)Mức phí tối đa cho mỗi đơn vị khí blob mà người gửi sẵn sàng chi trả. Giá khí Blob được xác định độc lập với giá khí thông thường.
blob có phiên bản băm[]common.Hash (Go)Danh sách các giá trị băm có phiên bản của các blob liên quan đến giao dịch này. Mỗi hàm băm phải sử dụng tiền tố phiên bản 0x01. Phải có ít nhất một hàm băm.
v, r, s*big.Int (Go)Chữ ký mật mã do người gửi tạo ra để người nhận có thể xác định địa chỉ của người gửi.

Mã hóa RLP cho chữ ký

Để tạo chữ ký cho loại giao dịch này, quá trình tuần tự hóa RLP được thực hiện như sau:

ghi chú

Loại giao dịch này cần được ký bằng Osaka Signer


SigRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)

Mã hóa RLP cho SenderTxHash

Để lấy SenderTxHash cho loại giao dịch này, quá trình tuần tự hóa RLP được thực hiện như sau:


SenderTxHashRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, v, r, s])
SenderTxHash = keccak256(SenderTxHashRLP)

Mã hóa RLP cho băm giao dịch

Để lấy mã băm giao dịch, quá trình tuần tự hóa RLP được thực hiện như sau:


TxHashRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, v, r, s])
TxHash = keccak256(TxHashRLP)

Giao dịch thô


RawTx = EthereumTxTypeEnvelope || EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, v, r, s])

Khi gửi qua eth_sendRawTransaction, cần phải cung cấp biểu diễn mạng đầy đủ bao gồm cả sidecar:


BlobTxWithBlobs = rlp([TransactionPayloadBody, sidecar_version, blobs, commitments, proofs])

trong đó sidecar_version0x01 theo EIP-7594.

Mã hóa RLP (Ví dụ)

Dưới đây là kết quả của quá trình tuần tự hóa RLP và đối tượng giao dịch:


TX(b4687ea17a0908a4dce2d83f8c2566881474b9da30ee8b8979b028778761c9d7)
Hợp đồng: false
Chuỗi: 0x3e9
Từ: 0a3fa1b8fbdaeabcd2a7cb13abb87e8d1bd0a3b5
Đến: a9ef4a5bfb21e92c06da23ed79294dab11f5a6df
Nonce: 366
GasTipCap: 0x0
GasFeeCap: 0xba43b7400
GasLimit 0xc350
Value: 0x0
Data: 0xd09de08a
AccessList: []
MaxFeePerBlobGas: 0x5d21dba000
BlobVersionedHashes: [016f2dec5826dba2b8071deb0fba09244486cc4f9b981fe26396bc3206d2a8d7]
V: 0x1
R: 0x4b6905c3f0637363857626004b2367caa5e1d4c60fa3091a058ddbfef34e30ff
S: 0x659b7ede7f3439a3f07958abe448c25ddfc0ba0b530bff60356552484a854916
Hex: 7803f8978203e982016e80850ba43b740082c35094a9ef4a5bfb21e92c06da23ed79294dab11f5a6df8084d09de08ac0855d21dba000e1a0016f2dec5826dba2b8071deb0fba09244486cc4f9b981fe26396bc3206d2a8d701a04b6905c3f0637363857626004b2367caa5e1d4c60fa3091a058ddbfef34e30ffa0659b7ede7f3439a3f07958abe448c25ddfc0ba0b530bff60356552484a854916

Kết quả RPC (Ví dụ)

Dưới đây là đối tượng giao dịch được trả về qua JSON RPC.

Sự trở lại của eth_getTransactionByHash


{
"blockHash": "0x1683db8c05f898cd9084a8905b3fa2a64b1380b6543e963ea15d2858b241c339",
"blockNumber": "0xc77238e",
"from": "0x0a3fa1b8fbdaeabcd2a7cb13abb87e8d1bd0a3b5",
"gas": "0xc350",
"gasPrice": "0x5d21dba00",
"maxFeePerGas": "0xba43b7400",
"maxPriorityFeePerGas": "0x0",
"maxFeePerBlobGas": "0x5d21dba000",
"hash": "0xb4687ea17a0908a4dce2d83f8c2566881474b9da30ee8b8979b028778761c9d7",
"input": "0xd09de08a",
"nonce": "0x16e",
"to": "0xa9ef4a5bfb21e92c06da23ed79294dab11f5a6df",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x3",
"accessList": [],
"chainId": "0x3e9",
"blobVersionedHashes": [
"0x016f2dec5826dba2b8071deb0fba09244486cc4f9b981fe26396bc3206d2a8d7"
],
"v": "0x1",
"r": "0x4b6905c3f0637363857626004b2367caa5e1d4c60fa3091a058ddbfef34e30ff",
"s": "0x659b7ede7f3439a3f07958abe448c25ddfc0ba0b530bff60356552484a854916"
}

Sự trở lại của kaia_getTransactionByHash


{
"accessList": [],
"blobVersionedHashes": [
"0x016f2dec5826dba2b8071deb0fba09244486cc4f9b981fe26396bc3206d2a8d7"
],
"blockHash": "0x1683db8c05f898cd9084a8905b3fa2a64b1380b6543e963ea15d2858b241c339",
"blockNumber": "0xc77238e",
"chainId": "0x3e9",
"from": "0x0a3fa1b8fbdaeabcd2a7cb13abb87e8d1bd0a3b5",
"gas": "0xc350",
"gasPrice": "0x5d21dba00",
"hash": "0xb4687ea17a0908a4dce2d83f8c2566881474b9da30ee8b8979b028778761c9d7",
"input": "0xd09de08a",
"maxFeePerBlobGas": "0x5d21dba000",
"maxFeePerGas": "0xba43b7400",
"maxPriorityFeePerGas": "0x0",
"nonce": "0x16e",
"senderTxHash": "0xb4687ea17a0908a4dce2d83f8c2566881474b9da30ee8b8979b028778761c9d7",
"signatures": [
{
"V": "0x1",
"R": "0x4b6905c3f0637363857626004b2367caa5e1d4c60fa3091a058ddbfef34e30ff",
"S": "0x659b7ede7f3439a3f07958abe448c25ddfc0ba0b530bff60356552484a854916"
}
],
"to": "0xa9ef4a5bfb21e92c06da23ed79294dab11f5a6df",
"transactionIndex": "0x0",
"type": "TxTypeEthereumBlob",
"typeInt": 30723,
"value": "0x0"
}

TxTypeEthereumSetCode

TxTypeEthereumSetCode đại diện cho một loại giao dịch Ethereum được quy định trong EIP-7702KIP-228. Loại giao dịch này giúp cải thiện trải nghiệm người dùng bằng cách cho phép áp dụng các tính năng trừu tượng hóa tài khoản vào các tài khoản EOA hiện có. Trước đây, các chủ sở hữu EOA muốn sử dụng các tính năng của tài khoản thông minh phải tạo một tài khoản thông minh mới và chuyển toàn bộ tài sản cùng các quyền hạn sang đó. Với các giao dịch SetCode, người dùng có thể gắn mã vào một EOA hiện có ngay tại chỗ, giúp loại bỏ nhu cầu thực hiện các quá trình di chuyển tốn kém. authorizationList chỉ định một danh sách các bộ ba (chainId, address, nonce) được ký bởi các tài khoản mà mã của chúng cần được thiết lập, cho phép thực hiện các mô hình như giao dịch theo lô, tài trợ gas và ủy quyền có phạm vi. Đoàn đại biểu sẽ tồn tại cho đến khi được thay đổi hoặc xóa bỏ một cách rõ ràng bởi một giao dịch SetCode khác. Vì loại giao dịch này được thiết kế để đảm bảo tính tương thích, nên nó chỉ hoạt động với các EOA được liên kết với [AccountKeyLegacy]. Loại giao dịch này không thể được sử dụng để tạo hợp đồng — trường destination không được để trống.

ghi chú

Mạng Kaia có thể xử lý loại giao dịch này sau khối PragueCompatibleBlock

ghi chú

Chỉ các EOA có AccountKeyLegacy mới có thể được gán mã thông qua một bộ ủy quyền. Các bộ dữ liệu ủy quyền tham chiếu đến các tài khoản có các loại khóa khác sẽ bị bỏ qua. Khi một tài khoản EOA đã được thiết lập mã, các giao dịch TxTypeValueTransfer tiêu chuẩn không thể nhắm đến tài khoản đó, và các giao dịch TxTypeAccountUpdate không thể được khởi tạo từ tài khoản đó.

ghi chú

Theo quy định tại EIP-7702, mỗi bộ dữ liệu ủy quyền được ký độc lập bằng hàm băm keccak256(MAGIC || rlp([chainId, address, nonce])), trong đó MAGIC = 0x05. Cần có ít nhất một bộ giá trị ủy quyền.

Thuộc tính

Thuộc tínhLoạiMô tả
loạiuint8 (Go)Loại TxTypeEthereumSetCode là kết hợp của EthereumTxTypeEnvelopeEthereumTransactionType. Đây chắc hẳn là 0x7804.
ID chuỗi*big.Int (Go)ID chuỗi điểm đến.
giá trị ngẫu nhiênuint64 (Go)Một giá trị được sử dụng để xác định duy nhất giao dịch của người gửi. Nếu người gửi tạo ra hai giao dịch có cùng giá trị nonce, thì chỉ có một giao dịch được thực hiện.
Phí ưu tiên tối đa trên mỗi đơn vị Gas*big.Int (Go)Hệ số nhân để tính số tiền người gửi phải trả ngoài baseFee. Vì Kaia có mức phí gas cố định, nên hệ thống sẽ tự động áp dụng mức phí gas của mạng lưới tương ứng.
Phí tối đa trên mỗi đơn vị Gas*big.Int (Go)Số tiền tối đa mà người gửi sẵn sàng trả cho mỗi đơn vị gas. Vì Kaia có mức phí gas cố định, nên hệ thống sẽ tự động áp dụng mức phí gas của mạng lưới tương ứng.
khíuint64 (Go)Số tiền phí giao dịch tối đa mà giao dịch được phép sử dụng.
điểm đến*common.Address (Go)Địa chỉ tài khoản sẽ nhận số tiền được chuyển. Không được để là nil — Các giao dịch SetCode không thể tạo hợp đồng.
giá trị*big.Int (Go)Số lượng KAIA trong kei cần chuyển.
dữ liệu[]byte (Go)Dữ liệu đi kèm với giao dịch, được sử dụng để thực hiện giao dịch.
danh sách truy cậptype.AccessList (Go)Một danh sách các địa chỉ và khóa lưu trữ bao gồm [](common.Address, []common.Hash).
danh sách ủy quyền[]Xác thực (Go)Một danh sách các bộ tuple ủy quyền, mỗi bộ có dạng [chainId, address, nonce, yParity, r, s], trong đó address là hợp đồng mà cơ quan ký ủy quyền chuyển giao mã nguồn, và bộ tuple này được ký bởi cơ quan đó. Phải có ít nhất một bộ tuple.
v, r, s*big.Int (Go)Chữ ký mật mã do người gửi tạo ra để người nhận có thể xác định địa chỉ của người gửi.

Mã hóa RLP cho chữ ký

Để tạo chữ ký cho loại giao dịch này, quá trình tuần tự hóa RLP được thực hiện như sau:

ghi chú

Loại giao dịch này cần được ký bằng Prague Signer


SigRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, destination, value, data, accessList, authorizationList])
SigHash = keccak256(SigRLP)
Signature = sign(SigHash, <private key>)

Mỗi bộ dữ liệu ủy quyền trong authorizationList được ký riêng biệt như sau:


AuthSigRLP = MAGIC || encode([chainId, address, nonce]) // MAGIC = 0x05
AuthSigHash = keccak256(AuthSigRLP)
AuthSignature = sign(AuthSigHash, <authority private key>)

Mã hóa RLP cho SenderTxHash

Để lấy SenderTxHash cho loại giao dịch này, quá trình tuần tự hóa RLP được thực hiện như sau:


SenderTxHashRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, destination, value, data, accessList, authorizationList, v, r, s])
SenderTxHash = keccak256(SenderTxHashRLP)

Mã hóa RLP cho băm giao dịch

Để lấy mã băm giao dịch, quá trình tuần tự hóa RLP được thực hiện như sau:


TxHashRLP = EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, destination, value, data, accessList, authorizationList, v, r, s])
TxHash = keccak256(TxHashRLP)

Giao dịch thô


RawTx = EthereumTxTypeEnvelope || EthereumTransactionType || encode([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, destination, value, data, accessList, authorizationList, v, r, s])

Mã hóa RLP (Ví dụ)

Dưới đây là kết quả của quá trình tuần tự hóa RLP và đối tượng giao dịch:


TX(383aafe58842af80cc63747b78181439cc8b1786b70fedfd86d966b1ea728da1)
Hợp đồng: false
Chuỗi: 0x3e9
Từ: 698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce
Đến: 698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce
Nonce: 29
GasTipCap: 0x0
GasFeeCap: 0x6fc23ac00
GasLimit 0x186a0
Value: 0x0
Data: 0x8129fc1c
AccessList: []
AuthorizationList: [{ChainID: 0x3e9, Address: 5fa0193098ecbbad437243fe0ed77a402cd62242, Nonce: 30}]
V: 0x1
R: 0x77b03c8fd556255dff1f7af72e7a9a8f081e1da9daeb09800d139bf22f22708e
S: 0x26b7d4762db258e596382de1416753c65ca8e3b0855e8276eecf22d019af2805
Hex: 7804f8ce8203e91d808506fc23ac00830186a094698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce80848129fc1cc0f85ef85c8203e9945fa0193098ecbbad437243fe0ed77a402cd622421e01a0a21df3fb047c656d5046ae6b5ea81743c047b281b07591f742a13606f09c4969a01494cb06d71cbaa002d669ff63e1d0044bb5d06a00ca550a103ac0287789614a01a077b03c8fd556255dff1f7af72e7a9a8f081e1da9daeb09800d139bf22f22708ea026b7d4762db258e596382de1416753c65ca8e3b0855e8276eecf22d019af2805

Kết quả RPC (Ví dụ)

Dưới đây là đối tượng giao dịch được trả về qua JSON RPC.

Sự trở lại của eth_getTransactionByHash


{
"blockHash": "0xb76e4a38c1311159ed6fe704f4b220294589accf1c5ec440a471fd4201c6c968",
"blockNumber": "0xb35bcdd",
"from": "0x698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce",
"gas": "0x186a0",
"gasPrice": "0x5d21dba00",
"maxFeePerGas": "0x6fc23ac00",
"maxPriorityFeePerGas": "0x0",
"hash": "0x383aafe58842af80cc63747b78181439cc8b1786b70fedfd86d966b1ea728da1",
"input": "0x8129fc1c",
"nonce": "0x1d",
"to": "0x698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x4",
"accessList": [],
"chainId": "0x3e9",
"authorizationList": [
{
"chainId": "0x3e9",
"address": "0x5fa0193098ecbbad437243fe0ed77a402cd62242",
"nonce": "0x1e",
"yParity": "0x1",
"r": "0xa21df3fb047c656d5046ae6b5ea81743c047b281b07591f742a13606f09c4969",
"s": "0x1494cb06d71cbaa002d669ff63e1d0044bb5d06a00ca550a103ac0287789614a"
}
],
"v": "0x1",
"r": "0x77b03c8fd556255dff1f7af72e7a9a8f081e1da9daeb09800d139bf22f22708e",
"s": "0x26b7d4762db258e596382de1416753c65ca8e3b0855e8276eecf22d019af2805"
}

Sự trở lại của kaia_getTransactionByHash


{
"accessList": [],
"authorizationList": [
{
"chainId": "0x3e9",
"address": "0x5fa0193098ecbbad437243fe0ed77a402cd62242",
"nonce": "0x1e",
"yParity": "0x1",
"r": "0xa21df3fb047c656d5046ae6b5ea81743c047b281b07591f742a13606f09c4969",
"s": "0x1494cb06d71cbaa002d669ff63e1d0044bb5d06a00ca550a103ac0287789614a"
}
],
"blockHash": "0xb76e4a38c1311159ed6fe704f4b220294589accf1c5ec440a471fd4201c6c968",
"blockNumber": "0xb35bcdd",
"chainId": "0x3e9",
"from": "0x698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce",
"gas": "0x186a0",
"gasPrice": "0x5d21dba00",
"hash": "0x383aafe58842af80cc63747b78181439cc8b1786b70fedfd86d966b1ea728da1",
"input": "0x8129fc1c",
"maxFeePerGas": "0x6fc23ac00",
"maxPriorityFeePerGas": "0x0",
"nonce": "0x1d",
"senderTxHash": "0x383aafe58842af80cc63747b78181439cc8b1786b70fedfd86d966b1ea728da1",
"signatures": [
{
"V": "0x1",
"R": "0x77b03c8fd556255dff1f7af72e7a9a8f081e1da9daeb09800d139bf22f22708e",
"S": "0x26b7d4762db258e596382de1416753c65ca8e3b0855e8276eecf22d019af2805"
}
],
"to": "0x698f9bd1a4fc200f8d0c7997810e02a77ca6d5ce",
"transactionIndex": "0x0",
"type": "TxTypeEthereumSetCode",
"typeInt": 30724,
"value": "0x0"
}

Cải thiện trang này