import { Range } from "../provers/range.js"; import { CipherBalance, GeneralPrefixData, ProjectivePoint } from "../types.js"; export declare const TRANSFER_CAIRO_STRING = 8390876182755042674n; /** * Public inputs of the verifier for the transfer operation. * @interface InputsTransfer * @property {ProjectivePoint} from - The Tongo account to take tongos from * @property {ProjectivePoint} to - The Tongo account to send tongos to * @property {bigint} nonce - The nonce of the Tongo account (from) * @property {CipherBalance} currentBalance - The current CipherBalance stored for the account (from) * @property {CipherBalance} transferBalance - The amount to transfer encrypted for the pubkey of `to` * @property {CipherBalance} transferBalanceSelf - The amount to transfer encrypted for the pubkey of `from` * @property {number} bit_size - The bit size for range proofs * @property {GeneralPrefixData} prefix_data - General prefix data for the operation */ export interface InputsTransfer { from: ProjectivePoint; to: ProjectivePoint; nonce: bigint; currentBalance: CipherBalance; transferBalance: CipherBalance; transferBalanceSelf: CipherBalance; auxiliarCipher: CipherBalance; auxiliarCipher2: CipherBalance; bit_size: number; prefix_data: GeneralPrefixData; } export interface ProofOfTransfer { A_x: ProjectivePoint; A_r: ProjectivePoint; A_r2: ProjectivePoint; A_b: ProjectivePoint; A_b2: ProjectivePoint; A_v: ProjectivePoint; A_v2: ProjectivePoint; A_bar: ProjectivePoint; s_x: bigint; s_r: bigint; s_b: bigint; s_b2: bigint; s_r2: bigint; range: Range; range2: Range; } export declare function proveTransfer(private_key: bigint, to: ProjectivePoint, initial_balance: bigint, amount_to_transfer: bigint, initial_cipherbalance: CipherBalance, nonce: bigint, bit_size: number, prefix_data: GeneralPrefixData): { inputs: InputsTransfer; proof: ProofOfTransfer; newBalance: CipherBalance; }; /** * Verifies the transfer operation. First, users have to show knowledge of the private key. Then, users have to provide * two cipher balances, one (L,R) is an encryption of the transfer amount b under its public key, the other (L_bar, R_bar) * an encryption of the transfer amount b under the receiver public key. Users have to provide a ZK proof that both encryptions * are indeed encrypting the same amount for the correct public keys. To show the transfer amount b is positive, * when the first RangeProof is verified, it returns a V1 = g**b h**r1, with b positive. V1 is used as an L part * of a cipher balance, users have to prove that the cipher balance (V1, R_aux1 = g**r1) is encrypting the same * amount that (L,R). The cipher balance after the operation would be (L0,R0) = (CL/L, CR/R) where (CL,CR) is the * current balance. To show that (L0, R0) is encrypting an amount b_left positive, when the second RangeProof is * verified, it returns a V2 = g**b_left h**r2, with b_left positive. V2 is used as an L part * of a cipher balance, users have to prove that the cipher balance (V2, R_aux2 = g**r2) is encrypting the same * amount that (L0,R0) * * Complexity: * - EC_MUL: 27 + 2*n*5 = 347 for u32 * - EC_ADD: 18 + 2*n*4 = 274 for u32 * * @param {InputsTransfer} inputs - The transfer operation inputs * @param {ProofOfTransfer} proof - The proof to verify * @returns {boolean} True if the proof is valid, false otherwise */ export declare function verifyTransfer(inputs: InputsTransfer, proof: ProofOfTransfer): void;