账户位于substrate-node-template中的什么位置?

2023-12-29

When we launch substrate-front-end-template, the first thing one sees is a bunch of dummy accounts with some Balance, and I was under the impression that these accounts were being fetched from Genesis storage of the running chain. However, when I went into chain_spec.rs file and deleted all accounts, and even renamed some in the testnet_genesis function, I continue to see accounts, albeit with zero balance: enter image description here

在控制台上,keyring.getAccounts()返回这些帐户。

这是我的 ChainSpec 的样子:

Ok(ChainSpec::from_genesis(
        "Development",
        "dev",
        ChainType::Development,
        move || {
            testnet_genesis(
                wasm_binary,
                vec![authority_keys_from_seed("Foundation")],
                get_account_id_from_seed::<sr25519::Public>("Foundation"),
                vec![
                    get_account_id_from_seed::<sr25519::Public>("Foundation"),
                ],
                true,
            )
        },
        // Bootnodes
        vec![],
        // Telemetry
        None,
        // Protocol ID
        None,
        // Properties
        Some(props),
        // Extensions
        None,
    ))

正如您所看到的,没有提及 alice、bob、charlie 等帐户。我什至搜索了整个节点文件夹以查找这些帐户的提及,但无济于事。有人可以告诉我怎么做吗properly将新帐户、sudo 帐户等添加到我的创世配置中?谢谢。


账户只是节点模板中的公钥。这意味着您可以检查每个可能的公钥,并且它将返回零。但这并不意味着有任何状态与此帐户关联。 (假设您已将存在存款配置为高于 0)。

如果您想在创世上添加帐户,只需查看testnet_genesis https://github.com/paritytech/substrate/blob/55cd07a7e22c26932f7bd16b87ea5a7569e38eb4/bin/node-template/node/src/chain_spec.rs#L126. The endowed_accounts(第四个参数)是您正在寻找的内容。这些账户在创世时就获得了一些余额。所有这些代码都是链相关的,您可以根据需要更改它。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

账户位于substrate-node-template中的什么位置? 的相关文章

  • 如何将Python字典对象转换为numpy数组

    我有 python dict 对象 其键作为 datetime date 对象 值作为元组对象 gt gt gt data dict datetime date 2006 1 1 5 3 datetime date 2006 1 2 8 8
  • Slim + Twig - 如何在开发过程中关闭 Twig 缓存?

    这是我将其注入 Slim 容器中的树枝视图 Views and Templates https www slimframework com docs features templates html container view functi
  • PHP:包含和需要文件时抛出错误

    我尝试创建一个引导文件 但是每当我尝试在另一个文件中包含或需要它时 就会不断出现这样的错误 Warning require once folder file php function require once 无法打开流 没有这样的文件或目
  • 快速获取特定路径下的所有文件和目录

    我正在创建一个备份应用程序 其中 c 扫描目录 在我使用类似的方法来获取目录中的所有文件和子文件之前 DirectoryInfo di new DirectoryInfo A var directories di GetFiles Sear
  • 如何通过只输入一个EOF来结束scanf

    我遇到了这个问题 我正在使用 while 循环来扫描数字字符串 需要结束扫描并开始继续程序的其余部分 我只是不知道如何刷新标准输入或做任何事情而不按 Ctrl D 两次 我只需要发送 EOF 一次来告诉我的循环结束 while feof s
  • 仅在弹性项目内阻止元素?

    显然 弹性项目容器内只能有块元素 内联 内联块 浮动没有任何作用 这很奇怪 除非我做得完全错误 否则似乎没什么用 这是笔 http codepen io iaezzy pen GggVxe http codepen io iaezzy pe
  • vim diff 可以使用耐心算法吗?

    有没有办法将vimdiff的diff策略设置为耐心算法 它内置于 git 中 似乎比普通的 diff 好得多 以供参考 如何将耐心设置为默认的 git diff 算法 https stackoverflow com questions 44
  • 转到 Google 表格中的最后一行数据

    我查了一下 发现以下代码将前进到 Google 电子表格中数据的最后一行 至少在我们添加第 297 行之外的更多行之前是这样 function myFunction var ss SpreadsheetApp getActiveSpread

随机推荐