创建 NEAR 账户最少需要多少 NEAR 余额?

已知通过命令行创建子账户是,提供初始余额为0.01N 是可行的,但是0.001N则会创建失败。

成功

near create-account bob.bot.testnet --masterAccount bot.testnet --initialBalance 0.01

失败

near create-account bob.bot.testnet --masterAccount bot.testnet --initialBalance 0.001

创建账户最少需要提供多少余额?

阅读 2.3k
2 个回答

目前创建一个 NEAR 账户,最少需要消耗 0.00182 N

以下为分别用 0.00182N 和 0.00181N 创建的实验。

实验1:用 0.00182N 创建子账户

near create-account baby.bot.testnet --masterAccount bot.testnet --initialBalance 0.00182

成功

Account baby.bot.testnet for network "testnet" was created.

实验2:用 0.00181N 创建子账户

near create-account bob.bot.testnet --masterAccount bot.testnet --initialBalance 0.00181

失败: 错误信息

Receipts: D6rcZzU5aWVv1yKdgQtvtkFQuReXGUwNrekR1SZuXWAC, iZnxP2QBTkoqARJ8ESo15tVMtHZEWMaLhy4UpHjRqD5
    Failure [bob.bot.testnet]: Error: The account bob.bot.testnet wouldn't have enough balance to cover storage, required to have 10000000000000000000 yoctoNEAR more
An error occured
Error: The account bob.bot.testnet wouldn't have enough balance to cover storage, required to have 10000000000000000000 yoctoNEAR more

错误信息提示需要增加 0.00001N 以满足存储的需要,也就是总计最少需要 0.00182N。

原因分析

这是由于,一个新创建的 NEAR 账户需要最少 182字节的存储空间(如 https://explorer.testnet.near...) ,目前 NEAR 的账户存储需要的费用为每100KB需要预留1NEAR,所以最少的余额为 0.00182N。
image.png

182字节中,账户的存储为100字节(包含余额等数据),第一个公钥的存储为82字节。如果增加一个新的公钥,存储消耗为 264字节(如 https://explorer.testnet.near...,有两个公钥)。

关于账户的定义和设计,可以阅读 Account 的 spec: https://nomicon.io/DataStruct... 和 nearcore 中的实现:https://github.com/near/nearc...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进