Program Derive Address (PDA)

There 2 properties of an account:

  • owner: who can modify the account
  • authority: who can sign the account

PDAs are just specific accounts that have no private keys their authorities are belongs to programs.

Here is a good image from Solana Cookbook to show the difference between ownership and authority:

In this example. We will use a PDA to store the counter value!

Why PDA

PDAs serve as the foundation for Cross-Program Invocation, which allows Solana apps to be composable with one another.

Rent

Accounts need to be PAID to live on the chain. The fee is depends on how much data an account holds, and how long it will live. We will see how to count the fee in this example.

More detail about rent from official doc