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
  • The docs on ZK are horrible docs.solana.com/developing/runtime-facilities/zk-token-proof nothing mentioning which release, examples etc.. But I assume you're correct since it's obviously missing.
    – Ohad Dahan
    Commented Jan 12 at 18:33
  • 1
    It'll come even earlier, with 1.17! The extra features in 1.18 are for confidential transfers with fees.
    – Jon C
    Commented Jan 14 at 19:11
  • So it's out now? I don't see much support for it in the JS client. Particularly, I am looking to group el gamal encrypt a value on the front end - github.com/solana-labs/solana/blob/…
    – techiejd
    Commented Apr 7 at 14:52

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.