Skip to content

Commit

Permalink
update accounts page links
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYJLiu committed Feb 5, 2025
1 parent 46a1034 commit 7ab5eac
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions content/docs/core/accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ description:
On Solana, all data is contained in what we call "accounts". You can think of
data on Solana as a public database with a single "Accounts" table, where each
entry in this table is an individual account with the same base
[Account type](https://github.com/anza-xyz/agave/blob/v2.1.11/sdk/account/src/lib.rs#L48-L60).
[Account type](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/account/src/lib.rs#L48-L60).

![Accounts](/assets/docs/core/accounts/accounts.png)

## Key Points

- Accounts can store up to
[10MiB](https://github.com/anza-xyz/agave/blob/v2.1.12/sdk/program/src/system_instruction.rs#L85)
[10MiB](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/program/src/system_instruction.rs#L85)
of data, which contain either executable program code or program state.

- Accounts require a
[rent deposit](https://github.com/anza-xyz/agave/blob/v2.1.12/sdk/rent/src/lib.rs#L93-L97)
[rent deposit](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/rent/src/lib.rs#L93-L97)
in lamports (SOL) that is proportional to the amount of data stored, which is
fully refundable when the account is closed.

- Every account has a program
[owner](https://github.com/anza-xyz/agave/blob/v2.1.11/sdk/account/src/lib.rs#L55).
[owner](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/account/src/lib.rs#L55).
Only the program that owns an account can modify its data or deduct its
lamport balance. However, anyone can increase the balance.

Expand Down Expand Up @@ -61,9 +61,9 @@ details are covered on the [Program Derived Address](/docs/core/pda) page.
### Account Type

Accounts have a max size of
[10MiB](https://github.com/anza-xyz/agave/blob/v2.1.12/sdk/program/src/system_instruction.rs#L85)
[10MiB](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/program/src/system_instruction.rs#L85)
and every account on Solana has the same base
[Account](https://github.com/anza-xyz/agave/blob/v2.1.11/sdk/account/src/lib.rs#L48-L60)
[Account](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/account/src/lib.rs#L48-L60)
type.

![Account Type](/assets/docs/core/accounts/account-type.svg)
Expand Down Expand Up @@ -119,9 +119,9 @@ balance that is proportional to amount of data stored on the account (in bytes).
This minimum balance is called "rent", although it functions more like a deposit
because the full amount can be recovered when an account is closed. You can find
the calculation
[here](https://github.com/anza-xyz/agave/blob/v2.1.12/sdk/rent/src/lib.rs#L93-L97)
[here](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/rent/src/lib.rs#L93-L97)
using these
[constants](https://github.com/anza-xyz/agave/blob/v2.1.12/sdk/rent/src/lib.rs#L47-L70).
[constants](https://github.com/anza-xyz/agave/blob/v2.1.13/sdk/rent/src/lib.rs#L47-L70).

The term "rent" is due to a deprecated mechanism that regularly deducted
lamports from accounts that fell below the rent threshold. This mechanism is no
Expand Down Expand Up @@ -150,14 +150,14 @@ development:
### System Program

By default, all new accounts are owned by the
[System Program](https://github.com/anza-xyz/agave/tree/v2.1.12/programs/system/src).
[System Program](https://github.com/anza-xyz/agave/tree/v2.1.13/programs/system/src).
The System Program performs several key tasks:

- [New Account Creation](https://github.com/anza-xyz/agave/blob/v2.1.12/programs/system/src/system_processor.rs#L146):
- [New Account Creation](https://github.com/anza-xyz/agave/blob/v2.1.13/programs/system/src/system_processor.rs#L146):
Only the System Program can create new accounts.
- [Space Allocation](https://github.com/anza-xyz/agave/blob/v2.1.12/programs/system/src/system_processor.rs#L71):
- [Space Allocation](https://github.com/anza-xyz/agave/blob/v2.1.13/programs/system/src/system_processor.rs#L71):
Sets the byte capacity for the data field of each account.
- [Assign Program Ownership](https://github.com/anza-xyz/agave/blob/v2.1.12/programs/system/src/system_processor.rs#L113):
- [Assign Program Ownership](https://github.com/anza-xyz/agave/blob/v2.1.13/programs/system/src/system_processor.rs#L113):
Once the System Program creates an account, it can reassign the designated
program owner to a different program account. This is how custom programs take
ownership of new accounts created by the System Program.
Expand All @@ -172,7 +172,7 @@ transaction fee payers.
### BPFLoader Program

The
[BPF Loader](https://github.com/anza-xyz/agave/tree/v2.1.12/programs/bpf_loader/src)
[BPF Loader](https://github.com/anza-xyz/agave/tree/v2.1.13/programs/bpf_loader/src)
is the program owner of all custom programs on the network, excluding other
native programs. It is responsible for deploying, upgrading, and executing
custom programs.
Expand All @@ -196,7 +196,7 @@ programs to execute their instructions.
### Program Account

When new programs are currently
[deployed](https://github.com/anza-xyz/agave/blob/v2.1.12/programs/bpf_loader/src/lib.rs#L527)
[deployed](https://github.com/anza-xyz/agave/blob/v2.1.13/programs/bpf_loader/src/lib.rs#L527)
on Solana, technically three separate accounts are created:

- **Program Account**: The main account representing an on-chain program. This
Expand Down

0 comments on commit 7ab5eac

Please sign in to comment.