From 0ff7d5836064545916fe63e05845e57a6cabfd03 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 27 Jul 2022 13:45:24 -0400 Subject: [PATCH 01/11] feat: added intro to dApps and programs pages --- docs/src/developing/intro/dapps.md | 44 +++++++++++++++++++++ docs/src/developing/intro/programs.md | 57 +++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 docs/src/developing/intro/dapps.md create mode 100644 docs/src/developing/intro/programs.md diff --git a/docs/src/developing/intro/dapps.md b/docs/src/developing/intro/dapps.md new file mode 100644 index 00000000000..296ae1ac793 --- /dev/null +++ b/docs/src/developing/intro/dapps.md @@ -0,0 +1,44 @@ +--- +title: What is a dApp? +description: "Decetralized applications, aka dApps, are the user facing applications of the Solana blockchain. They are written with languages like Javscript and Rust." +--- + +Decetralized applications, "*dApps*" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and Javascript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. + +Since Solana Programs are "*composable*" and callable by anyone, dApp developers are not required to build and deploy their own on-chain programs. In fact, they often use a combination of custom written code for their own [on-chain programs](./programs.md#on-chain-programs), [Native programs](../runtime-facilities/programs.md), and other programs from the [Solana Program Library](https://spl.solana.com). + +## dApp Examples + +Decentralized apps are being used all across the Solana blockchain to accomplish different things. Some dApps are focused on decentralized finance (DeFi), empowering community governance through DAOs, or even enouraging people to get out and move their bodies. + +Some of the most commonly known Solana dApps include: + +- [Phantom Wallet](https://solana.com/ecosystem/phantom): Solana browser based wallet extension +- [Metaplex](https://solana.com/ecosystem/metaplex): The NFT standard on Solana +- [Squads](https://solana.com/ecosystem/squads): Collaboration and DAO tool +- [Orca](https://solana.com/ecosystem/orca): User-friendly cryptocurrency exchange built on Solana +- [StepN](https://solana.com/ecosystem/stepn): NFT game encouraging people to move their bodies +- [MagicEden](https://solana.com/ecosystem/magiceden): Poplar Solana NFT marketplace +- [Serum](https://solana.com/ecosystem/serum): High-speed, orderbook based, non-custodial DEX + +You can explore more of the [Solana community dApps](https://solana.com/ecosystem) on Solana.com + +## How to Build a dApp + +For the frontend, user facing portion of dApps, developers can use most modern Javascript frameworks that utilize the NPM registry for dependancy management. Including React, NextJS, Vue, Node, and more. + +The blockchain deployable Solana programs are commonly created with the [Rust](https://www.rust-lang.org/) programming language. But can also be created with other low level languages that can be compiled with the BPF loader like C and C++. + +Due to it's developer convinience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). + +## dApp Boilerplate with NPX + +The Solana developer community has created a NPM package to empower developers to rapidly scaffold the boilerplate for Solana dApps. Including wiring up the wallet adapter for the most common [Solana wallets](../../wallet-guide.md). + +To quickly scaffold a Solana dApp with this tool, run the following command: + +```sh +npx create-solana-dapp +``` + +> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) packages is open source and avilable in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). \ No newline at end of file diff --git a/docs/src/developing/intro/programs.md b/docs/src/developing/intro/programs.md new file mode 100644 index 00000000000..58b6fe7a4e2 --- /dev/null +++ b/docs/src/developing/intro/programs.md @@ -0,0 +1,57 @@ +--- +title: What are Solana Programs? +description: "A Solana Program, aka smart contract, is the executable code that interprets the instructions on the blockchain. There are two types: Native and On-Chain." +--- + +Solana Programs, often referred to as "*smart contracts*" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. + +Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's *parrallel processing* model that helps to enable the high transactions speeds of the blockchain. + +## Key points + +- Programs are essentially a special type of [Account](../programming-model/accounts.md) that is marked as "*executable*" +- Programs can own other Accounts +- Programs can only *change the data* or *debit* accounts they own +- Any program can *read* or *credit* another account +- Programs are considered stateless since the primary data stored in a program account is the its compiled BPF code +- Programs can be upgraded by their owner (see more on that below) + +## Types of programs + +The Solana blockchain has two types of programs: + +- Native programs +- On chain programs + +### On chain programs + +These user programable programs, often referred to as "*smart contracts*" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! + +In effect, "on chain programs" are any program that is not baked directly into the Solana cluster's core code (like the native programs discussed below). + +All these programs are collectively known as the [Solana Program Library](https://spl.solana.com/). And even though the Solana foundation and it's core engineers maintain a few of the on chain programs, any one can create or publish one. On chain programs can also be updated directly on the blockchain by the respective program's Account owner. + +### Native programs + +Native programs are a special handful of programs that are built directly into the core of the Solana blockchain. +They are essential in the operation of validator nodes and clusters. These special programs + +Similar to other "on-chain" programs in Solana, native programs can be called by any other program/user. However, they can only be upgraded as part of the core blockchain and cluster updates. These native program upgrades are controlled via the releases to the [different clusters](../../cluster/overview.md). + +#### Examples of native programs include: + +- [System Program](../runtime-facilities/programs.md#system-program): Create new accounts, transfer tokens, and more +- [BPF Loader Program](../runtime-facilities/programs.md#bpf-loader): Deploys, upgrades, and executes programs on chain +- [Vote program](../runtime-facilities/programs.md#vote-program): Create and manage accounts that track validator voting state and rewards. + +## Executable + +When a Solana program is deployed onto the network, it is marked as "executable" by the [BPF Loader Program](../runtime-facilities/programs.md#bpf-loader). This allows the Solana runtime to efficently and properly execute the compiled program code. + +## Upgradable + +Unline other blockchains, Solana programs can be upgraded after they are deployed to the network. + +Native programs can only be upgraded as part of cluster updates when new software releases are made. + +On chain programs (aka "SPL programs") can be upgraded by the account that is marked as the "*owner*", which is usually the Solana account/address that deployed the program to begin with. \ No newline at end of file From c2cc87ba46fae9d2282af67e6117427e7cc67714 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 27 Jul 2022 14:05:41 -0400 Subject: [PATCH 02/11] style: removed whitespaces and updates MD syntax --- docs/src/developing/intro/dapps.md | 10 +++++----- docs/src/developing/intro/programs.md | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/src/developing/intro/dapps.md b/docs/src/developing/intro/dapps.md index 296ae1ac793..8e4f1bc02ce 100644 --- a/docs/src/developing/intro/dapps.md +++ b/docs/src/developing/intro/dapps.md @@ -3,9 +3,9 @@ title: What is a dApp? description: "Decetralized applications, aka dApps, are the user facing applications of the Solana blockchain. They are written with languages like Javscript and Rust." --- -Decetralized applications, "*dApps*" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and Javascript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. +Decetralized applications, "_dApps_" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and Javascript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. -Since Solana Programs are "*composable*" and callable by anyone, dApp developers are not required to build and deploy their own on-chain programs. In fact, they often use a combination of custom written code for their own [on-chain programs](./programs.md#on-chain-programs), [Native programs](../runtime-facilities/programs.md), and other programs from the [Solana Program Library](https://spl.solana.com). +Since Solana Programs are "_composable_" and callable by anyone, dApp developers are not required to build and deploy their own on-chain programs. In fact, they often use a combination of custom written code for their own [on-chain programs](./programs.md#on-chain-programs), [Native programs](../runtime-facilities/programs.md), and other programs from the [Solana Program Library](https://spl.solana.com). ## dApp Examples @@ -29,16 +29,16 @@ For the frontend, user facing portion of dApps, developers can use most modern J The blockchain deployable Solana programs are commonly created with the [Rust](https://www.rust-lang.org/) programming language. But can also be created with other low level languages that can be compiled with the BPF loader like C and C++. -Due to it's developer convinience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). +Due to it's developer convinience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). ## dApp Boilerplate with NPX The Solana developer community has created a NPM package to empower developers to rapidly scaffold the boilerplate for Solana dApps. Including wiring up the wallet adapter for the most common [Solana wallets](../../wallet-guide.md). -To quickly scaffold a Solana dApp with this tool, run the following command: +To quickly scaffold a Solana dApp with this tool, run the following command: ```sh npx create-solana-dapp ``` -> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) packages is open source and avilable in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). \ No newline at end of file +> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) packages is open source and avilable in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). diff --git a/docs/src/developing/intro/programs.md b/docs/src/developing/intro/programs.md index 58b6fe7a4e2..bb7068fa678 100644 --- a/docs/src/developing/intro/programs.md +++ b/docs/src/developing/intro/programs.md @@ -3,16 +3,16 @@ title: What are Solana Programs? description: "A Solana Program, aka smart contract, is the executable code that interprets the instructions on the blockchain. There are two types: Native and On-Chain." --- -Solana Programs, often referred to as "*smart contracts*" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. +Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. -Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's *parrallel processing* model that helps to enable the high transactions speeds of the blockchain. +Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's _parrallel processing_ model that helps to enable the high transactions speeds of the blockchain. ## Key points -- Programs are essentially a special type of [Account](../programming-model/accounts.md) that is marked as "*executable*" +- Programs are essentially a special type of [Account](../programming-model/accounts.md) that is marked as "_executable_" - Programs can own other Accounts -- Programs can only *change the data* or *debit* accounts they own -- Any program can *read* or *credit* another account +- Programs can only _change the data_ or _debit_ accounts they own +- Any program can _read_ or _credit_ another account - Programs are considered stateless since the primary data stored in a program account is the its compiled BPF code - Programs can be upgraded by their owner (see more on that below) @@ -25,7 +25,7 @@ The Solana blockchain has two types of programs: ### On chain programs -These user programable programs, often referred to as "*smart contracts*" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! +These user programable programs, often referred to as "_smart contracts_" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! In effect, "on chain programs" are any program that is not baked directly into the Solana cluster's core code (like the native programs discussed below). @@ -33,7 +33,7 @@ All these programs are collectively known as the [Solana Program Library](https: ### Native programs -Native programs are a special handful of programs that are built directly into the core of the Solana blockchain. +Native programs are a special handful of programs that are built directly into the core of the Solana blockchain. They are essential in the operation of validator nodes and clusters. These special programs Similar to other "on-chain" programs in Solana, native programs can be called by any other program/user. However, they can only be upgraded as part of the core blockchain and cluster updates. These native program upgrades are controlled via the releases to the [different clusters](../../cluster/overview.md). @@ -54,4 +54,4 @@ Unline other blockchains, Solana programs can be upgraded after they are deploye Native programs can only be upgraded as part of cluster updates when new software releases are made. -On chain programs (aka "SPL programs") can be upgraded by the account that is marked as the "*owner*", which is usually the Solana account/address that deployed the program to begin with. \ No newline at end of file +On chain programs (aka "SPL programs") can be upgraded by the account that is marked as the "_owner_", which is usually the Solana account/address that deployed the program to begin with. From a1d07704409becf9183f6aac9d6aa8f30352ea6d Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 27 Jul 2022 15:09:31 -0400 Subject: [PATCH 03/11] fix: spellcheck --- docs/src/developing/intro/dapps.md | 13 +++++++------ docs/src/developing/intro/programs.md | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/src/developing/intro/dapps.md b/docs/src/developing/intro/dapps.md index 8e4f1bc02ce..15165a4e363 100644 --- a/docs/src/developing/intro/dapps.md +++ b/docs/src/developing/intro/dapps.md @@ -1,15 +1,16 @@ --- title: What is a dApp? -description: "Decetralized applications, aka dApps, are the user facing applications of the Solana blockchain. They are written with languages like Javscript and Rust." +description: "Decentralized applications, aka dApps, are the user facing applications of the Solana blockchain. They are written with languages like JavaScript and Rust." +keywords: "" --- -Decetralized applications, "_dApps_" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and Javascript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. +Decentralized applications, "_dApps_" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and JavaScript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. Since Solana Programs are "_composable_" and callable by anyone, dApp developers are not required to build and deploy their own on-chain programs. In fact, they often use a combination of custom written code for their own [on-chain programs](./programs.md#on-chain-programs), [Native programs](../runtime-facilities/programs.md), and other programs from the [Solana Program Library](https://spl.solana.com). ## dApp Examples -Decentralized apps are being used all across the Solana blockchain to accomplish different things. Some dApps are focused on decentralized finance (DeFi), empowering community governance through DAOs, or even enouraging people to get out and move their bodies. +Decentralized apps are being used all across the Solana blockchain to accomplish different things. Some dApps are focused on decentralized finance (DeFi), empowering community governance through DAOs, or even encouraging people to get out and move their bodies. Some of the most commonly known Solana dApps include: @@ -25,11 +26,11 @@ You can explore more of the [Solana community dApps](https://solana.com/ecosyste ## How to Build a dApp -For the frontend, user facing portion of dApps, developers can use most modern Javascript frameworks that utilize the NPM registry for dependancy management. Including React, NextJS, Vue, Node, and more. +For the frontend, user facing portion of dApps, developers can use most modern JavaScript frameworks that utilize the NPM registry for dependency management. Including React, NextJS, Vue, Node, and more. The blockchain deployable Solana programs are commonly created with the [Rust](https://www.rust-lang.org/) programming language. But can also be created with other low level languages that can be compiled with the BPF loader like C and C++. -Due to it's developer convinience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). +Due to it's developer convenience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). ## dApp Boilerplate with NPX @@ -41,4 +42,4 @@ To quickly scaffold a Solana dApp with this tool, run the following command: npx create-solana-dapp ``` -> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) packages is open source and avilable in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). +> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) package is open source and available in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). diff --git a/docs/src/developing/intro/programs.md b/docs/src/developing/intro/programs.md index bb7068fa678..4fcf58013c1 100644 --- a/docs/src/developing/intro/programs.md +++ b/docs/src/developing/intro/programs.md @@ -1,11 +1,12 @@ --- title: What are Solana Programs? description: "A Solana Program, aka smart contract, is the executable code that interprets the instructions on the blockchain. There are two types: Native and On-Chain." +keywords: "" --- Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. -Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's _parrallel processing_ model that helps to enable the high transactions speeds of the blockchain. +Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's _parallel processing_ model that helps to enable the high transactions speeds of the blockchain. ## Key points @@ -25,7 +26,7 @@ The Solana blockchain has two types of programs: ### On chain programs -These user programable programs, often referred to as "_smart contracts_" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! +These user programmable programs, often referred to as "_smart contracts_" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! In effect, "on chain programs" are any program that is not baked directly into the Solana cluster's core code (like the native programs discussed below). @@ -46,11 +47,11 @@ Similar to other "on-chain" programs in Solana, native programs can be called by ## Executable -When a Solana program is deployed onto the network, it is marked as "executable" by the [BPF Loader Program](../runtime-facilities/programs.md#bpf-loader). This allows the Solana runtime to efficently and properly execute the compiled program code. +When a Solana program is deployed onto the network, it is marked as "executable" by the [BPF Loader Program](../runtime-facilities/programs.md#bpf-loader). This allows the Solana runtime to efficiently and properly execute the compiled program code. ## Upgradable -Unline other blockchains, Solana programs can be upgraded after they are deployed to the network. +Unlike other blockchains, Solana programs can be upgraded after they are deployed to the network. Native programs can only be upgraded as part of cluster updates when new software releases are made. From 1b7bc19a7b92fa31710475236389f9641aacb89a Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Thu, 28 Jul 2022 14:37:57 -0400 Subject: [PATCH 04/11] feat: what is rent page --- docs/src/developing/intro/rent.md | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/src/developing/intro/rent.md diff --git a/docs/src/developing/intro/rent.md b/docs/src/developing/intro/rent.md new file mode 100644 index 00000000000..6bc3def1c58 --- /dev/null +++ b/docs/src/developing/intro/rent.md @@ -0,0 +1,60 @@ +--- +title: What is rent? +description: "Rent: the small fee Solana accounts incur to store data on the blockchain. Accounts with >2 years of rent are rent exempt and do not pay the periodic fee." +keywords: "" +--- + +The small fee every Solana Account (or Program) to store data on the blockchain is called "*rent*". This *time and space* based fee is required to keep an account, and its therfore its data, alive on the blockchain since [clusters](../../cluster/overview.md) must actively maintain this data. + +Rent can be "*collected*" in two primary ways: + +- when certain [specified conditions](#collecting-rent) occur that interact with the specific data in an account +- or, not collected at all when an account is [rent exempt](#rent-exempt) + +When an Account no longer has enough LAMPORTS to pay its rent, it will be removed from the network in a process known as [Garbage Collection](#garbage-collection). + +> **Note:** Rent is different from [transactions fees](../../transaction_fees.md). Rent is paid (or held in an Account) to keep data stored on the Solana blockchain. Where as transaction fees are paid to process [instructions](../developing/../programming-model/transactions.md#instructions) on the network. + +### Rent rate + +The Solana rent rate is set on a network wide basis, primarily based on the set LAMPORTS *per* byte *per* year. + +Currently, the rent rate is a static amount and stored in the the [Rent sysvar](../runtime-facilities/sysvars.md#rent). + +## Rent exempt + +Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "*rent exempt*" and will not incur a rent collection. + +> At the time of writing this, new Accounts and Programs **are required** to be initialized with enough LAMPORTS to become rent-exempt. The RPC endpoints have the ability to calculate this [estimated rent exempt balance](../clients/jsonrpc-api.md#getminimumbalanceforrentexemption) and is recommended to be used. + +Every time an account's balance is reduced, a check is performed to see if the account is still rent exempt. Transactions that would cause an account's balance to drop below the rent exempt threshold will fail. + +## Collecting rent + +Accounts that are not rent exempt will have to pay their rent in the two following cases: + +1. when referenced by a transaction, and +2. at least once an [epoch](../../terminology.md#epoch) + +### Referenced by a transaction + +This type of rent collection included the transaction that initially creates the account, as well as during the normal transaction processing by the bank. + +### Once an epoch + +At least once an epoch, rent is collected from Solana Accounts that are not rent exempt. This is to ensure that even stale accounts (aka accounts that were not referenced during the recent epoch) have rent collected. + +This type of rent collection requires a scan of the all accounts and is spread over the entire epoch. This is to help avoid load spikes on the network. + +## Garbage collection + +Accounts that do not maintain their rent exempt status, or have a balance high enough to pay rent, are removed from the network in a process known as *garbage collection*. This process is done to help reduce the network wide storage of no longer used/maintained data. + +You can learn more about [garbage collection here](../../implemented-proposals/persistent-account-storage.md#garbage-collection) in this implemented proposal. + +## Learn more about Rent + +You can learn more about Solana Rent with the following articles and documentation: + +- [Implemented Proposals - Rent](../../implemented-proposals/rent.md) +- [Implemented Proposals - Account Storage](../../implemented-proposals/persistent-account-storage.md) \ No newline at end of file From 31de3700ea993b7080572e353658c094be1c6fb9 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Thu, 28 Jul 2022 14:49:07 -0400 Subject: [PATCH 05/11] fix: fix typos and removed whitespaces --- docs/src/developing/intro/rent.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/developing/intro/rent.md b/docs/src/developing/intro/rent.md index 6bc3def1c58..b1fcc01f8b5 100644 --- a/docs/src/developing/intro/rent.md +++ b/docs/src/developing/intro/rent.md @@ -4,16 +4,16 @@ description: "Rent: the small fee Solana accounts incur to store data on the blo keywords: "" --- -The small fee every Solana Account (or Program) to store data on the blockchain is called "*rent*". This *time and space* based fee is required to keep an account, and its therfore its data, alive on the blockchain since [clusters](../../cluster/overview.md) must actively maintain this data. +The small fee every Solana Account (or Program) to store data on the blockchain is called "*rent*". This *time and space* based fee is required to keep an account, and its therefore its data, alive on the blockchain since [clusters](../../cluster/overview.md) must actively maintain this data. Rent can be "*collected*" in two primary ways: -- when certain [specified conditions](#collecting-rent) occur that interact with the specific data in an account +- when certain [specified conditions](#collecting-rent) occur that interact with the specific data in an account - or, not collected at all when an account is [rent exempt](#rent-exempt) When an Account no longer has enough LAMPORTS to pay its rent, it will be removed from the network in a process known as [Garbage Collection](#garbage-collection). -> **Note:** Rent is different from [transactions fees](../../transaction_fees.md). Rent is paid (or held in an Account) to keep data stored on the Solana blockchain. Where as transaction fees are paid to process [instructions](../developing/../programming-model/transactions.md#instructions) on the network. +> **Note:** Rent is different from [transactions fees](../../transaction_fees.md). Rent is paid (or held in an Account) to keep data stored on the Solana blockchain. Where as transaction fees are paid to process [instructions](../developing/../programming-model/transactions.md#instructions) on the network. ### Rent rate @@ -23,7 +23,7 @@ Currently, the rent rate is a static amount and stored in the the [Rent sysvar]( ## Rent exempt -Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "*rent exempt*" and will not incur a rent collection. +Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "*rent exempt*" and will not incur a rent collection. > At the time of writing this, new Accounts and Programs **are required** to be initialized with enough LAMPORTS to become rent-exempt. The RPC endpoints have the ability to calculate this [estimated rent exempt balance](../clients/jsonrpc-api.md#getminimumbalanceforrentexemption) and is recommended to be used. From b2e82965ba198767ceadcd2e452a2f76bc2bd8df Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 29 Jul 2022 13:05:50 -0400 Subject: [PATCH 06/11] fix: updated terminolgy --- docs/src/terminology.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/src/terminology.md b/docs/src/terminology.md index 2c22efb2bbd..87c9d57fafd 100644 --- a/docs/src/terminology.md +++ b/docs/src/terminology.md @@ -205,7 +205,7 @@ The private key of a [keypair](#keypair). ## program -The code that interprets [instructions](#instruction). +The executable code that interprets the [instructions](#instruction) sent inside of each [transaction](#transaction) on the Solana. These programs are often referred to as "[_smart contracts_](./developing//intro/programs.md)" on other blockchains. ## program derived account (PDA) @@ -231,6 +231,16 @@ Transactions should request the minimum amount of compute units required for exe The public key of a [keypair](#keypair). +## rent + +Fee paid by [Accounts](#account) and [Programs](#program) to store data on the blockchain. When accounts do not have enough balance to pay rent, they may be Garbage Collected. + +See also [rent exempt](#rent-exempt) below. Learn more about rent here: [What is rent?](../src/developing/intro/rent.md). + +## rent exempt + +Accounts that maintain more than 2 years with of rent payments in their account are considered "*rent exempt*" and will not incur the [collection of rent](../src/developing/intro/rent.md#collecting-rent). + ## root A [block](#block) or [slot](#slot) that has reached maximum [lockout](#lockout) on a [validator](#validator). The root is the highest block that is an ancestor of all active forks on a validator. All ancestor blocks of a root are also transitively a root. Blocks that are not an ancestor and not a descendant of the root are excluded from consideration for consensus and can be discarded. From 655b84b4b6d6d6b28ed21ed40b6e79f2e95692da Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Mon, 8 Aug 2022 15:11:36 -0400 Subject: [PATCH 07/11] feat: added what is web 3 page --- docs/src/developing/intro/web3.md | 112 ++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 docs/src/developing/intro/web3.md diff --git a/docs/src/developing/intro/web3.md b/docs/src/developing/intro/web3.md new file mode 100644 index 00000000000..314b19f4aec --- /dev/null +++ b/docs/src/developing/intro/web3.md @@ -0,0 +1,112 @@ +--- +title: What is Web3? +description: "" +keywords: "web3 meaning, web3.js, web3js, web3 vs web2, npm, yarn, pnpm, JavaScript, web3 explained" +--- + +Web3 is the next phase of the internet, focused on being built on top of decentralized technologies like the Solana blockchain. It is an idea that people will no longer be required to rely on large organizations to act as a trusted intermediaries to interact with one another. Instead, web3 can rely on public, secure, and auditable blockchains to act as trusted sources of information and interactions. + +Since the concept of web3 is still relatively new, many people have different specific definitions of what web3 _can_ and _should_ be. But most people agree upon a common theme: + +- people to have more privacy on the internet +- people being able to monetize their own efforts and/or content on the internet, in ways they choose + +## Web2 vs Web3 + +In the traditional web2 world, centralized organizations are at the center of the internet and the content being created online (including monetizing that content). In general, people are creating the content being consumed online, and the web2 organizations are controlling that information. Generating various amounts of profits from their user generated content. Sometimes giving small fractions of monetary rewards to their creators. But often at the expense of their user's privacy. + +In a web3 world, users would be able to create their own content online. They can choose how their personal information and content is handled by other individuals or organizations. From written articles or blog posts to custom works of art, the content creators would be able to choose their preferred distribution method. They can choose what of their personal information is attached to their online creations. + +In the end, web3 is about giving **choice** back to individuals. + +## What can be built with web3? + +People and organizations are constantly building new applications and experiences on web3 technology. + +A few examples of the types of applications, organizations, and ideas being built in web3 include: + +- [Programmable Blockchains](https://solana.com) +- [Decentralized Autonomous Organizations (DAOs)](#daos) +- [Decentralized Finance (DeFi)](#defi) +- [Non-Fungible Tokens (NFTs)](#nfts) + +Almost anything can and is being built with web3/blockchain technologies, and the possibilities are near endless. + +#### DAOs + +Decentralized Autonomous Organizations, or _DAOs_ for short, allows people from around to world to collaborate together for a common goal. They can be developing protocols and sharing source code or raising funds for charitable causes. Or even operate a social club of sorts that just aims to talk about a common topic. + +These organizations can decide internally how to govern themselves or make progress on their goals. DAOs can be structured similar to how a publicly traded company functions, with a head boss and a core team, or even operate in a "_flat structure_" where every individual's vote is worth the same. DAOs can choose to operate however they choose. + +#### DeFi + +Decentralized Finance, _DeFi_ for short, is the term used to describe a new industry of financial services and protocols that empower people to send, receive, exchange, or distribute value without the need for centralized organizations like banks. + +DeFi empowers people to send money to anyone around the world in a cheap, fast, and auditable way. People can earn interest on DeFi investments or loans. + +#### NFTs + +Non-Fungible Tokens, _NFTs_ for short, are unique blockchain based tokens or assets. These tokens use public blockchains to prove ownership over digital items. + +NFTs are being used for many purposes. From selling unique works of art to concert tickets and access tokens for exclusive events or groups. + +## Web3 developers + +Every day, new developers are becoming interested and joining the web3 ecosystem. Each learning and building different things. With each application being built, web3 developers will need to make careful considerations in the technology and tech stack they choose. + +Some major considerations for building in web3 are **cost**, **speed**, and **programmability**. Each blockchain has it's own benefits and drawbacks for building software and [dApps](../intro/dapps.md) + +The Solana blockchain is one of the very few blockchains that meets all of these considerations. + +### Languages and frameworks + +In general, Solana web3 developers use a few languages and frameworks to develop on Solana. + +Like most modern applications, Solana web3 developers can be broadly categorized into 3 main categories: + +- [frontend](#frontend) - often with JavaScript/Typescript based frameworks like React, NextJS, and Vue +- [backend](#backend) (aka on-chain) - low level languages like Rust and C++ +- fullstack (aka both frontend and backend) + +## Backend + +[Solana programs](../intro/programs.md), sometimes referred to as _smart contracts_ on other blockchains, are the on-chain exectuable code that runs in the Solana runtime. + +The development of these [on-chain programs](../on-chain-programs/overview.md) is similar to the development of the _backend_ code for a traditional application or service. As such, on-chain programs are usually writting with the following languages/frameworks: + +- [Rust](../on-chain-programs/developing-rust.md) - most common language to write programs +- [Anchor](hhttps://anchor-lang.com/) - popular Rust based framework for Solana programs +- [C/C++](../on-chain-programs/developing-c.md) - less common languages to write programs + +## Frontend + +Similar to most modern applications, JavaScript is used on the user-facing _frontend_ of web3 applications and [dApps](../intro/dapps.md). And just like other modern web apps, web3 applications can often use many of the popular JavaScript based frameworks, like: + +- React +- NextJS +- VueJS +- and more + +> **Get started quickly:** You can use the [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) NPM package to quickly scaffold a full stack Solana application. Selecting you desired framework/language for both the frontend and backend. + +### Web3.js + +The `@solana/web3.js` library is a JavaScript package that provides a standard way to interact with the [Solana JSON RPC](#) methods. Enabling JavaScript based applications and [dApps](./dapps.md) to easily make JSON RPC calls using common JavaScript conventions like `import` and/or `require` statements. + +### Install web3.js + +The `@solana/web3.js` package is open source and can be installed via the official [NPM repository](https://www.npmjs.com/package/@solana/web3.js) (using your desired package manager like NPM, Yarn, PNPM, etc): + +```bash +npm i @solana/web3.js +``` + +### Web3.js documentation + +The full documentation for the `@solana/web3.js` package is available here: [https://solana-labs.github.io/solana-web3.js/](https://solana-labs.github.io/solana-web3.js/) + +### Web3.js tutorial + +You can find a full introduction [tutorial for web3.js](../clients/javascript-reference.md) here on the Solana documentation. + +The [Solana Cookbook](https://solanacookbook.com) also has extensive task based documentation on using the web3.js library. \ No newline at end of file From ed4f57bd6913bcd5a9251eebaf777ceb0e3a5069 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Tue, 16 Aug 2022 13:58:52 -0400 Subject: [PATCH 08/11] fix: removed dapps and web3 pages --- docs/src/developing/intro/dapps.md | 45 ------------ docs/src/developing/intro/web3.md | 112 ----------------------------- 2 files changed, 157 deletions(-) delete mode 100644 docs/src/developing/intro/dapps.md delete mode 100644 docs/src/developing/intro/web3.md diff --git a/docs/src/developing/intro/dapps.md b/docs/src/developing/intro/dapps.md deleted file mode 100644 index 15165a4e363..00000000000 --- a/docs/src/developing/intro/dapps.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: What is a dApp? -description: "Decentralized applications, aka dApps, are the user facing applications of the Solana blockchain. They are written with languages like JavaScript and Rust." -keywords: "" ---- - -Decentralized applications, "_dApps_" for short, are the user facing applications that interact with the Solana blockchain. These applications are generally a combination of frontend code (like HTML and JavaScript) as well as [Solana Programs](./programs.md) deployed on the blockchain itself. - -Since Solana Programs are "_composable_" and callable by anyone, dApp developers are not required to build and deploy their own on-chain programs. In fact, they often use a combination of custom written code for their own [on-chain programs](./programs.md#on-chain-programs), [Native programs](../runtime-facilities/programs.md), and other programs from the [Solana Program Library](https://spl.solana.com). - -## dApp Examples - -Decentralized apps are being used all across the Solana blockchain to accomplish different things. Some dApps are focused on decentralized finance (DeFi), empowering community governance through DAOs, or even encouraging people to get out and move their bodies. - -Some of the most commonly known Solana dApps include: - -- [Phantom Wallet](https://solana.com/ecosystem/phantom): Solana browser based wallet extension -- [Metaplex](https://solana.com/ecosystem/metaplex): The NFT standard on Solana -- [Squads](https://solana.com/ecosystem/squads): Collaboration and DAO tool -- [Orca](https://solana.com/ecosystem/orca): User-friendly cryptocurrency exchange built on Solana -- [StepN](https://solana.com/ecosystem/stepn): NFT game encouraging people to move their bodies -- [MagicEden](https://solana.com/ecosystem/magiceden): Poplar Solana NFT marketplace -- [Serum](https://solana.com/ecosystem/serum): High-speed, orderbook based, non-custodial DEX - -You can explore more of the [Solana community dApps](https://solana.com/ecosystem) on Solana.com - -## How to Build a dApp - -For the frontend, user facing portion of dApps, developers can use most modern JavaScript frameworks that utilize the NPM registry for dependency management. Including React, NextJS, Vue, Node, and more. - -The blockchain deployable Solana programs are commonly created with the [Rust](https://www.rust-lang.org/) programming language. But can also be created with other low level languages that can be compiled with the BPF loader like C and C++. - -Due to it's developer convenience, the [Anchor framework](https://www.anchor-lang.com/) has emerged as the leading Rust based framework to develop on chain Solana programs. Anchor provides many tools and utilities for more rapidly developing Solana programs that operate on the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192). - -## dApp Boilerplate with NPX - -The Solana developer community has created a NPM package to empower developers to rapidly scaffold the boilerplate for Solana dApps. Including wiring up the wallet adapter for the most common [Solana wallets](../../wallet-guide.md). - -To quickly scaffold a Solana dApp with this tool, run the following command: - -```sh -npx create-solana-dapp -``` - -> The [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) package is open source and available in both the NPM registry and it's [GitHub repo](https://github.com/solana-developers/create-solana-app). diff --git a/docs/src/developing/intro/web3.md b/docs/src/developing/intro/web3.md deleted file mode 100644 index 314b19f4aec..00000000000 --- a/docs/src/developing/intro/web3.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: What is Web3? -description: "" -keywords: "web3 meaning, web3.js, web3js, web3 vs web2, npm, yarn, pnpm, JavaScript, web3 explained" ---- - -Web3 is the next phase of the internet, focused on being built on top of decentralized technologies like the Solana blockchain. It is an idea that people will no longer be required to rely on large organizations to act as a trusted intermediaries to interact with one another. Instead, web3 can rely on public, secure, and auditable blockchains to act as trusted sources of information and interactions. - -Since the concept of web3 is still relatively new, many people have different specific definitions of what web3 _can_ and _should_ be. But most people agree upon a common theme: - -- people to have more privacy on the internet -- people being able to monetize their own efforts and/or content on the internet, in ways they choose - -## Web2 vs Web3 - -In the traditional web2 world, centralized organizations are at the center of the internet and the content being created online (including monetizing that content). In general, people are creating the content being consumed online, and the web2 organizations are controlling that information. Generating various amounts of profits from their user generated content. Sometimes giving small fractions of monetary rewards to their creators. But often at the expense of their user's privacy. - -In a web3 world, users would be able to create their own content online. They can choose how their personal information and content is handled by other individuals or organizations. From written articles or blog posts to custom works of art, the content creators would be able to choose their preferred distribution method. They can choose what of their personal information is attached to their online creations. - -In the end, web3 is about giving **choice** back to individuals. - -## What can be built with web3? - -People and organizations are constantly building new applications and experiences on web3 technology. - -A few examples of the types of applications, organizations, and ideas being built in web3 include: - -- [Programmable Blockchains](https://solana.com) -- [Decentralized Autonomous Organizations (DAOs)](#daos) -- [Decentralized Finance (DeFi)](#defi) -- [Non-Fungible Tokens (NFTs)](#nfts) - -Almost anything can and is being built with web3/blockchain technologies, and the possibilities are near endless. - -#### DAOs - -Decentralized Autonomous Organizations, or _DAOs_ for short, allows people from around to world to collaborate together for a common goal. They can be developing protocols and sharing source code or raising funds for charitable causes. Or even operate a social club of sorts that just aims to talk about a common topic. - -These organizations can decide internally how to govern themselves or make progress on their goals. DAOs can be structured similar to how a publicly traded company functions, with a head boss and a core team, or even operate in a "_flat structure_" where every individual's vote is worth the same. DAOs can choose to operate however they choose. - -#### DeFi - -Decentralized Finance, _DeFi_ for short, is the term used to describe a new industry of financial services and protocols that empower people to send, receive, exchange, or distribute value without the need for centralized organizations like banks. - -DeFi empowers people to send money to anyone around the world in a cheap, fast, and auditable way. People can earn interest on DeFi investments or loans. - -#### NFTs - -Non-Fungible Tokens, _NFTs_ for short, are unique blockchain based tokens or assets. These tokens use public blockchains to prove ownership over digital items. - -NFTs are being used for many purposes. From selling unique works of art to concert tickets and access tokens for exclusive events or groups. - -## Web3 developers - -Every day, new developers are becoming interested and joining the web3 ecosystem. Each learning and building different things. With each application being built, web3 developers will need to make careful considerations in the technology and tech stack they choose. - -Some major considerations for building in web3 are **cost**, **speed**, and **programmability**. Each blockchain has it's own benefits and drawbacks for building software and [dApps](../intro/dapps.md) - -The Solana blockchain is one of the very few blockchains that meets all of these considerations. - -### Languages and frameworks - -In general, Solana web3 developers use a few languages and frameworks to develop on Solana. - -Like most modern applications, Solana web3 developers can be broadly categorized into 3 main categories: - -- [frontend](#frontend) - often with JavaScript/Typescript based frameworks like React, NextJS, and Vue -- [backend](#backend) (aka on-chain) - low level languages like Rust and C++ -- fullstack (aka both frontend and backend) - -## Backend - -[Solana programs](../intro/programs.md), sometimes referred to as _smart contracts_ on other blockchains, are the on-chain exectuable code that runs in the Solana runtime. - -The development of these [on-chain programs](../on-chain-programs/overview.md) is similar to the development of the _backend_ code for a traditional application or service. As such, on-chain programs are usually writting with the following languages/frameworks: - -- [Rust](../on-chain-programs/developing-rust.md) - most common language to write programs -- [Anchor](hhttps://anchor-lang.com/) - popular Rust based framework for Solana programs -- [C/C++](../on-chain-programs/developing-c.md) - less common languages to write programs - -## Frontend - -Similar to most modern applications, JavaScript is used on the user-facing _frontend_ of web3 applications and [dApps](../intro/dapps.md). And just like other modern web apps, web3 applications can often use many of the popular JavaScript based frameworks, like: - -- React -- NextJS -- VueJS -- and more - -> **Get started quickly:** You can use the [create-solana-dapp](https://www.npmjs.com/package/create-solana-dapp) NPM package to quickly scaffold a full stack Solana application. Selecting you desired framework/language for both the frontend and backend. - -### Web3.js - -The `@solana/web3.js` library is a JavaScript package that provides a standard way to interact with the [Solana JSON RPC](#) methods. Enabling JavaScript based applications and [dApps](./dapps.md) to easily make JSON RPC calls using common JavaScript conventions like `import` and/or `require` statements. - -### Install web3.js - -The `@solana/web3.js` package is open source and can be installed via the official [NPM repository](https://www.npmjs.com/package/@solana/web3.js) (using your desired package manager like NPM, Yarn, PNPM, etc): - -```bash -npm i @solana/web3.js -``` - -### Web3.js documentation - -The full documentation for the `@solana/web3.js` package is available here: [https://solana-labs.github.io/solana-web3.js/](https://solana-labs.github.io/solana-web3.js/) - -### Web3.js tutorial - -You can find a full introduction [tutorial for web3.js](../clients/javascript-reference.md) here on the Solana documentation. - -The [Solana Cookbook](https://solanacookbook.com) also has extensive task based documentation on using the web3.js library. \ No newline at end of file From 59b2fca90c5b37c46d7c95ba43684478baf92718 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Tue, 16 Aug 2022 13:59:06 -0400 Subject: [PATCH 09/11] feat: added links to the developing sidebar --- docs/sidebars.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/sidebars.js b/docs/sidebars.js index 190db55d9cd..cc3ef6a74fc 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -81,6 +81,11 @@ module.exports = { id: "developing/programming-model/overview", label: "Overview", }, + { + type: "category", + label: "Getting Started", + items: ["developing/intro/programs", "developing/intro/rent"], + }, { type: "category", label: "Core Concepts", From 01c1cde23090e0ff14e386e447e5be29e16bcaa9 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Thu, 25 Aug 2022 18:14:31 -0400 Subject: [PATCH 10/11] fix: updated text based on comments --- docs/src/developing/intro/programs.md | 19 ++++++++-------- docs/src/developing/intro/rent.md | 32 +++++---------------------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/docs/src/developing/intro/programs.md b/docs/src/developing/intro/programs.md index 4fcf58013c1..e66902c9ebd 100644 --- a/docs/src/developing/intro/programs.md +++ b/docs/src/developing/intro/programs.md @@ -1,20 +1,20 @@ --- title: What are Solana Programs? -description: "A Solana Program, aka smart contract, is the executable code that interprets the instructions on the blockchain. There are two types: Native and On-Chain." +description: "A Solana Program, aka smart contract, is the executable code that interprets the instructions on the blockchain. There are two types: Native and on chain." keywords: "" --- -Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. +Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's _parallel processing_ model that helps to enable the high transactions speeds of the blockchain. ## Key points -- Programs are essentially a special type of [Account](../programming-model/accounts.md) that is marked as "_executable_" +- Programs are essentially special type of [Accounts](../programming-model/accounts.md) that is marked as "_executable_" - Programs can own other Accounts - Programs can only _change the data_ or _debit_ accounts they own - Any program can _read_ or _credit_ another account -- Programs are considered stateless since the primary data stored in a program account is the its compiled BPF code +- Programs are considered stateless since the primary data stored in a program account is the compiled BPF code - Programs can be upgraded by their owner (see more on that below) ## Types of programs @@ -26,18 +26,17 @@ The Solana blockchain has two types of programs: ### On chain programs -These user programmable programs, often referred to as "_smart contracts_" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! +These user written programs, often referred to as "_smart contracts_" on other blockchains, are deployed directly to the blockchain for anyone to interact with and execute. Hence the name "on chain"! In effect, "on chain programs" are any program that is not baked directly into the Solana cluster's core code (like the native programs discussed below). -All these programs are collectively known as the [Solana Program Library](https://spl.solana.com/). And even though the Solana foundation and it's core engineers maintain a few of the on chain programs, any one can create or publish one. On chain programs can also be updated directly on the blockchain by the respective program's Account owner. +And even though Solana Labs maintains a small subset of these on chain programs (collectively known as the [Solana Program Library](https://spl.solana.com/)), anyone can create or publish one. On chain programs can also be updated directly on the blockchain by the respective program's Account owner. ### Native programs -Native programs are a special handful of programs that are built directly into the core of the Solana blockchain. -They are essential in the operation of validator nodes and clusters. These special programs +_Native programs_ are programs that are built directly into the core of the Solana blockchain. -Similar to other "on-chain" programs in Solana, native programs can be called by any other program/user. However, they can only be upgraded as part of the core blockchain and cluster updates. These native program upgrades are controlled via the releases to the [different clusters](../../cluster/overview.md). +Similar to other "on chain" programs in Solana, native programs can be called by any other program/user. However, they can only be upgraded as part of the core blockchain and cluster updates. These native program upgrades are controlled via the releases to the [different clusters](../../cluster/overview.md). #### Examples of native programs include: @@ -55,4 +54,4 @@ Unlike other blockchains, Solana programs can be upgraded after they are deploye Native programs can only be upgraded as part of cluster updates when new software releases are made. -On chain programs (aka "SPL programs") can be upgraded by the account that is marked as the "_owner_", which is usually the Solana account/address that deployed the program to begin with. +On chain programs can be upgraded by the account that is marked as the "_Upgrade Authority_", which is usually the Solana account/address that deployed the program to begin with. diff --git a/docs/src/developing/intro/rent.md b/docs/src/developing/intro/rent.md index b1fcc01f8b5..d26f93849c1 100644 --- a/docs/src/developing/intro/rent.md +++ b/docs/src/developing/intro/rent.md @@ -4,12 +4,9 @@ description: "Rent: the small fee Solana accounts incur to store data on the blo keywords: "" --- -The small fee every Solana Account (or Program) to store data on the blockchain is called "*rent*". This *time and space* based fee is required to keep an account, and its therefore its data, alive on the blockchain since [clusters](../../cluster/overview.md) must actively maintain this data. +The fee every Solana Account to store data on the blockchain is called "_rent_". This _time and space_ based fee is required to keep an account, and its therefore its data, alive on the blockchain since [clusters](../../cluster/overview.md) must actively maintain this data. -Rent can be "*collected*" in two primary ways: - -- when certain [specified conditions](#collecting-rent) occur that interact with the specific data in an account -- or, not collected at all when an account is [rent exempt](#rent-exempt) +All Solana Accounts (and therefore Programs) are required to maintain a high enough LAMPORT balance to become [rent exempt](#rent-exempt) and remain on the Solana blockchain. When an Account no longer has enough LAMPORTS to pay its rent, it will be removed from the network in a process known as [Garbage Collection](#garbage-collection). @@ -17,38 +14,21 @@ When an Account no longer has enough LAMPORTS to pay its rent, it will be remove ### Rent rate -The Solana rent rate is set on a network wide basis, primarily based on the set LAMPORTS *per* byte *per* year. +The Solana rent rate is set on a network wide basis, primarily based on the set LAMPORTS _per_ byte _per_ year. Currently, the rent rate is a static amount and stored in the the [Rent sysvar](../runtime-facilities/sysvars.md#rent). ## Rent exempt -Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "*rent exempt*" and will not incur a rent collection. +Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "_rent exempt_" and will not incur a rent collection. > At the time of writing this, new Accounts and Programs **are required** to be initialized with enough LAMPORTS to become rent-exempt. The RPC endpoints have the ability to calculate this [estimated rent exempt balance](../clients/jsonrpc-api.md#getminimumbalanceforrentexemption) and is recommended to be used. Every time an account's balance is reduced, a check is performed to see if the account is still rent exempt. Transactions that would cause an account's balance to drop below the rent exempt threshold will fail. -## Collecting rent - -Accounts that are not rent exempt will have to pay their rent in the two following cases: - -1. when referenced by a transaction, and -2. at least once an [epoch](../../terminology.md#epoch) - -### Referenced by a transaction - -This type of rent collection included the transaction that initially creates the account, as well as during the normal transaction processing by the bank. - -### Once an epoch - -At least once an epoch, rent is collected from Solana Accounts that are not rent exempt. This is to ensure that even stale accounts (aka accounts that were not referenced during the recent epoch) have rent collected. - -This type of rent collection requires a scan of the all accounts and is spread over the entire epoch. This is to help avoid load spikes on the network. - ## Garbage collection -Accounts that do not maintain their rent exempt status, or have a balance high enough to pay rent, are removed from the network in a process known as *garbage collection*. This process is done to help reduce the network wide storage of no longer used/maintained data. +Accounts that do not maintain their rent exempt status, or have a balance high enough to pay rent, are removed from the network in a process known as _garbage collection_. This process is done to help reduce the network wide storage of no longer used/maintained data. You can learn more about [garbage collection here](../../implemented-proposals/persistent-account-storage.md#garbage-collection) in this implemented proposal. @@ -57,4 +37,4 @@ You can learn more about [garbage collection here](../../implemented-proposals/p You can learn more about Solana Rent with the following articles and documentation: - [Implemented Proposals - Rent](../../implemented-proposals/rent.md) -- [Implemented Proposals - Account Storage](../../implemented-proposals/persistent-account-storage.md) \ No newline at end of file +- [Implemented Proposals - Account Storage](../../implemented-proposals/persistent-account-storage.md) From 6a7528cb4f8d5bbeb01956d3d420430b8a158b2c Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Thu, 25 Aug 2022 18:16:57 -0400 Subject: [PATCH 11/11] fix: fixed link --- docs/src/developing/intro/programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/developing/intro/programs.md b/docs/src/developing/intro/programs.md index e66902c9ebd..7c0eb737f41 100644 --- a/docs/src/developing/intro/programs.md +++ b/docs/src/developing/intro/programs.md @@ -4,7 +4,7 @@ description: "A Solana Program, aka smart contract, is the executable code that keywords: "" --- -Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. +Solana Programs, often referred to as "_smart contracts_" on other blockchains, are the executable code that interprets the instructions sent inside of each transaction on the blockchain. They can be deployed directly into the core of the network as [Native Programs](#native-programs), or published by anyone as [On Chain Programs](#on-chain-programs). Programs are the core building blocks of the network and handle everything from sending tokens between wallets, to accepting votes of a DAOs, to tracking ownership of NFTs. Both types of programs run on top of the [Sealevel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192), which is Solana's _parallel processing_ model that helps to enable the high transactions speeds of the blockchain.