-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hahadaxia/main
update rent.md wallets.md
- Loading branch information
Showing
8 changed files
with
187 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,4 +80,4 @@ export default defineConfig({ | |
"/CLI/": { base: "/CLI/", items: sidebarCLI() }, | ||
}, | ||
}, | ||
}); | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# Solana 账户模型 | ||
On Solana, all data is stored in what are referred to as "accounts”. The way data is organized on Solana resembles a key-value store, where each entry in the database is called an "account". | ||
在 Solana 上,所有数据都存储在所谓的“帐户”中。Solana 上的数据组织方式类似于键值存储,其中数据库中的每个条目都称为“帐户”。 | ||
|
||
Accounts | ||
Accounts 帐户 | ||
|
||
Key Points # 要点# | ||
Accounts can store up to 10MB of data, which can consist of either executable program code or program state. | ||
帐户最多可以存储 10MB 的数据,这些数据可以由可执行程序代码或程序状态组成。 | ||
|
||
Accounts require a rent deposit in SOL, proportional to the amount of data stored, which is fully refundable when the account is closed. | ||
帐户需要以 SOL 为单位的租金押金,与存储的数据量成正比,该押金在帐户关闭时可全额退还。 | ||
|
||
Every account has a program "owner". Only the program that owns an account can modify it data or deduct its lamport balance. However, anyone can increase the balance. | ||
每个帐户都有一个程序“所有者”。只有拥有帐户的程序才能修改其数据或扣除其 lamport 余额。但是,任何人都可以增加余额。 | ||
|
||
Programs (smart contracts) are stateless accounts that store executable code. | ||
程序(智能合约)是存储可执行代码的无状态帐户。 | ||
|
||
Data accounts are created by programs to store and manage program state. | ||
数据帐户由程序创建,用于存储和管理程序状态。 | ||
|
||
Native programs are built-in programs included with the Solana runtime. | ||
本机程序是 Solana 运行时附带的内置程序。 | ||
|
||
Sysvar accounts are special accounts that store network cluster state. | ||
Sysvar 帐户是存储网络群集状态的特殊帐户。 | ||
|
||
Account # 帐户# | ||
Each account is identifiable by its unique address, represented as 32 bytes in the format of an Ed25519 PublicKey. You can think of the address as the unique identifier for the account. | ||
每个帐户都可以通过其唯一地址进行识别,以 Ed25519 的格式表示为 32 个字节 PublicKey 。您可以将地址视为帐户的唯一标识符。 | ||
|
||
Account Address | ||
Account Address 账户地址 | ||
|
||
This relationship between the account and its address can be thought of as a key-value pair, where the address serves as the key to locate the corresponding on-chain data of the account. | ||
账户与其地址之间的这种关系可以看作是键值对,其中地址作为定位账户相应链上数据的密钥。 | ||
|
||
AccountInfo # 账户信息# | ||
Accounts have a max size of 10MB (10 Mega Bytes) and the data stored on every account on Solana has the following structure known as the AccountInfo. | ||
帐户的最大大小为 10MB(10 兆字节),存储在 Solana 上每个帐户上的数据具有以下结构,称为 AccountInfo。 | ||
|
||
AccountInfo | ||
AccountInfo 账户信息 | ||
|
||
The AccountInfo for each account includes the following fields: | ||
AccountInfo 对于每个帐户都包含以下字段: | ||
|
||
data: A byte array that stores the state of an account. If the account is a program (smart contract), this stores executable program code. This field is often referred to as the "account data". | ||
data :存储帐户状态的字节数组。如果帐户是一个程序(智能合约),则存储可执行程序代码。此字段通常称为“帐户数据”。 | ||
executable: A boolean flag that indicates if the account is a program. | ||
executable :指示帐户是否为程序的布尔标志。 | ||
lamports: A numeric representation of the account's balance in lamports, the smallest unit of SOL (1 SOL = 1 billion lamports). | ||
lamports :账户余额的数字表示,单位为 lamports,即 SOL 的最小单位(1 SOL = 10 亿 lamports)。 | ||
owner: Specifies the public key (program ID) of the program that owns the account. | ||
owner :指定拥有该帐户的程序的公钥(程序 ID)。 | ||
As a key part of the Solana Account Model, every account on Solana has a designated "owner", specifically a program. Only the program designated as the owner of an account can modify the data stored on the account or deduct the lamport balance. It's important to note that while only the owner may deduct the balance, anyone can increase the balance. | ||
作为 Solana 账户模型的关键部分,Solana 上的每个账户都有一个指定的“所有者”,特别是一个程序。只有被指定为账户所有者的程序才能修改账户上存储的数据或扣除lamport余额。需要注意的是,虽然只有所有者可以扣除余额,但任何人都可以增加余额。 | ||
|
||
INFO 信息 | ||
To store data on-chain, a certain amount of SOL must be transferred to an account. The amount transferred is proportional to the size of the data stored on the account. This concept is commonly referred to as “rent”. However, you can think of "rent" more like a "deposit" because the SOL allocated to an account can be fully recovered when the account is closed. | ||
要在链上存储数据,必须将一定数量的 SOL 转移到一个账户。转移的金额与帐户中存储的数据大小成正比。这个概念通常被称为“租金”。但是,您可以将“租金”视为“押金”,因为当帐户关闭时,分配给帐户的 SOL 可以完全恢复。 | ||
|
||
Native Programs # 本机程序# | ||
Solana contains a small handful of native programs that are part of the validator implementation and provide various core functionalities for the network. You can find the full list of native programs here. | ||
Solana 包含少量原生程序,这些程序是验证器实现的一部分,并为网络提供各种核心功能。您可以在此处找到本机程序的完整列表。 | ||
|
||
When developing custom programs on Solana, you will commonly interact with two native programs, the System Program and the BPF Loader. | ||
在 Solana 上开发自定义程序时,您通常会与两个本机程序进行交互,即系统程序和 BPF 加载程序。 | ||
|
||
System Program # 系统程序# | ||
By default, all new accounts are owned by the System Program. The System Program performs several key tasks such as: | ||
默认情况下,所有新帐户都归系统程序所有。系统程序执行几个关键任务,例如: | ||
|
||
New Account Creation: Only the System Program can create new accounts. | ||
创建新帐户:只有系统程序可以创建新帐户。 | ||
Space Allocation: Sets the byte capacity for the data field of each account. | ||
空间分配:设置每个账户的数据字段的字节容量。 | ||
Assign Program Ownership: 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. | ||
分配程序所有权:系统程序创建帐户后,可以将指定的程序所有者重新分配给其他程序帐户。这就是自定义程序获取系统程序创建的新帐户的所有权的方式。 | ||
On Solana, a "wallet" is simply an account owned by the System Program. The lamport balance of the wallet is the amount of SOL owned by the account. | ||
在 Solana 上,“钱包”只是系统程序拥有的帐户。钱包的 lamport 余额是账户拥有的 SOL 金额。 | ||
|
||
System Account | ||
System Account 系统帐户 | ||
|
||
INFO 信息 | ||
Only accounts owned by the System Program can be used as transaction fee payers. | ||
只有系统程序拥有的帐户才能用作交易费用支付者。 | ||
|
||
BPFLoader Program # BPFLoader程序# | ||
The BPF Loader is the program designated as the "owner" of all other programs on the network, excluding Native Programs. It is responsible for deploying, upgrading, and executing custom programs. | ||
BPF 加载程序是被指定为网络上所有其他程序(不包括本机程序)的“所有者”的程序。它负责部署、升级和执行自定义程序。 | ||
|
||
Sysvar Accounts # Sysvar 账户# | ||
Sysvar accounts are special accounts located at predefined addresses that provide access to cluster state data. These accounts are dynamically updated with data about the network cluster. You can find the full list of Sysvar Accounts here. | ||
Sysvar 帐户是位于预定义地址的特殊帐户,用于提供对集群状态数据的访问。这些帐户会使用有关网络群集的数据动态更新。您可以在此处找到 Sysvar 帐户的完整列表。 | ||
|
||
Custom Programs # 自定义程序# | ||
On Solana, “smart contracts” are referred to as programs. A program is an account that contains executable code and is indicated by an “executable” flag that is set to true. | ||
在 Solana 上,“智能合约”被称为程序。程序是包含可执行代码的帐户,并由设置为 true 的“可执行”标志指示。 | ||
|
||
For a more detailed explanation of the program deployment process, refer to the Deploying Programs page of this documentation. | ||
有关程序部署过程的更详细说明,请参阅本文档的“部署程序”页。 | ||
|
||
Program Account # 计划帐户# | ||
When new programs are deployed on Solana, technically three separate accounts are created: | ||
在 Solana 上部署新程序时,从技术上讲会创建三个单独的帐户: | ||
|
||
Program Account: The main account representing an on-chain program. This account stores the address of an executable data account (which stores the compiled program code) and the update authority for the program (address authorized to make changes to the program). | ||
程序账户:代表链上程序的主账户。此帐户存储可执行数据帐户的地址(用于存储已编译的程序代码)和程序的更新权限(有权对程序进行更改的地址)。 | ||
Program Executable Data Account: An account that contains the executable byte code of the program. | ||
程序可执行数据帐户:包含程序的可执行字节码的帐户。 | ||
Buffer Account: A temporary account that stores byte code while a program is being actively deployed or upgraded. Once the process is complete, the data is transferred to the Program Executable Data Account and the buffer account is closed. | ||
缓冲区帐户:在主动部署或升级程序时存储字节码的临时帐户。该过程完成后,数据将传输到程序可执行数据帐户,并关闭缓冲区帐户。 | ||
For example, here are links to the Solana Explorer for the Token Extensions Program Account and its corresponding Program Executable Data Account. | ||
例如,以下是指向令牌扩展程序帐户及其对应程序可执行数据帐户的 Solana Explorer 的链接。 | ||
|
||
Program and Executable Data Accounts | ||
Program and Executable Data Accounts | ||
程序和可执行数据帐户 | ||
|
||
For simplicity, you can think of the "Program Account" as the program itself. | ||
为简单起见,您可以将“程序帐户”视为程序本身。 | ||
|
||
Program Account | ||
Program Account 计划帐户 | ||
|
||
INFO 信息 | ||
The address of the "Program Account" is commonly referred to as the “Program ID”, which is used to invoke the program. | ||
“程序帐户”的地址通常称为“程序 ID”,用于调用程序。 | ||
|
||
Data Account # 数据帐户# | ||
Solana programs are "stateless", meaning that program accounts only contain the program's executable byte code. To store and modify additional data, new accounts must be created. These accounts are commonly referred to as “data accounts”. | ||
Solana 程序是“无状态的”,这意味着程序帐户仅包含程序的可执行字节码。若要存储和修改其他数据,必须创建新帐户。这些帐户通常称为“数据帐户”。 | ||
|
||
Data accounts can store any arbitrary data as defined in the owner program's code. | ||
数据帐户可以存储所有者程序代码中定义的任何任意数据。 | ||
|
||
Data Account | ||
Data Account 数据帐户 | ||
|
||
Note that only the System Program can create new accounts. Once the System Program creates an account, it can then transfer ownership of the new account to another program. | ||
请注意,只有系统程序可以创建新帐户。一旦系统程序创建了一个帐户,它就可以将新帐户的所有权转移到另一个程序。 | ||
|
||
In other words, creating a data account for a custom program requires two steps: | ||
换句话说,为自定义程序创建数据帐户需要两个步骤: | ||
|
||
Invoke the System Program to create an account, which then transfers ownership to a custom program | ||
调用系统程序创建一个帐户,然后将所有权转移给自定义程序 | ||
Invoke the custom program, which now owns the account, to then initialize the account data as defined in the program code | ||
调用现在拥有该帐户的自定义程序,然后初始化程序代码中定义的帐户数据 | ||
This data account creation process is often abstracted as a single step, but it's helpful to understand the underlying process. | ||
此数据帐户创建过程通常抽象为单个步骤,但了解基础过程很有帮助。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
# 存储租金经济 | ||
提交给Solana账本的每笔交易都会产生费用。交易费用由交易发起者支付,并由验证者来收取,理论上费用包含紧急的、交易的验证成本以及将该数据记录到账本。 | ||
提交给Solana账本的每笔交易都会产生费用。交易费用由交易发起者支付,并由验证者来收取,理论上费用包含紧急程度、交易的验证成本以及将该数据记录到账本。 | ||
在此过程中没有考虑的是活动账本状态的中期存储,它必须由轮换验证器集维护。随着活动状态的增长,这种类型的存储不仅会给验证器带来费用,还会给更广泛的网络带来费用,数据传输和验证开销也会增加。为了考虑到这些费用,我们在此描述我们对存储租金的初步设计和实施。 | ||
|
||
存储租金可以通过以下两种方式之一来支付: | ||
方法1:设置后不管 | ||
通过这种方法,拥有两年租金押金的账户可以免收网络租金费用。通过保持这种最低余额,更广泛的网络将从减少的流动性中受益,账户持有人可以放心,他们将 Account::data 被保留以继续访问/使用。 | ||
方法2:按字节付费 | ||
|
||
方法一:设置后不管 | ||
|
||
通过这种方法,拥有两年租金押金的账户可以免收网络租金费用。通过保持这种最低余额,更广泛的网络将从减少的流动性中受益,账户持有人可以放心,他们将 `Account::data` 被保留以继续访问/使用。 | ||
|
||
方法二:按字节付费 | ||
|
||
如果一个账户的存入租金少于两年,则网络将按每个周期收取租金,以记入下一个周期的信用额度。这笔租金是按照规定的比率扣除的,单位是每千字节年。 | ||
有关此设计的技术实现详细信息的信息,请参阅[“租用”](https://docs.solanalabs.com/implemented-proposals/rent)部分。 | ||
注意:新创建的账户必须预充值足够数量的 lamports,以达到租金豁免标准。Lamports是SOL的最小单位,本次更新规定所有新账户创建时都需要预存一定量的lamports,使其满足租金豁免条件。这样可以避免小额账户长期占用网络资源却无需支付租金的情况。任何交易,如果会导致账户余额低于租金豁免最低值(且该余额并非零),都将失败。现有账户的租金支付规则保持不变,但任何会使账户余额低于租金豁免最低值的交易都将被拒绝。简而言之,此更新基本实现了所有账户的租金豁免。之前创建的需要支付租金的账户,会继续按照原有规则支付租金,直到满足以下两个条件之一:(1)账户余额归零。(2)交易使账户余额增加,达到租金豁免标准。 | ||
有关此设计的技术实现详细信息的信息,请参阅[租用部分](https://docs.solanalabs.com/implemented-proposals/rent)。 | ||
|
||
**注意**:新创建的账户必须预充值足够数量的 lamports,以达到租金豁免标准。Lamports是SOL的最小单位,本次更新规定所有新账户创建时都需要预存一定量的lamports,使其满足租金豁免条件。这样可以避免小额账户长期占用网络资源却无需支付租金的情况。任何交易,如果会导致账户余额低于租金豁免最低值(且该余额并非零),都将失败。现有账户的租金支付规则保持不变,但任何会使账户余额低于租金豁免最低值的交易都将被拒绝。简而言之,此更新基本实现了所有账户的租金豁免。之前创建的需要支付租金的账户,会继续按照原有规则支付租金,直到满足以下两个条件之一:(1)账户余额归零。(2)交易使账户余额增加,达到租金豁免标准。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# Solana钱包指南 | ||
本文档描述了Solana用户可以使用的不同钱包选项,这些用户希望能够在Solana区块链上发送、接收SOL代币并与之交互。 | ||
|
||
## 什么是钱包?# | ||
## 什么是钱包? | ||
加密货币钱包是一种用于存储密钥集合的设备或应用程序,可用来发送、接收和跟踪加密货币的所有权。 钱包可以有多种形式。它可以是您计算机文件系统中的目录或文件、一张纸或称为硬件钱包的专用设备。还有各种智能手机应用程序和计算机程序,可以提供用户友好的方式来创建和管理钱包。 | ||
|
||
## 密钥对 | ||
### 密钥对 | ||
密钥对是安全生成的密钥及其加密派生的公钥。密钥及其对应的公钥统称为密钥对。钱包包含一个或多个密钥对的集合,并提供一些与它们交互的方法。 | ||
|
||
## 公钥 | ||
### 公钥 | ||
公钥(通常缩写为pubkey)被称为钱包的接收地址或简称为它的地址。钱包地址可以自由共享和显示。当另一方要向钱包发送一定数量的加密货币时,他们需要知道钱包的接收地址。根据区块链的实现,该地址还可用于查看有关钱包的某些信息,例如查看余额,但无法更改有关钱包的任何内容或提取任何代币。 | ||
|
||
## 密钥 | ||
### 密钥 | ||
密钥(也称为私钥)用于对任何交易进行数字签名,以将加密货币发送到另一个地址或对钱包进行任何更改。绝不能共享密钥。如果有人获得了钱包的密钥,他们可以提取钱包包含的所有代币。如果钱包的密钥丢失,则发送到该钱包地址的任何令牌都将永久丢失。 | ||
|
||
# 安全 | ||
## 安全 | ||
不同的钱包解决方案提供不同的密钥对安全方法,与密钥对交互,并签署交易以使用/花费代币。有些钱包比其他的更容易使用。有些可以更安全地存储和备份密钥。Solana支持多种类型的钱包,因此您可以在安全性和便利性之间选择适当的平衡。 | ||
如果您希望能够在Solana区块链上接收SOL代币,您首先需要创建一个钱包。 | ||
|
||
# 支持的钱包 | ||
## 支持的钱包 | ||
一些基于浏览器和移动应用程序的钱包支持Solana。在[Solana生态系统](https://solana.com/ecosystem/explore?categories=wallet)页面上找到一些可能适合您的选项。 | ||
对于高级用户或开发人员来说,[命令行钱包](https://docs.solanalabs.com/cli/wallets)可能更合适,因为在集成到第三方解决方案之前,Solana 区块链上的新功能将始终首先在命令行上得到支持。 |
Oops, something went wrong.