问题标签 [polkadot]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
102 浏览

rust-cargo - 建立承印物油墨合同

我尝试按照https://substrate.dev/substrate-contracts-workshop/#/0/setup中描述的教程创建一个底层智能合约。我已经在 Windows 10 操作系统上安装了所有依赖项。但是,该过程在完成 3 个步骤([3/5] 优化 wasm 文件)后失败,并显示以下错误消息。

“错误:访问被拒绝。(操作系统错误 5)”

请帮助我解决此错误。

谢谢

0 投票
0 回答
44 浏览

substrate - 对 IterableStorageMap 进行排序

IterableStorageMap 不支持排序。如何按升序或降序对 IterableStorageMap 的值进行排序?

https://substrate.dev/rustdocs/v2.0.0/frame_support/storage/trait.IterableStorageMap.html

0 投票
3 回答
442 浏览

substrate - 构建错误时出错 [E0282]:需要类型注释

我正在使用 Ubuntu 20.04,它对
WASM_BUILD_TOOLCHAIN=nightly-2020-08-23 cargo build --release

WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release给出相同的错误

https://github.com/substrate-developer-hub/substrate-node-template/blob/4d97032c11b8c65936e53a61607d4522d45a29ea/Makefile

https://stackoverflow.com/a/63993797/1566713

0 投票
1 回答
69 浏览

substrate - 将单位从 ALICE 转移到 BOB 询问密码

我正在尝试将一些单位从 ALICE 转移到本地网络上的 BOB,但找不到 ALICE 或文档中任何预配置帐户的密码,还尝试使用空密码并收到错误,如附图所示。 在此处输入图像描述 我正在使用https://github.com/vue-polkadot/apps 请您通过提供预配置帐户的配对密码来提供帮助。

0 投票
0 回答
66 浏览

substrate - 使用预言机可以进行去中心化多链交换吗?

有了substrate,我们可以搭建自己的区块链,但是不同的区块链之间是不能通信的,所以polkadot使用的是中继链。但是中继链可以附加多少平行链是有限制的。
https://wiki.polkadot.network/docs/en/learn-auction
平行链插槽是稀缺资源,通过拍卖分配,这为没有资金和大量资源的小型开发人员设置了进入壁垒。
目前像 Uniswap 这样的去中心化交易所,不能在其原生区块链之外进行交易。一些交易所正在尝试使用桥接器与另一个区块链对话。
建立在底层上的区块链是不同的,因为它们都共享相同的协议。去中心化交易所可以在没有平行链插槽的情况下获取任何底层区块链令牌吗?如果是,那么构建它的方法是什么,比如使用预言机?会有哪些安全问题?

好吧,较低市值的区块链似乎也不够安全。因此,不包含在平行链中的单个区块链是不安全的。 https://wiki.polkadot.network/docs/en/learn-security

有按量付费的模型,但 50-100 点仍然很贵,它必须与当前的服务器价格竞争https://medium.com/polkadot-network/parathreads-pay-as-you-go-parachains -7440d23dde06

0 投票
1 回答
101 浏览

rust - 如何正确使用 LockableCurrency 特征?

我想知道LockableCurrency是如何工作的?或者更具体地说,是什么WithdrawReasons?它只是一个标记还是此处指定的值对于实际释放锁很重要?我的用例是我想锁定资金转移一段时间,然后转移这些资金或释放锁定。那么我应该使用WithdrawReasons:all()吗?

作为旁注 - 我认为我可以使用 asubstring(hash(AccountId))作为锁定标识符,以这种方式为每个帐户创建锁定是否是个好主意?

0 投票
1 回答
100 浏览

rust - 如何在 Substrate 中实现后台线程?

假设我想设计一个类似于众筹或拍卖的系统。有一个固定的时间段来运行这样的事件。我是否可以启动一个后台线程,该线程将定期检查是否已达到事件的结束时间并随后关闭该事件?我正在查看futures板条箱(和其他一些),但它可以在 Substrate 中使用吗?有没有关于如何处理这种情况的最佳实践?

0 投票
1 回答
238 浏览

blockchain - 为什么块没有最终确定

我们有贝贝+爷爷共识的底层节点。我们试图在不同的计算机上运行它并创建一个网络。如果我们使用 Alice 和 Bob 的预装帐户,一切都会正常工作。我们正在尝试使用自己的密钥创建自己的配置。使用子密钥,生成了 2 对 4 密钥。2 sr25519 格式(帐户地址和帐户存储地址),然后是 ed25519 格式的密钥(用于 GrandpaId)。我们从他那里获取了一个种子短语并创建了一个 sr25519 密钥(用于 Babe)。也就是说,我们有 2 个验证器。我们启动了节点并使用 rpc 请求为两个验证器(babe + gran)插入密钥

节点在网络上互相看到,创建块,但不最终确定块。它可以与什么连接?截图显示了我们在启动网络照片和第二张照片时使用的配置

0 投票
1 回答
185 浏览

rust - 为什么使用::Source 而不是普通的 T::AccountId?

根据这个PR,所有可调度的调用都应该使用<T::Lookup as StaticLookup>::Source而不是T::AccountId. 为什么用查找来处理转账而不是用他们的账户来处理用户会更好?Substrate 中的查找如何工作,是否有替代方法StaticLookup

最后,除了 the 之外还有其他类型IdentityLookup吗?您将如何使用它们?

0 投票
1 回答
99 浏览

blockchain - 无法在节点和运行时之间转换参数“tx”:解码字段 CheckMortality.0 时出错

我尝试使用 polkadot-js libray 运行一个简单的应用程序,用于在 plasm 上的 Dusty 帐户之间传输令牌。运行代码片段的源代码和 package.json 可以在这个 git repo上找到

节点版本: v12.8.2
纱线版本: 1.22.5

堆栈跟踪:

trying connection to wss://rpc.dusty.plasmnet.io/ Connected to wss://rpc.dusty.plasmnet.io/ You are connected to chain Dusty using Plasm Node v1.6.1-cf15b11-x86_64-linux-gnu - wss://rpc.dusty.plasmnet.io/ got nonce Type { negative: 0, words: [ 0 ], length: 1, red: null, registry: TypeRegistry {} } 2021-02-05 21:00:27 RPC-CORE: submitExtrinsic(extrinsic: Extrinsic): Hash:: 1002: Verification Error: Execution: Could not convert parameter tx between node and runtime: Error decoding field CheckMortality.0: RuntimeApi, Execution: Could not convert parametertx between node and runtime: Error decoding field CheckMortality.0 (node:13572) UnhandledPromiseRejectionWarning: Error: 1002: Verification Error: Execution: Could not convert parametertx between node and runtime: Error decoding field CheckMortality.0: RuntimeApi, Execution: Could not convert parametertx between node and runtime: Error decoding field CheckMortality.0 at RpcCoder._checkError (<mydir>\examples\plasm-simple-transfer\node_modules\@polkadot\api\node_modules\@polkadot\rpc-provider\coder\index.js:84:13) at RpcCoder.decodeResponse (<mydir>\examples\plasm-simple-transfer\node_modules\@polkadot\api\node_modules\@polkadot\rpc-provider\coder\index.js:47:10) at WsProvider.value (<mydir>\examples\plasm-simple-transfer\node_modules\@polkadot\api\node_modules\@polkadot\rpc-provider\ws\index.js:214:90) at W3CWebSocket.value [as onmessage] (<mydir>\examples\plasm-simple-transfer\node_modules\@polkadot\api\node_modules\@polkadot\rpc-provider\ws\index.js:194:153) at W3CWebSocket._dispatchEvent [as dispatchEvent] (<mydir>\examples\plasm-simple-transfer\node_modules\yaeti\lib\EventTarget.js:107:17) at W3CWebSocket.onMessage (<mydir>\examples\plasm-simple-transfer\node_modules\websocket\lib\W3CWebSocket.js:234:14) at WebSocketConnection.<anonymous> (<mydir>\examples\plasm-simple-transfer\node_modules\websocket\lib\W3CWebSocket.js:205:19) at WebSocketConnection.emit (events.js:315:20) at WebSocketConnection.processFrame (<mydir>\examples\plasm-simple-transfer\node_modules\websocket\lib\WebSocketConnection.js:554:26) at <mydir>\examples\plasm-simple-transfer\node_modules\websocket\lib\WebSocketConnection.js:323:40 (node:13572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:13572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

此外,当我尝试进行清晰运行(删除 node_modules 并重新安装)时,我收到相同的消息,但字段 CheckMortality 被 CheckNonce 替换。由 plasm-types 库返回的字段可以在此文件中以 json 格式找到。

我试图通过浏览节点模板存储库来找出错误的类型,但我无法弄清楚。如何修复?