Skip to content

Commit 436c396

Browse files
committed
WIP
1 parent c237b5f commit 436c396

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/crypto/mpt/bulletproofs/EqualityPlaintextProofGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ public interface EqualityPlaintextProofGenerator {
5858
* <p>Callers should simply pass the actual IssuerEncryptedBalance ciphertext and issuer's
5959
* public key - the swapping is done internally.</p>
6060
*
61+
* <p>The random nonce for the commitment is generated internally using a secure random
62+
* number generator, following the same pattern as other proof generators.</p>
63+
*
6164
* @param ciphertext The IssuerEncryptedBalance ciphertext from the MPToken.
6265
* @param publicKey The issuer's ElGamal public key.
6366
* @param amount The unsigned plaintext amount to clawback.
6467
* @param randomness The issuer's ElGamal private key (used as "randomness" in the proof).
65-
* @param nonceT The random nonce for the commitment.
6668
* @param context The transaction context hash for clawback.
6769
*
6870
* @return An {@link EqualityPlaintextProof} (98 bytes: T1 || T2 || s).
@@ -74,7 +76,6 @@ EqualityPlaintextProof generateProof(
7476
ElGamalPublicKey publicKey,
7577
UnsignedLong amount,
7678
BlindingFactor randomness,
77-
BlindingFactor nonceT,
7879
ConfidentialMPTClawbackContext context
7980
);
8081

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/crypto/mpt/bulletproofs/java/JavaEqualityPlaintextProofGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ public EqualityPlaintextProof generateProof(
3737
ElGamalPublicKey publicKey,
3838
UnsignedLong amount,
3939
BlindingFactor randomness,
40-
BlindingFactor nonceT,
4140
ConfidentialMPTClawbackContext context
4241
) {
4342
Objects.requireNonNull(ciphertext, "ciphertext must not be null");
4443
Objects.requireNonNull(publicKey, "publicKey must not be null");
4544
Objects.requireNonNull(amount, "amount must not be null");
4645
Objects.requireNonNull(randomness, "randomness must not be null");
47-
Objects.requireNonNull(nonceT, "nonceT must not be null");
4846
Objects.requireNonNull(context, "context must not be null");
4947

5048
// Rippled calls secp256k1_equality_plaintext_prove with: (&pk, &c2, &c1, ...)
@@ -55,7 +53,8 @@ public EqualityPlaintextProof generateProof(
5553
ECPoint c2 = ciphertext.c2(); // balance.c2 stays as c2
5654
ECPoint pk = ciphertext.c1(); // balance.c1 becomes pk_recipient
5755

58-
// 1. Use provided nonce t
56+
// 1. Generate random nonce t internally (matching C implementation pattern)
57+
BlindingFactor nonceT = BlindingFactor.generate();
5958
BigInteger tInt = new BigInteger(1, nonceT.toBytes());
6059

6160
// 2. Compute commitments T1 = t * G, T2 = t * Pk (where Pk = balance.c1)

xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/ConfidentialTransfersIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,17 +982,16 @@ public void testEntireFlow() throws JsonRpcClientErrorException, JsonProcessingE
982982
);
983983

984984
// Generate the Equality Plaintext Proof (parameter swapping handled internally)
985+
// The nonce is generated internally by the proof generator
985986
BlindingFactor issuerPrivateKeyAsBlindingFactor = BlindingFactor.fromBytes(
986987
issuerElGamalKeyPair.privateKey().naturalBytes().toByteArray()
987988
);
988-
BlindingFactor clawbackNonce = BlindingFactor.generate();
989989

990990
EqualityPlaintextProof clawbackProof = equalityProofGenerator.generateProof(
991991
issuerBalanceCiphertext, // IssuerEncryptedBalance ciphertext
992992
issuerElGamalKeyPair.publicKey(), // issuer's ElGamal public key
993993
clawbackAmount,
994994
issuerPrivateKeyAsBlindingFactor, // issuer's private key as "randomness"
995-
clawbackNonce, // random nonce for commitment
996995
clawbackContext
997996
);
998997

0 commit comments

Comments
 (0)