Garbledtext is an intermediate random value, It's crucial to understand that these values are transient, existing only for the duration of the transaction's execution and promptly deleted once the execution is completed. Storing such a type will cause a loss of data as it has no meaning once the execution is completed.\
Never Pass Ciphertext as Parameter to Another Contract or As User Input
Sending a ciphertext from an Externally Owned Account (EOA) will fail unless it is accompanied by the correct signature to pass validation. Moreover, transmitting ciphertext between different contracts renders it invalid within the scope of the receiving contract and thus ineffective.
contract GoodContract { ctUint8 private ct;functionpassInputtext(ctUint64 _itCT,bytescalldata_itSignature) public { itUint64 memory it; it.ciphertext = _itCT; it.signature = _itSignature;// validate the IT and gtUserInput = MpcCore.validateCiphertext(it); ct = MpcCore.offBoard(gtUserInput ) }}
Never Return a Ciphertext to Another Contract
Returning a ciphertext for future use in a different contract is not feasible, rendering such an action pointless. However, it is logical to return such a type to an Externally Owned Account (EOA) if it was specifically designated for that particular user.
contract GoodContract {functionbalanceOf() publicreturns (ctUint64 balance){ ctUint64 balance = balances[msg.sender];// The balance is saved encrypted using the system key. However, to allow // the user to access it, the balance needs to be re-encrypted using the user key. // Therefore, we decrypt the balance (onBoard) and then encrypt it again using // the user key (offBoardToUser). gtUint64 balanceGt = MpcCore.onBoard(balance);return MpcCore.offBoardToUser(balanceGt, msg.sender); }}