Skip to content

Commit b0313fa

Browse files
committed
#32 update docs
1 parent 7bf2af5 commit b0313fa

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ Encrypts a raw hex-encoded message using the BLS threshold encryption from the c
119119

120120
---
121121

122+
### `bite.encryptMessageForCTX(message, scAddress)`
123+
124+
Encrypts a raw hex-encoded message specifically for Confidential Transactions (CTX). This is a convenience method that sets the `scAddress` as `AADTE`.
125+
126+
- **Parameters**:
127+
- `message`: `string` – A hex string to encrypt (with or without `0x` prefix).
128+
- `scAddress`: `string` – The Smart Contract Address to be used as AADTE.
129+
- **Returns**: `Promise<string>` – An encrypted hex string in RLP format.
130+
131+
---
132+
122133
### `bite.getDecryptedTransactionData(transactionHash)`
123134

124135
Retrieves decrypted transaction data from the configured BITE provider using the `bite_getDecryptedTransactionData` JSON-RPC method.

src/core/bite.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ export class BITE {
6060
return encrypt.encryptMessage(message, committees, undefined, scAddress);
6161
}
6262

63-
/**
64-
* Encrypt a transaction object using BLS public key for CTX.
65-
* @param tx - The transaction to encrypt.
66-
* @param scAddress - Optional Smart Contract Address for AADTE. If not provided, tx.to will be used.
67-
*/
68-
async encryptTransactionForCTX(tx: encrypt.Transaction, scAddress?: string): Promise<encrypt.Transaction> {
69-
const committees = await biteRpc.getCommitteesInfo(this.providerURL);
70-
return encrypt.encryptTransaction(tx, committees, undefined, scAddress ?? tx.to);
71-
}
72-
7363
/**
7464
* Encrypt a transaction object using BLS public key and provided committees info.
7565
* @param tx - The transaction to encrypt.

tests/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The test relies on a Solidity contract named `Game`. This contract implements a
2525
* `submitPlaintext(bytes)`: Adds plaintext data to the state.
2626
* `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.
2727
* `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.
2829

2930
## Test Steps
3031

@@ -36,7 +37,7 @@ The `runSampleBITE2` function performs the following steps:
3637

3738
2. **Encrypted Data Submission**:
3839
* Generates 5 random numbers (range 50-249).
39-
* Encrypts each number using `bite.encryptMessage(hexValue)`.
40+
* Encrypts each number using `bite.encryptMessageForCtx(hexValue, contractAddress)`.
4041
* Calls `submitEncrypted` on the contract to store these values.
4142

4243
3. **Plaintext Data Submission**:

0 commit comments

Comments
 (0)