import { CipherBalance, GeneralPrefixData, ProjectivePoint } from "../types.js"; export declare const RAGEQUIT_CAIRO_STRING = 8241982478457596276n; /** * Public inputs of the verifier for the ragequit operation. * @interface InputsRagequit * @property {ProjectivePoint} y - The Tongo account to withdraw from * @property {bigint} nonce - The nonce of the Tongo account * @property {bigint} to - The starknet contract address to send the funds to * @property {bigint} amount - The amount of tongo to ragequit (the total amount of tongos in the account) * @property {CipherBalance} currentBalance - The current CipherBalance stored for the account * @property {GeneralPrefixData} prefix_data - General prefix data for the operation */ export interface InputsRagequit { y: ProjectivePoint; nonce: bigint; to: bigint; amount: bigint; currentBalance: CipherBalance; prefix_data: GeneralPrefixData; } /** * Proof of ragequit operation. * @interface ProofOfRagequit * @property {ProjectivePoint} Ax - The proof point Ax * @property {ProjectivePoint} AR - The proof point AR * @property {bigint} sx - The proof scalar sx */ export interface ProofOfRagequit { Ax: ProjectivePoint; AR: ProjectivePoint; sx: bigint; } export declare function proveRagequit(private_key: bigint, initial_cipherbalance: CipherBalance, nonce: bigint, to: bigint, full_amount: bigint, prefix_data: GeneralPrefixData): { inputs: InputsRagequit; proof: ProofOfRagequit; newBalance: CipherBalance; }; /** * Verifies the ragequit operation. First, users have to show knowledge of the private key. Then, users have to provide * a cleartext of the amount b stored in their balances. The contract will construct a cipher balance * (L2, R2) = (g**b y, g) with randomness r=1. Users have to provide a zk proof that (L2,R2) is encrypting * the same amount that the stored cipher balance (L1,R1). This is done by noting that * L1/L2 = y**r1/y**r2 = (R1/R2)**x. We need to prove a poe for Y=G**x with Y=L1/L2 and G=R1/R2 * * Protocol: * - P: k <-- R sends A=G**k * - V: c <-- R sends c * - P: s = k + c*x send s * * The verifier asserts: * - G**sr == A * (Y**c) * * Complexity: * - EC_MUL: 7 * - EC_ADD: 5 * * @param {InputsRagequit} inputs - The ragequit operation inputs * @param {ProofOfRagequit} proof - The proof to verify * @returns {boolean} True if the proof is valid, false otherwise */ export declare function verifyRagequit(inputs: InputsRagequit, proof: ProofOfRagequit): void;