本页面使用机器翻译自英语,可能包含错误或不清楚的语言。如需最准确的信息,请参阅英文原文。由于更新频繁,部分内容可能与英文原文有出入。请加入我们在 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。 见 Unit of KAIA. |
gas | uint64 (Go) | 交易允许使用的最大燃气量。 |
to | common.Address (Go) | 接收转账金额的账户地址。 |
value | *big.Int (Go) | 以 kei 为单位的 KAIA 转账金额。 |
from | common.Address (Go) | 发件人地址。 详见 签名验证。 |
feeRatio | uint8 (Go) | 收费者的收费比率。 有效范围在 1 到 99 之间。 Zero(0) 是不允许的。 100 及以上也不允许。 |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | 发件人签名。 详见 签名验证。 |
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 由发送方传送给接收方。
属性
属性 | 说明 | 类型 |
---|---|---|
type | uint8 (Go) | TxTypeFeeDelegatedValueTransferMemoWithRatio 的类型。 必须为 0x12。 |
nonce | uint64 (Go) | 用于唯一标识发件人交易的值。 如果一个发送方生成了两个具有相同 nonce 的交易,则只执行其中一个。 |
gasPrice | *big.Int (Go) | 以 kei 为单位的气体单价,发件人将支付交易费。 交易费的计算公式为 gas * gasPrice 。 例如,如果交易消耗了 10 单位天然气,而 gasPrice 为 10^18,则交易费为 10 KAIA。 见 Unit of KAIA. |
gas | uint64 (Go) | 交易允许使用的最大燃气量。 |
to | common.Address (Go) | 接收转账金额的账户地址。 |
value | *big.Int (Go) | 以 kei 为单位的 KAIA 转账金额。 |
from | common.Address (Go) | 发件人地址。 详见 签名验证。 |
input | []byte (Go) | 交易附带的数据。 信息应传递给该属性。 |
feeRatio | uint8 (Go) | 收费者的收费比率。 有效范围在 1 到 99 之间。 Zero(0) 是不允许的。 100 及以上也不允许。 |
txSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | 发件人签名。 详见 签名验证。 |
feePayer | common.Address (Go) | 缴费人地址。 |
feePayerSignatures | []{*big.Int, *big.Int, *big.Int} (Go) | 缴费人签名。 |
寄件人签名的 RLP 编码
要对发送方进行签名,RLP 序列化的方法如下:
SigRLP = encode([encode([type, nonce, gasPrice, gas, to, value, from, input, feeRatio]), chainid, 0, 0])SigHash = keccak256(SigRLP)Signature = sign(SigHash, <the sender's private key>)