# On-Chain Reference

Complete reference for ZK-Provenance's Solana Anchor program.

## Program Details

| Field       | Value                                          |
| ----------- | ---------------------------------------------- |
| Program ID  | `E1kuGTachRuekJXgsPaeAEjMzbVMq4rhxAQQCxtehsB8` |
| IDL Account | `FUEmc6kuDRvVBHdVXTQzYa8jNdp8cZbHJRxyuggxQirA` |
| Network     | Solana Devnet                                  |
| Framework   | Anchor 1.0.2                                   |
| Language    | Rust                                           |

## View on Solana Explorer

* **Program:** [View on Explorer](https://explorer.solana.com/address/E1kuGTachRuekJXgsPaeAEjMzbVMq4rhxAQQCxtehsB8?cluster=devnet)
* **IDL:** [View IDL](https://explorer.solana.com/address/FUEmc6kuDRvVBHdVXTQzYa8jNdp8cZbHJRxyuggxQirA?cluster=devnet)

## Attestation Account Structure

Each attestation creates a **PDA (Program Derived Address)** on Solana with the following structure:

```rust
pub struct Attestation {
    pub owner: Pubkey,            // Wallet that created the attestation
    pub commitment: [u8; 32],     // Poseidon hash of document
    pub merkle_root: [u8; 32],    // Root of Merkle tree
    pub proof_hash: [u8; 32],     // Hash of the ZK proof
    pub compliance_score: u8,     // 0-100 score
    pub frameworks: Vec<String>,  // Applied frameworks (GDPR, HIPAA, etc.)
    pub timestamp: i64,           // Unix timestamp
    pub verified: bool,           // Verification status
    pub nonce: u64,               // Unique nonce
}
```

## Instructions

### `initialize_attestation`

Creates a new attestation account on-chain.

**Parameters:**

```rust
pub struct InitializeAttestation {
    pub commitment: [u8; 32],
    pub merkle_root: [u8; 32],
    pub proof_data: Vec<u8>,
    pub public_inputs: Vec<u8>,
    pub compliance_score: u8,
    pub frameworks: Vec<String>,
    pub data_category: String,
}
```

**Cost:** \~0.002 SOL (rent-exempt deposit) **Finality:** \~400ms

## Verifying an Attestation

### Via Solana Explorer

1. Get the transaction signature from the app
2. Go to: `https://explorer.solana.com/tx/{signature}?cluster=devnet`
3. View the instruction data and attestation PDA

### Via Solana Web3.js

```javascript
import { Connection, PublicKey } from '@solana/web3.js'

const connection = new Connection('https://api.devnet.solana.com')

// Fetch attestation account
const attestationPDA = new PublicKey('YOUR_ATTESTATION_PDA')
const accountInfo = await connection.getAccountInfo(attestationPDA)

console.log('Attestation data:', accountInfo.data)
```

## Transaction Costs

| Operation          | Cost            |
| ------------------ | --------------- |
| Create attestation | \~0.002 SOL     |
| Network fee        | \~0.000005 SOL  |
| **Total**          | **\~0.002 SOL** |

At current prices (\~$150/SOL), this is approximately **$0.30 per attestation** on devnet.

Mainnet costs will be similar — Solana fees are stable and predictable.

## Mainnet Deploy

Mainnet deployment is planned for **Q4 2026**.

The Program ID will be different on mainnet — documentation will be updated when available.

## FAQ

**Q: Are attestations permanent?** A: Yes. Solana accounts with rent-exempt balance persist indefinitely.

**Q: Can an attestation be deleted?** A: No. Once submitted, attestations are permanent and immutable.

**Q: Can I verify without the original document?** A: Yes. The ZK proof is self-contained — verification requires only the proof and public inputs, not the original data.

**Q: Is the program audited?** A: Audit is planned for Q3 2026. Bug bounty program coming soon.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zkprovenance.io/reference/on-chain-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
