Reorg programming model to be more top-down
First explain how a client interacts with existing programs and why you'd do that. Next, mention that users can contribute their own programs. Then explain how those programs can be written in any language. Finally, mention persistent storage, which is only needed by stateful programs.
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
# Programming Model
|
# Programming Model
|
||||||
|
|
||||||
The Solana *runtime* can execute untrusted on-chain programs written in any
|
A client interacts with a Solana cluster by sending it *transactions* with one
|
||||||
programming language that can target the Berkley Packet Filter (BPF) safe
|
or more *instructions*. The Solana *runtime* passes those instructions to
|
||||||
execution environment. The Solana SDK offers the best support for C programs,
|
user-contributed *programs*. An instruction might, for example, tell a program
|
||||||
which is compiled to BPF using the [LLVM compiler
|
to move *tokens* from one *account* to another or create an interactive
|
||||||
infrastructure](https://llvm.org). Alternatively, a client might choose to
|
contract that governs how tokens are moved. Instructions are executed
|
||||||
bypass LLVM and use Python, Lua or C++ to generate BPF directly via the [BPF
|
atomically. If any instruction is invalid, any changes made within the
|
||||||
Compiler Collection](https://github.com/iovisor/bcc) (BCC).
|
transaction are discarded.
|
||||||
|
|
||||||
## Deploying Programs to a Cluster
|
## Deploying Programs to a Cluster
|
||||||
|
|
||||||
@ -18,13 +18,12 @@ The cluster stores the program locally and makes it available to clients via a
|
|||||||
*program ID*. The program ID is a *public key* generated by the client and is
|
*program ID*. The program ID is a *public key* generated by the client and is
|
||||||
used to reference the program in subsequent transactions.
|
used to reference the program in subsequent transactions.
|
||||||
|
|
||||||
## Interacting with On-chain Programs
|
A program may be written in any programming language that can target the
|
||||||
|
Berkley Packet Filter (BPF) safe execution environment. The Solana SDK offers
|
||||||
After a program has been deployed, a client utilizes it by sending transactions
|
the best support for C programs, which is compiled to BPF using the [LLVM
|
||||||
to the Solana cluster. A transaction contains one or more *instructions*. Each
|
compiler infrastructure](https://llvm.org). Alternatively, a client might
|
||||||
instruction references the program ID that corresponds to the program that the
|
choose to bypass LLVM and use Python, Lua or C++ to generate BPF directly via
|
||||||
runtime should use to execute it. Instructions are executed atomically. If any
|
the [BPF Compiler Collection](https://github.com/iovisor/bcc) (BCC).
|
||||||
instruction is invalid, any changes made within the transaction are discarded.
|
|
||||||
|
|
||||||
## Storing State between Transactions
|
## Storing State between Transactions
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user