🤳Namespaces

Our contract begins by entering a namespace.

Modules, interfaces, and keysets in Pact must have unique names within a particular namespace. On a private blockchain, you can define your own namespace or use the "root" namespace (ie. no namespace at all). On a public blockchain, the root namespace is reserved for built-in contracts (like the coin contract, which we’ll see later), and on Nuchain Consensus specifically, you can only define a new namespace with the approval of the NuChain team.

In short, we technically can define a namespace with (define-namespace) in our contract but, practically speaking, we can’t do this on NuChain Consensus. So we can’t define a namespace, and we can’t use the root namespace. What are we to do?

NuChain Consensus exposes two namespaces for public use: "free" and "user". You can define interfaces, modules, and keysets inside either of these two interfaces.

To do that, enter the namespace with the (namespace) function. #namespace

We’ll use the "free" namespace for our contract:

pact

/(namespace "free")

Last updated