EN ▼
Favorites
My Favorites
View All
Market Cap Price 24h%

Disclaimer: Content does not constitute investment advice. Trading involves risks—please invest with caution!

互联网计算机应用从网络获取随机数,而非依赖预言机

2026-10-15 04:27:15
Bookmark

游戏与彩票需要无人能猜的数字

在许多区块链平台上,开发者通常通过预言机(Oracle)购买随机性服务,而 Chainlink 的 VRF(可验证随机函数)便是其中的热门选择。然而,由 Dfinity 构建的 Internet Computer(ICP)则提供了不同的路径:其应用程序可以直接从网络本身获取随机值。

基于预言机的随机性工作原理

根据 Chainlink 的文档说明,智能合约无法原生生成真正的随机数,因此必须向预言机请求随机性。预言机会生成一个数字及其密码学证明,随后将结果返回给发起请求的智能合约。Chainlink 强调,在消费型应用程序使用结果之前,该证明必须在链上发布并经过验证。

Internet Computer 的内置处理方式

Internet Computer 采取了截然不同的技术路线。根据其开发者文档,Canister(即该网络的智能合约)可以直接从 Canister 代码中生成符合密码学安全标准的随机数。该功能通过管理 Canister 提供的 raw_rand 方法实现。

该网络采用了一种阈值可验证随机函数(Threshold Verifiable Random Function)。文档指出,结果是子网节点利用随机信标(Random Beacon)协同产生的,没有任何单个节点能够预测或操纵这一过程。每个节点都会独立验证输出结果,确保所有副本接收到的都是相同的 32 字节数据。

时间因素是保持数值不可预测的关键。文档解释称,当请求提交时,随机数尚属未知状态;ICP 会在下一个执行轮次中解决该调用,这使得预先预测数值成为不可能。每一轮新的执行都会带来全新的数值:VRF 在每个执行轮次中生成 256 位的随机数据块。

当然,这也存在实际限制。只有 Canister 可以调用 raw_rand,外部客户端无法通过入口消息(Ingress Messages)直接调用。此外,查询调用(Query Calls)中不提供随机性,因为查询仅在单个副本上运行,无法访问子网级别的随机信标。

对开发者的意义

对于构建游戏、彩票及其他对公平性敏感的应用程序的开发者而言,这种差异主要体现在架构层面。开发者无需支付外部预言机费用并等待回调,而是让 Canister 向管理 Canister 请求随机性,并从子网自身的共识层接收结果。由于应用程序可以在用户看到数值之前获知结果,因此在构建彩票类应用时,开发者应在开奖前固定规则,以防止结果被恶意利用。

这两种设计方案旨在实现相同的目标:确保结果不受单一方操控,且任何人都可进行验证。Chainlink VRF 依靠预言机网络和链上证明来实现这一目标,而 Internet Computer 则通过其子网节点和链密钥密码学(Chain-key Cryptography)来达成。

Disclaimer:

All content published on this website, including hyperlinks, related applications, forums, blogs, and other media accounts, originates from third-party platforms and their users. CoinMarketInsight makes no representations or warranties of any kind regarding the website or its content. All blockchain-related data and materials are provided for informational and research purposes only and do not constitute financial, legal, or investment advice. Users and third parties are solely responsible for the content they publish. CoinMarketInsight shall not be liable for any losses arising from the use of this website. You should exercise caution and conduct your own independent research, review, analysis, and verification before making any decisions.

Read Full Article
More News
TOP

TOP