You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encrypts a raw hex-encoded message specifically for Confidential Transactions (CTX). This is a convenience method that sets the `ctxSubmitterAddress` as `aadTE` - Additional Authentication Data for Threshold Encryption, used to protect user's encrypted data. Address of smart contract that will create CTX with that data should be passed as `ctxSubmitterAddress`. When data is encrypted with `ctxSubmitterAddress` as `aadTE`, only `ctxSubmitterAddress` is allowed to submit CTX to decrypt that data. CTXs submitted by other addresses will be rejected.
125
+
126
+
-**Parameters**:
127
+
-`message`: `string` – A hex string to encrypt (with or without `0x` prefix).
128
+
-`ctxSubmitterAddress`: `string` – The Smart Contract Address to be used as `aadTE`.
129
+
-**Returns**: `Promise<string>` – An encrypted hex string in RLP format.
Copy file name to clipboardExpand all lines: tests/README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ The test relies on a Solidity contract named `Game`. This contract implements a
25
25
*`submitPlaintext(bytes)`: Adds plaintext data to the state.
26
26
*`decryptAndExecute()`: Packages the encrypted and plaintext data and performs a `staticcall` to the precompiled `submitCTX` stored at address `0x14`. The `submitCTX` precompile creates a BITE2 Transaction (Confidential Transaction - CTX), which is then added to the next block.
27
27
*`onDecrypt(bytes[], bytes[])`: Called as part of the execution flow to process the now-decrypted data. It calculates the sums of the values and determines if the user "won" (difference between sums < 101). Every CTX created via the `submitCTX` precompile is sent to the `onDecrypt(bytes[], bytes[])` function of the same address that initiated the call to `submitCTX`.
28
+
*`didUserWin`: Returns the `userWon` flag.
28
29
29
30
## Test Steps
30
31
@@ -36,7 +37,7 @@ The `runSampleBITE2` function performs the following steps:
36
37
37
38
2.**Encrypted Data Submission**:
38
39
* Generates 5 random numbers (range 50-249).
39
-
* Encrypts each number using `bite.encryptMessage(hexValue)`.
40
+
* Encrypts each number using `bite.encryptMessageForCTX(hexValue, contractAddress)`.
40
41
* Calls `submitEncrypted` on the contract to store these values.
0 commit comments