本頁面使用機器翻譯自英語,可能包含錯誤或不清楚的語言。如需最準確的信息,請參閱英文原文。由於更新頻繁,部分內容可能與英文原文有出入。請加入我們在 Crowdin 上的努力,幫助我們改進本頁面的翻譯。 (Crowdin translation page, Contributing guide)
部分費用授權
TxTypeFeeDelegatedValueTransferWithRatio
TxTypeFeeDelegatedValueTransferWithRatio 用於用戶發送 KAIA。 由於 Kaia 提供了多種交易類型,使每種交易類型只服務於一個目的,因此 TxTypeFeeDelegatedValueTransferWithRatio 只限於將 KAIA 發送到外部擁有的賬戶。 因此,TxTypeFeeDelegatedValueTransferWithRatio 只有在 "to "為外部所有賬戶時才被接受。 要將 KAIA 轉移到智能合約賬戶,請使用 TxTypeFeeDelegatedSmartContractExecutionWithRatio。 該交易類型將進行以下更改。
- 付費者的餘額按交易費的給定比例減少。
- 匯款人的餘額會因剩餘的交易費而減少。 例如,如果
feeRatio
為 30,則 30% 的費用將由付款人支付,其餘 70% 的費用將由發件人支付。 - 發送方的 nonce 增加一個。
value
KAIA 由發送方傳送給接收方。
屬性
屬性 | 類型 | 說明 |
---|---|---|
type | uint8 (Go) | TxTypeFeeDelegatedValueTransferWithRatio 的類型。 必須是 0x0a。 |
nonce | uint64 (Go) | 用於唯一標識發件人交易的值。 如果一個發送方生成了兩個具有相同 nonce 的交易,則只執行其中一個。 |
gasPrice | *big.Int (Go) | 以 kei 為單位的氣體單價,發件人將支付交易費。 交易費的計算公式為 gas * gasPrice 。 例如,如果交易消耗了 10 單位天然氣,而 gasPrice 為 10^18,則交易費為 10 KAIA。 See Unit of KAIA. |
gas | uint64 (Go) | 交易允許使用的最大燃氣量。 |
to | common.Address (Go) | 接收轉賬金額的賬戶地址。 |
value | *big.Int (Go) | 以 kei 為單位的 KAIA 轉賬金額。 |
from | common.Address (Go) | 發件人地址。 For more details, see Signature Validation. |
feeRatio | uint8 (Go) | 收費者的收費比率。 有效範圍在 1 到 99 之間。 Zero(0) 是不允許的。 100 及以上也不允許。 |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | 發件人簽名。 For more details, see Signature Validation. |
feePayer | common.Address (Go) | 繳費人地址。 |
feePayerSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | 繳費人簽名。 |
寄件人簽名的 RLP 編碼
要對發送方進行簽名,RLP 序列化的方法如下:
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, feeRatio]), chainid, 0, 0])SigHash = keccak256(SigRLP)Signature = sign(SigHash, <the sender's private key>)
繳費人簽名的 RLP 編碼
要製作繳費人簽名,RLP 序列化工作應如下進行:
SigFeePayerRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, feeRatio]), feePayer, chainid, 0, 0])SigFeePayerHash = keccak256(SigFeePayerRLP)SignatureFeePayer = sign(SigFeePayerHash, <the fee payer's private key>)
SenderTxHash 的 RLP 編碼
要製作 SenderTxHash,RLP 序列化過程如下:
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, feeRatio, txSignatures])SenderTxHash = keccak256(SenderTxHashRLP)
交易哈希的 RLP 編碼
要製作事務哈希值,RLP 序列化的步驟如下:
txSignatures (a single signature) = [[v, r, s]]txSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]feePayerSignatures (a single signature) = [[v, r, s]]feePayerSignatures (two signatures) = [[v1, r1, s1], [v2, r2, s2]]TxHashRLP = type + encode([nonce, gasPrice, gas, to, value, from, feeRatio, txSignatures, feePayer, feePayerSignatures])TxHash = keccak256(TxHashRLP)
RLP 編碼 (示例)
下面顯示的是 RLP 序列化的結果和事務對象:
ChainID 0x1PrivateKey 0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8PublicKey.X 0x3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33dPublicKey.Y 0x8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3SigRLP 0xf83ab6f50a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b1e018080SigHash 0x0f7d520cd00034299b36004c21b571263dbb9a77edbd5920c4136f7f74050d9dSignature f845f84325a0dde32b8241f039a82b124fe94d3e556eb08f0d6f26d07dcc0f3fca621f1090caa01c8c336b358ab6d3a2bbf25de2adab4d01b754e2fb3b9b710069177d54c1e956FeePayerPrivateKey 0xb9d5558443585bca6f225b935950e3f6e69f9da8a5809a83f51c3365dff53936FeePayerPublicKey.X 0x327434d4cfc66ef8857d431419e9deebdc53a3e415edcc55382e2d417b8dd102FeePayerPublicKey.Y 0x65fc97045707faf7b8f81ac65089d4cc71f69ad0bf1bc8559bc24f13fc284cedSigRLPFeePayer 0xf84fb6f50a8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b1e945a0043070275d9f6054307ee7348bd660849d90f018080SigHashFeePayer 0x38123c30a5f83db853e9ae4e8dd8d4f6aa6840415acffb8dbf18b2050463dec4SignatureFeePayer f845f84326a0091ecf53f91bb97bb694f2f2443f3563ac2b646d651497774524394aae396360a044228b88f275aa1ec1bab43681d21dc7e3a676786ed1906f6841d0a1a188f88aTxHashRLP 0x0af8d78204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b1ef845f84325a0dde32b8241f039a82b124fe94d3e556eb08f0d6f26d07dcc0f3fca621f1090caa01c8c336b358ab6d3a2bbf25de2adab4d01b754e2fb3b9b710069177d54c1e956945a0043070275d9f6054307ee7348bd660849d90ff845f84326a0091ecf53f91bb97bb694f2f2443f3563ac2b646d651497774524394aae396360a044228b88f275aa1ec1bab43681d21dc7e3a676786ed1906f6841d0a1a188f88aTxHash 83a89f4debd8e9d6374b987e25132b3a4030c9cf9ace2fc6e7d1086fcea2ce40SenderTxHashRLP 0x0af87b8204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b1ef845f84325a0dde32b8241f039a82b124fe94d3e556eb08f0d6f26d07dcc0f3fca621f1090caa01c8c336b358ab6d3a2bbf25de2adab4d01b754e2fb3b9b710069177d54c1e956SenderTxHash 4711ed4023e821425968342c1d50063b6bc3176b1792b7075cfeee3656d450f6 TX(83a89f4debd8e9d6374b987e25132b3a4030c9cf9ace2fc6e7d1086fcea2ce40) Type: TxTypeFeeDelegatedValueTransferWithRatio From: 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B To: 0x7b65B75d204aBed71587c9E519a89277766EE1d0 Nonce: 1234 GasPrice: 0x19 GasLimit: 0xf4240 Value: 0xa Signature: [{"V":"0x25","R":"0xdde32b8241f039a82b124fe94d3e556eb08f0d6f26d07dcc0f3fca621f1090ca","S":"0x1c8c336b358ab6d3a2bbf25de2adab4d01b754e2fb3b9b710069177d54c1e956"}] FeePayer: 0x5A0043070275d9f6054307Ee7348bD660849D90f FeeRatio: 30 FeePayerSig: [{"V":"0x26","R":"0x91ecf53f91bb97bb694f2f2443f3563ac2b646d651497774524394aae396360","S":"0x44228b88f275aa1ec1bab43681d21dc7e3a676786ed1906f6841d0a1a188f88a"}] Hex: 0af8d78204d219830f4240947b65b75d204abed71587c9e519a89277766ee1d00a94a94f5374fce5edbc8e2a8697c15331677e6ebf0b1ef845f84325a0dde32b8241f039a82b124fe94d3e556eb08f0d6f26d07dcc0f3fca621f1090caa01c8c336b358ab6d3a2bbf25de2adab4d01b754e2fb3b9b710069177d54c1e956945a0043070275d9f6054307ee7348bd660849d90ff845f84326a0091ecf53f91bb97bb694f2f2443f3563ac2b646d651497774524394aae396360a044228b88f275aa1ec1bab43681d21dc7e3a676786ed1906f6841d0a1a188f88a
RPC 輸出 (示例)
下面顯示的是通過 JSON RPC 返回的事務對象。
{ "blockHash": "0x7ad6ed1f9955be00db8fb5452125f0e9a3c0856abb5b4cc4aed91ffc134321da", "blockNumber": "0x1", "contractAddress": null, "feePayer": "0x029fdce0457db02f05c4be9f67b7115cb8ea15ca", "feePayerSignatures": [ { "V": "0x25", "R": "0xb8583f638efefb297922aa8b8a30cf451a30e266126d52da03ba9ead0fbb1ccd", "S": "0x4bc5ca3756f88d857d115b128b00babe5b3c0b089f087a0b30a9ced269e00603" } ], "feeRatio": "0x14", "from": "0x0fcda0f2efbe1b4e61b487701ce4f2f8abc3723d", "gas": "0x174876e800", "gasPrice": "0x5d21dba00", "gasUsed": "0x8ca0", "logs": [], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "nonce": "0x3", "senderTxHash": "0xac372c68d2937383d4344a2d187e70b207c76160eb407b68e08c944b919328de", "signatures": [ { "V": "0x26", "R": "0x1a8d5bf583843ceba87943569a34a8a6caa18a9ab5e4cf6914d8048e607787bc", "S": "0x27458275c84adcb8144b4596946111f1a539643941de74f587fa69a7df98ed1b" } ], "status": "0x1", "to": "0x75c3098be5e4b63fbac05838daaee378dd48098d", "transactionHash": "0x670ff613022278cc2551a7e4669d8911f1658ffaa4dcc3695b14f39194a8a38c", "transactionIndex": "0x3", "type": "TxTypeFeeDelegatedValueTransferWithRatio", "typeInt": 10, "value": "0x989680"}
TxTypeFeeDelegatedValueTransferMemoWithRatio
TxTypeFeeDelegatedValueTransferMemoWithRatio 用於用戶發送帶有特定信息的 KAIA。 TxTypeFeeDelegatedValueTransferMemoWithRatio 僅在 to
為外部所有賬戶時才被接受。 要將 KAIA 轉移到智能合約賬戶,請使用 TxTypeFeeDelegatedSmartContractExecutionWithRatio。 該交易類型將進行以下更改。
- 費用支付者的餘額按交易費金額的費用比率減少。
- 匯款人的餘額會因剩餘的交易費而減少。 例如,如果 "feeRatio "為 30,則 30% 的費用將由付款人支付,其餘 70% 的費用將由發件人支付。
- 發送方的 nonce 增加一個。
value
KAIA 由發送方傳送給接收方。