NEAR官方文档翻译(六)基础(Basics)- 索引Indexer、网络

本文介绍了NEAR索引器的作用,它如何实现实时数据监听、聚合和查询,以及NEAR协议在mainnet、testnet、betanet和localnet的不同网络环境中的应用。重点突出了'广泛查询'在找回账户和种子短语中的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

索引Indexer

NEAR Indexer is a library included with nearcore that allows you to run a node on the network which listens for targeted information on the blockchain. The NEAR Indexer Framework provides the logic of polling a node for blocks produced in a network then aggregating and streaming these blocks to a listener.

NEAR 索引器是一个库包括与近核心,允许您运行一个节点的网络上监听有针对性的信息的区块链。NEAR 索引器框架提供了对网络中生成的块轮询节点的逻辑,然后将这些块聚合并传输到侦听器

为了更好地理解这一点,区块链数据被优化为序列化写,一次一个块,因为链正在被创建。查询块环链的数据关于一个特定的块或帐户是一个相当直接或“狭义”的查询。然而,跨多个块查询数据可能很麻烦,因为我们必须聚合来自多个单块查询的结果。 我们可以考虑这些“广泛”的查询。

An indexer listens to the stream of data as it’s being written on chain and can then be immediately filtered and processed to detect interesting events or patterns.

索引器在数据被写入链时监听数据流,然后可以立即进行过滤和处理,以检测有趣的事件或模式。

This stream of data can then be written to a permanent database for later data analysis using a convenient query language like SQL.

然后可以将这些数据流写入一个永久性数据库,以便以后使用像 SQL 这样方便的查询语言进行数据分析。

One example that highlights the need for a “wide query” is when you use a seed phrase to recover one or more accounts. Since a seed phrase essentially represents a signing key pair, the recovery is for all accounts that share the associated public key. Therefore, when a seed phrase is used to recover an account via NEAR Wallet, the query requires that all accounts with a matching public key are found and recovered.

强调需要“广泛查询”的一个示例是,当您使用种子短语来恢复一个或多个帐户时。由于种子短语实际上表示签名密钥对,因此恢复用于共享相关公钥的所有帐户。因此,当使用种子短语通过 NEAR Wallet 恢复帐户时,查询要求找到并恢复所有具有匹配公钥的帐户。

The easiest way to achieve a “wide query” is to utilize a database that has been filled by an indexing service. For this purpose we’ve built the NEAR Indexer for wallet which listens to all actions on chain that might create or delete access keys and stores them into a relational database for easier querying of accounts.

实现“广泛查询”的最简单方法是利用一个已经被 Windows索引服务填充的数据库。为此,我们已经为钱包构建了 NEAR 索引器,它可以监听链上所有可能创建或删除访问键的操作,并将它们存储到一个关系数据库文件夹中,以便于查询账户。

网络

NEAR 协议在几个网络上运行,每个网络都有自己的独立验证器和独立状态。这些网络如下:

  • mainnet
  • testnet
  • betanet
  • localnet

mainnet

主网络是为生产准备的智能合约和实时令牌转移。为 mainnet 准备的合约应该经过严格的测试和必要的独立安全审查。Mainnet 是唯一一个保证状态可以随时间持续的网络(受制于典型的网络验证过程的安全保证)。

Note: near-cli network selection flag is production.

testnet

Testnet 用于在部署主网之前测试 NEAR 平台的所有方面。从帐户创建、模拟令牌转移、开发工具和智能契约开发来看,测试网环境应该紧密地代表主网行为。我们尽一切努力在更新之间维护网络状态的完整性,但是这仍然是一个易变的网络,需要接受大量的测试。因此,我们建议将所有面向用户的应用程序部署到 mainnet,以确保持久状态。

Note: near-cli network selection flag is development or testnet. (This network is selected by default with near-cli and may not need additional configuration)

betanet

Betanet 通常有每日发布的协议功能,尚未稳定。国家得到了尽可能多的维护,但由于其高度的不稳定性,没有任何保证。

near-cli network selection variable is betanet

localnet

LocalNet 是为那些希望使用与公共块链无关的 NEAR 平台的开发人员而设计的。您需要自己生成节点。

near-cli network selection variable is local

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值