排程科目餘額合併

使用機密付款功能時,您必須定期排定帳戶餘額合併。

為了讓整個網路的帳戶餘額保持準確,Token AdminOrg Admin 會使用 Oracle Blockchain Platform 中的 scheduleTransactions REST API 端點定期執行 consolidateRunningBalanceInTransactionsprocessSendersAndReceivers 方法。如需詳細資訊,請參閱排定要執行的交易

consolidateRunningBalanceInTransactions

在機密模式中,寄送方與接收方帳戶的累積餘額不會儲存在交易記錄中,而是會定期計算累積餘額,然後更新交易記錄。執行 consolidateRunningBalanceInTransactions API 時,會識別尚未處理累積餘額的所有交易 (公用和專用),並計算和儲存傳送方帳戶和接收方帳戶的累積餘額。使用 Oracle Blockchain Platform 中的 scheduleTransactions API 端點,如下所示,排定定期執行 consolidateRunningBalanceInTransactions API。

Endpoint
/restproxy/api/v2/channels/{channelName}/scheduleTransactions
要求主體
curl --location '<rest_server_url:port>/restproxy/api/v2/channels/{channelName}/scheduleTransactions' \
--header 'Content-Type: application/json' \
--header 'Confidential-Transaction: true' \
--header 'Authorization: ••••••' \
--data '{
    "chaincode": "{ChaincodeName}",
    "args": [
        "consolidateRunningBalanceInTransactions"
    ],
    "timeout": 6000,
    "sync": true,
    "intervalType": {
        "time": 2
    },
    "expiry": "120M",
    "sameOrgEndorser": true
}'

processSendersAndReceivers

在機密模式中,組織之間的傳輸涉及兩個專用資料收集。針對借項,系統會建立寄件人物件,並為貸項建立接收者物件,而非修改帳戶索引鍵 / 值組。餘額會置於寄件人物件中。銷退折讓金額會放置在指定給收件者的接收者物件中。借方作業完成時,寄件者物件已不再使用且可刪除。同樣地,餘額從接收者物件移至接收者的帳戶後,可以刪除接收者物件。processSendersAndReceivers 會識別所有已處理的寄件者物件並加以刪除。它也會識別包含餘額的所有接收者物件、將餘額移至對應接收者的帳戶索引鍵 / 值組,然後刪除接收者物件。使用 Oracle Blockchain Platform 中的 scheduleTransactions API 端點,如下所示,排定定期執行 processSendersAndReceivers API。

Endpoint
/restproxy/api/v2/channels/{channelName}/scheduleTransactions
要求主體
curl --location '<rest_server_url:port>/restproxy/api/v2/channels/<channel_name>/scheduleTransactions'\
--header 'Content-Type: application/json' \
--header 'Confidential-Transaction: true' \
--header 'Authorization: ••••••' \
--data '{
    "chaincode": "{ChaincodeName}",
    "args": [
        "processSendersAndReceivers"
    ],
    "timeout": 6000,
    "sync": true,
    "intervalType": {
        "time": 2
    },
    "expiry": "120M",
    "sameOrgEndorser": true
}'