decrypt101
SocialOpen ProjectsSupport me My Resumes
  • Preface
    • Motivation
    • Roadmap’s
  • Introduction to Blockchain
    • A Brief History
    • Growth of Blockchain
    • Structure of Blockchain
    • Types of Blockchain
    • Key Technologies of Blockchain
    • Features of Blockchain
    • How Blockchain Works ?
    • Implementation of Blockchain
    • Summary
  • Components of Blockchain Architecture
    • Distributed Ledger
    • Blocks
    • Transaction
    • Chain
    • Peer-to-Peer Network
    • Blockchain Layers
    • Off-Chain & On-Chain
    • Wallet
    • Mining
    • Tokens
    • Assets
    • State Channels
    • Sidechains
    • Oracles on Blockchain
    • Atomic Swaps
    • Decentralized Identity (DID)
    • Blockchain Data Storage
    • Interoperability
    • Data structures for Scaling Blockchain
    • Maximal Extractable Value (MEV)
  • Consensus Mechanisms
    • Proof of Work (PoW)
      • Implemation Using Rust
    • Proof of Stake (PoS)
    • Proof of Burn (PoB)
    • Proof of Capacity (PoC)
    • Proof of Activity (PoAc)
    • Proof of Weight (PoWe)
    • Proof of Luck (PoL)
    • Proof of Ownership (PoO)
    • Proof of Existence (PoE)
    • Proof of Believability (PoBe)
    • Proof of History (PoH)
    • Proof of Authority (PoA)
    • Proof of Elapsed Time (PoET)
  • Cryptographics
    • Encryption & Decryption
      • Symmetric Encryption
      • Asymmetric Encryption
      • Key Management and Exchange
      • Implementation
    • Cryptographic Hashing
      • Secure Hash Algorithms (SHA)
      • Message Digest Algorithms
      • Ethash
      • Blake2
      • SCrypt
      • RIPEMD-160
    • Digital Signature
      • Digital Signature Algorithms
      • Digital Signature in Blockchain
    • Zero-Knowledge Proofs (ZKPs)
      • Types of Zero-Knowledge Proof and Protocols
      • A Case Study of Polygon Platform
    • Multi-Party Computation (MPC)
    • Cryptanalysis
    • Practical Implementation
  • Decentralized Application (DApp)
    • Design and UX in Web3
  • Smart Contract
    • Development Tools
    • Solidity
    • Testing Smart Contract
    • Developing Smart Contract
    • Interacting & Deploying with Smart Contract
    • Verifying Smart Contracts
    • Upgrading Smart Contracts
    • Securing Smart Contract
    • Smart Contract Composability
    • Testnet and Mainnet
    • Blockchain Platform Using Smart Contract
    • Application of Smart Contract
    • Practical Implementation
  • Blockchain Platforms
    • Ethereum
      • Ethereum Virtual Machine (EVM)
      • ETHER and GAS
      • Ethereum transaction
      • Ethereum Accounts
      • Ethereum Stacking
      • Ethereum Network
      • Ethereum Scaling Solutions
      • Ethereum Use-Cases
      • Getting Started with Ethereum
      • Ethereum Ecosystem and Support
    • Solana
      • Solana Architecture
        • Solana Account Model
        • Solana Wallet
        • Transactions and Instructions
        • Solana Programs
        • Program Derived Address (PDA)
        • Cross Program Invocation (CPI)
        • Tokens on Solana
        • Clusters and Public RPC Endpoints
        • Transaction Confirmation & Expiration
        • Retrying Transactions
        • Versioned Transactions
        • Address Lookup Tables
        • State Compression
        • Actions and Blinks
      • Solana Developments
      • Solana Client
      • Advanced Solana
      • Solana Scaling and Performance Architecture
      • Solana Solutions and cases
      • Practical Implemenation
    • Binance Smart Chain (BSC)
      • Create a BEP20 Token
    • Hyperledger Fabric
    • Cosmos
    • Polkadot
    • Quorum
    • Polygon
    • Algorand
    • Corda
    • Avalanche
    • TRON
    • Summary
  • Decentralized Finance (DeFi)
    • DeFi Components
    • DeFi Protocols
    • DeFi Platforms
    • DeFi Risk Classification
      • Infrastructure-layer Attacks
      • Smart Contract Layer-attacks
      • Application Layer-attacks
      • DeFi Risks
    • DeFi and Blockchain
    • DeFi Impact
  • Decentralized Ecosystem and Digital Innovation
    • Layer 2 Scaling Fundamental
    • Tokenomics
    • Cryptocurrency
    • Quantative Trading
    • NFTs
    • GameFi
    • Metaverse
  • Blockchain as a Service (BaaS)
    • Building Fullstack Blockchain Platform
    • Decentralized Digital Identity
    • Build a Cryptocurrencies Exchange
    • Play-to-Earn Gaming
    • Solana Token Airdrop Manager
    • Smart Contract Development on Solana with Rust
    • Quantitative Trading Platform
    • Insurances protocols
    • Flash Loans
    • Asset Management
    • Tokenized Derivatives
    • Automated Market Makers (AMMs)
    • Staking
    • Lending and Borrowing Platforms
    • Yield Farming
    • Stablecoin System
    • Security Token Offerings (STOs)
    • Initial Coin Offerings (ICOs)
    • On-Chain Voting Systems
    • Decentralized Autonomous Organizations (DAOs)
    • NFT Marketplaces
    • Provenance Verification
    • Supply Chain Tracking
    • Commodities Tokenization
    • Real Estate Tokenization
    • Digital Certificates
    • KYC (Know Your Customer)
  • Blockchain Development Across Languages
    • Blockchain using Go(Golang)
    • Blockchain using Rust
    • Blockchain using Python
    • Blockchain using Cairo
  • Distributed Systems & Infrastructure Technology
    • Classification of Distributed Systems
    • Networked systems versus Distributed systems
    • Parallel systems vs Distributed systems
    • Distributed versus Decentralized systems
    • Processes of Distributed Systems
    • Architecture of Distributed systems
    • Infrastructure Technologies
  • Distributed System Patterns
    • Distributed Agreements Algorithms
      • HoneyBadgerBFT
    • Data Replications
    • Data Partition
    • Consistency
    • Distributed Time
    • Cluster Management
    • Communication between Nodes
    • Fault Tolerance and Resilience
      • How to design better fault tolerance systems
      • Resilience Patterns
    • Coordination systems
      • Clock synchronization
    • Security
      • Trust in distributed systems
      • Design of Principal Security
      • Security threats, policies, and mechanisms
      • Authentication and Authorizations
      • Cryptography
      • Monitoring in Security
  • Distributed System Design
    • Page 1
    • Distributed Shared Memory
    • Distributed Data Management
    • Distributed Knowledge Management
    • Distributed Ledger
  • FAQs
  • Support and Community
Powered by GitBook
On this page
  1. Blockchain Platforms
  2. Solana
  3. Solana Architecture

Program Derived Address (PDA)

Program Derived Address (PDA) in Solana

A Program Derived Address (PDA) is a special type of address in the Solana blockchain that is used by smart contracts (programs) to own accounts without needing a private key. Unlike standard Solana accounts, PDAs are deterministic addresses generated by programs themselves and are controlled by the program's logic, not by private key ownership.

Key Characteristics of PDAs:

  1. No Private Key: PDAs are not associated with a private key, meaning they cannot be directly signed by a user or account. Instead, they are controlled exclusively by the program that generates them.

  2. Deterministic Generation: A PDA is created deterministically by combining a base public key (often the program's own public key) and a set of seeds. These seeds can be arbitrary data (e.g., strings, numbers) that are hashed together to generate the PDA. This allows the same PDA to be regenerated as long as the same seeds are used.

  3. Owned by a Program: Only the specific program that generates a PDA has the authority to write or interact with the account associated with that PDA. This makes PDAs useful for managing program-owned data, such as escrow accounts or program state.

  4. Bump Seed: A PDA must not collide with a valid Solana account (because it cannot have a corresponding private key). To ensure uniqueness, Solana introduces a “bump seed,” which is incremented until a valid PDA is found that doesn't collide with an existing address.

Why Use PDAs?

PDAs are particularly useful in scenarios where the program needs to control specific accounts without relying on a private key. For example:

  • Escrow Accounts: A PDA can be used to hold tokens in escrow during a transaction, ensuring that only the program has control over releasing the funds once conditions are met.

  • Data Storage: A PDA can be used to store user-specific or program-specific data in a decentralized application, ensuring the program can manage this data safely and predictably.

  • Account Ownership: Programs can create PDAs to manage assets or interact with accounts deterministically based on user or transaction input.

Example of Generating a PDA:

In Solana's Rust programming environment, a PDA can be generated using the following steps:

use solana_program::pubkey::Pubkey;

fn find_pda() -> Pubkey {
    let seed = b"example_seed"; // Arbitrary seed data
    let (pda, bump_seed) = Pubkey::find_program_address(&[seed], &program_id);
    pda // This is the PDA
}
  • find_program_address: This function generates a PDA by taking a list of seed data and the program’s public key (program_id). It returns the PDA and the bump seed.

Use Case Example: Escrow in a Decentralized Exchange

  1. Creating the PDA: A decentralized exchange (DEX) might create a PDA for each user or trade, where tokens are held temporarily.

  2. Storing Tokens: The PDA is used as an escrow account, where tokens are deposited until both parties in the trade have fulfilled the terms.

  3. Releasing Funds: Only the DEX smart contract (program) can release the funds from the PDA, ensuring trustless escrow.

Advantages of PDAs:

  • Security: Since PDAs are not associated with private keys, they reduce the attack surface for key theft or misuse.

  • Predictability: The deterministic nature of PDAs ensures that specific accounts can always be regenerated from known inputs, which is useful for managing program state or user data.

  • Programmatic Control: PDAs enable programs to control accounts without user intervention, enabling more complex decentralized applications, such as staking contracts or DeFi protocols.

Summary

Program Derived Addresses (PDAs) in Solana provide a secure, deterministic way for programs to own and manage accounts without private keys. This is especially useful for managing program state, controlling funds, or setting up decentralized systems where programmatic control over accounts is essential. PDAs are a fundamental tool in Solana's ecosystem, enabling more complex, secure, and reliable smart contracts.

PreviousSolana ProgramsNextCross Program Invocation (CPI)

Last updated 7 months ago