Describe executable and owner account metadata
This commit is contained in:
@ -29,18 +29,31 @@ instruction is invalid, any changes made within the transaction are discarded.
|
|||||||
## Storing State between Transactions
|
## Storing State between Transactions
|
||||||
|
|
||||||
If the program needs to store state between transactions, it does so using
|
If the program needs to store state between transactions, it does so using
|
||||||
*accounts*. Solana supports several kinds of accounts:
|
*accounts*. Accounts are similar to files in operating systems such as Linux.
|
||||||
|
Like files, an account may hold arbitrary data and that data persists beyond
|
||||||
|
the liftime of a program. Also like files, an account includes metadata that
|
||||||
|
tells the runtime who is allowed to access the data and how. Unlike files, the
|
||||||
|
account includes metadata for the liftime of the file. That lifetime is
|
||||||
|
expressed in "tokens", which is a number of fractional native tokens, called
|
||||||
|
*lamports*. Accounts are held in validator memory and pay "rent" to stay there.
|
||||||
|
Each fullnode periodically scan all accounts and collects rent. Any account
|
||||||
|
that drops to zero lamports is purged.
|
||||||
|
|
||||||
1. Executable
|
If an account is marked "executable", it will only be used by a *loader* to run
|
||||||
2. Owned by a client
|
programs. For example, programs compiled to BPF are marked executable and
|
||||||
3. Owned by a program
|
loaded by the BPF loader. No program is allowed to modify the contents of an
|
||||||
4. Credit-only
|
executable account.
|
||||||
|
|
||||||
All accounts are identified by public keys and may hold arbitrary data. When
|
Accounts also include "owner" metadata. The owner is the program ID. The
|
||||||
the client sends transactions to programs, it requests access to accounts using
|
runtime grants the program write access to the account if its ID is the account
|
||||||
those keys. The runtime loads the account and passes it to the program. The
|
owner. If an account is not owned by a program, the program is permitted to
|
||||||
runtime also ensures accounts aren't written to if not owned by the client or
|
read its data and credit the account. There's one exception, however, accounts
|
||||||
program. Any writes to credit-only accounts are discarded unless the write was
|
owned by the `SystemProgram` may be written to and debited if the account
|
||||||
to credit tokens. Any user may credit other accounts tokens, regardless of
|
holder signed the transaction.
|
||||||
account permission.
|
|
||||||
|
|
||||||
|
Accounts are identified by client-generated public keys. When the client sends
|
||||||
|
transactions to programs, it requests access to accounts using those keys. The
|
||||||
|
runtime loads the account and passes it to the program. After the program
|
||||||
|
finishes executing, the runtime uses the account metadata to verify that none
|
||||||
|
of the access rules were violated, and if so, discards those changes, and marks
|
||||||
|
the transaction as failed.
|
||||||
|
@ -7,8 +7,8 @@ architecture.
|
|||||||
|
|
||||||
#### account
|
#### account
|
||||||
|
|
||||||
A persistent file addressed by [public key](#public-key) and with tokens
|
A persistent file addressed by [public key](#public-key) and with
|
||||||
tracking its lifetime.
|
[lamports](#lamport) tracking its lifetime.
|
||||||
|
|
||||||
#### block
|
#### block
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ the [ledger](#ledger).
|
|||||||
#### leader schedule
|
#### leader schedule
|
||||||
|
|
||||||
A sequence of [fullnode](#fullnode) [public keys](#public-key). The cluster
|
A sequence of [fullnode](#fullnode) [public keys](#public-key). The cluster
|
||||||
uses the leader schedule to determine which fullnode is in the [leader](#leader)
|
uses the leader schedule to determine which fullnode is in the
|
||||||
at any moment in time.
|
[leader](#leader) at any moment in time.
|
||||||
|
|
||||||
#### ledger
|
#### ledger
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ height](#tick-height).
|
|||||||
|
|
||||||
#### lockout
|
#### lockout
|
||||||
|
|
||||||
The duration of time in which a [fullnode](#fullnode) is unable to [vote](#vote) on
|
The duration of time in which a [fullnode](#fullnode) is unable to
|
||||||
another [fork](#fork).
|
[vote](#vote) on another [fork](#fork).
|
||||||
|
|
||||||
#### native token
|
#### native token
|
||||||
|
|
||||||
@ -135,7 +135,8 @@ The public key of a [keypair](#keypair).
|
|||||||
|
|
||||||
#### replicator
|
#### replicator
|
||||||
|
|
||||||
A type of [client](#client) that stores copies of segments of the [ledger](#ledger).
|
A type of [client](#client) that stores copies of segments of the
|
||||||
|
[ledger](#ledger).
|
||||||
|
|
||||||
#### secret key
|
#### secret key
|
||||||
|
|
||||||
@ -152,7 +153,8 @@ by the company Solana.
|
|||||||
|
|
||||||
#### stake
|
#### stake
|
||||||
|
|
||||||
Tokens forfeit to the [cluster](#cluster] if malicious [fullnode](#fullnode) behavior can be proven.
|
Tokens forfeit to the [cluster](#cluster] if malicious [fullnode](#fullnode)
|
||||||
|
behavior can be proven.
|
||||||
|
|
||||||
#### tick
|
#### tick
|
||||||
|
|
||||||
@ -172,7 +174,8 @@ A scarce, fungible member of a set of tokens.
|
|||||||
|
|
||||||
#### transaction
|
#### transaction
|
||||||
|
|
||||||
One or more [instructions](#instruction) signed by the [client](#client) and executed atomically.
|
One or more [instructions](#instruction) signed by the [client](#client) and
|
||||||
|
executed atomically.
|
||||||
|
|
||||||
#### transactions entry
|
#### transactions entry
|
||||||
|
|
||||||
@ -180,7 +183,8 @@ A set of [transactions](#transaction) that may be executed in parallel.
|
|||||||
|
|
||||||
#### validator
|
#### validator
|
||||||
|
|
||||||
The role of a [fullnode](#fullnode) when it is validating the [leader's](#leader) latest [entries](#entry).
|
The role of a [fullnode](#fullnode) when it is validating the
|
||||||
|
[leader's](#leader) latest [entries](#entry).
|
||||||
|
|
||||||
|
|
||||||
## Terminology Reserved for Future Use
|
## Terminology Reserved for Future Use
|
||||||
@ -190,7 +194,8 @@ for potential future use.
|
|||||||
|
|
||||||
#### blob
|
#### blob
|
||||||
|
|
||||||
A fraction of a [block](#block); the smallest unit sent between [fullnodes](#fullnode).
|
A fraction of a [block](#block); the smallest unit sent between
|
||||||
|
[fullnodes](#fullnode).
|
||||||
|
|
||||||
#### curio
|
#### curio
|
||||||
|
|
||||||
@ -202,7 +207,8 @@ The time in which a [leader schedule](#leader-schedule) is valid.
|
|||||||
|
|
||||||
#### light client
|
#### light client
|
||||||
|
|
||||||
A type of [client](#client) that can verify it's pointing to a valid [cluster](#cluster).
|
A type of [client](#client) that can verify it's pointing to a valid
|
||||||
|
[cluster](#cluster).
|
||||||
|
|
||||||
#### mips
|
#### mips
|
||||||
|
|
||||||
@ -210,8 +216,10 @@ Millions of [instructions](#instruction) per second.
|
|||||||
|
|
||||||
#### runtime
|
#### runtime
|
||||||
|
|
||||||
The component of a [fullnode](#fullnode) responsible for [program](#program) execution.
|
The component of a [fullnode](#fullnode) responsible for [program](#program)
|
||||||
|
execution.
|
||||||
|
|
||||||
#### thin client
|
#### thin client
|
||||||
|
|
||||||
A type of [client](#client) that trusts it is communicating with a valid [cluster](#cluster).
|
A type of [client](#client) that trusts it is communicating with a valid
|
||||||
|
[cluster](#cluster).
|
||||||
|
Reference in New Issue
Block a user