Transactions¶
concrete_fhe_toolkit.finance.transactions ¶
Encrypted transaction processing and settlement logic.
transfer ¶
transfer(sender_balance: Any, receiver_balance: Any, amount: Any) -> tuple[Any, Any]
Transfers an amount from one account to another securely under encryption.
If the amount is negative or the sender has insufficient balance, the transfer is silently cancelled (amount becomes 0) without leaking information about the failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sender_balance
|
Any
|
The encrypted balance of the sender. |
required |
receiver_balance
|
Any
|
The encrypted balance of the receiver. |
required |
amount
|
Any
|
The encrypted integer amount to be processed. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Any, Any]
|
tuple[Any, Any]: A tuple containing the new encrypted sender balance and receiver balance. |
Example
from concrete_fhe_toolkit.finance.transactions import transfer
# Inside an FHE circuit
# enc_new_sender_bal, enc_new_receiver_bal = transfer(
# enc_sender_bal, enc_receiver_bal, enc_transfer_amount
# )
Source code in src/concrete_fhe_toolkit/finance/transactions.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |