1

I couldn't find any example of usage, I'm trying the following and getting Attempt to load a program that does not exist.

This is trying the official Solana zk-program:

https://github.com/solana-labs/solana/blob/bc136423b4a6f4609e2d07a0b863bc452b84a3ea/zk-token-sdk/src/zk_token_proof_program.rs#L11C30-L11C73

https://github.com/solana-labs/solana/blob/bc136423b4a6f4609e2d07a0b863bc452b84a3ea/zk-token-sdk/src/zk_token_proof_instruction.rs#L440

   let url = "https://api.mainnet-beta.solana.com".to_string();
    let connection = RpcClient::new(url);
    let wallet = read_keypair_file("id.json").unwrap();
    let keypair = ElGamalKeypair::new_rand();
    let amount: u64 = 55;
    let ciphertext = keypair.pubkey().encrypt(amount);
    let (commitment, opening) = Pedersen::new(amount);

    let proof_data = CiphertextCommitmentEqualityProofData::new(
        &keypair,
        &ciphertext,
        &commitment,
        &opening,
        amount,
    )
    .unwrap();

    let pubkey_validity_data = PubkeyValidityData::new(&keypair).unwrap();
    pubkey_validity_data.verify_proof().unwrap();

    let latest_blockhash = connection.get_latest_blockhash().unwrap();

    let instruction = verify_ciphertext_commitment_equality(None, &pubkey_validity_data);
    let txn = Transaction::new_signed_with_payer(
        &[instruction],
        Some(&wallet.pubkey()),
        &[&wallet],
        latest_blockhash,
    );

    match connection.send_and_confirm_transaction(&txn) {
        Ok(sig) => loop {
            if let Ok(confirmed) = connection.confirm_transaction(&sig) {
                if confirmed {
                    println!("Transaction: {} Status: {}", sig, confirmed);
                    break;
                }
            }
        },
        Err(e) => println!("Error:, {}", e),
    }

Also, didn't find anywhere to use proof_data. In general, seems like the whole zk-program is lacking on documentation.

3

1 Answer 1

2

according to the token extensions status page the zk features will be available spring 2024 since they depend on solana 1.18.

https://spl.solana.com/token-2022/status

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.