> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Δημιουργία PDA

> Πώς να δημιουργήσετε και να αλληλεπιδράσετε με Program Derived Addresses (PDA)

<Note>Απαιτεί `cargo add --dev litesvm solana-sdk@4`</Note>

## Πλήρης δοκιμή

```rust tests/pda_test.rs
use litesvm::LiteSVM;
use solana_sdk::account::Account;
use solana_sdk::pubkey::Pubkey;

#[test]
fn test_pda_creation() {
    let mut svm = LiteSVM::new();

    // Program that owns the PDA
    let program_id = Pubkey::new_unique();

    // Derive PDA address
    let seed = b"my_pda";
    let (pda, bump) = Pubkey::find_program_address(
        &[seed],
        &program_id
    );

    println!("PDA: {}", pda);
    println!("Bump: {}", bump);

    // Create PDA account manually (for testing)
    svm.set_account(pda, Account {
        lamports: 1_000_000,
        data: vec![bump], // Store bump seed in data
        owner: program_id,
        executable: false,
        rent_epoch: 0,
    }).unwrap();

    // Verify PDA was created
    let account = svm.get_account(&pda).unwrap();
    assert_eq!(account.owner, program_id);
    assert_eq!(account.data[0], bump);

    println!("PDA created successfully!");
}
```

## Βασικά σημεία

1. **Παραγωγή PDA**: Χρησιμοποιήστε το `Pubkey::find_program_address()` για να παράγετε
   διευθύνσεις PDA
2. **Seeds**: Τα PDA παράγονται από seeds και το ID του προγράμματος
3. **Bump Seed**: Το bump seed διασφαλίζει ότι η διεύθυνση βρίσκεται εκτός της καμπύλης ed25519
4. **Δημιουργία λογαριασμού**: Χρησιμοποιήστε το `set_account()` για να δημιουργήσετε χειροκίνητα
   λογαριασμούς για δοκιμές
5. **Ιδιοκτησία**: Η διεύθυνση ενός PDA παράγεται από το ID ενός προγράμματος και μόνο αυτό
   το πρόγραμμα μπορεί να υπογράψει εκ μέρους της. Ιδιοκτήτης είναι το πρόγραμμα στο οποίο
   έχει ανατεθεί ο λογαριασμός
