有没有办法确定是否已经在链条上使用了名称空间?
在
名称空间声明为在名称空间范围内定义的模块和接口提供了独特的前缀。名称空间在公共和私人区块链上下文中的处理方式有所不同:在私有区域中,它们是可以自由定义的,并且用户代码可以使用根名称空间(即根本不使用名称空间)。在公共区块链中,不允许用户使用根名称空间(该空间是用于内置合同(如硬币合同)的,并且必须在命名空间内定义代码,该命名空间可能是可以或无法定义的(即,用户可能仅限于用户“用户”名称空间)。
如果我写一份智能合约并需要定义命名空间,我是否有任何方法可以验证我的名称空间是否唯一?
In the Pact language reference entry on namespaces, the text is clear that on public blockchains modules and interfaces must be defined within namespaces, and namespaces must be globally-unique.
Namespace declarations provide a unique prefix for modules and interfaces defined within the namespace scope. Namespaces are handled differently in public and private blockchain contexts: in private they are freely definable, and the root namespace (ie, not using a namespace at all) is available for user code. In public blockchains, users are not allowed to use the root namespace (which is reserved for built-in contracts like the coin contract) and must define code within a namespace, which may or may not be definable (ie, users might be restricted to “user” namespaces).
If I am writing a smart contract and need to define a namespace, is there any way for me to verify whether my namespace is unique?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
(列表模型)
获取具有其完整名称名称的现有模块列表。您还可以从Chainweaver列出它们。请注意,如果不被Kadena分配给您,就无法在TestNet或Mainnet上创建命名空间。如果您想在公共空间中部署而不必获得命名空间,请使用现有的名称空间或用户。
Use
(list-modules)
to get a list of existing modules with their full namespace name. You can also list them from Chainweaver.Please note that you cannot create the namespace on testnet or mainnet without it being assigned to you by Kadena. If you want to deploy in a public space without having to obtain a namespace use the existing namespace free or user.