Namespace

Namespaces are human-readable text strings that can be used in place of an Address or a Token ID.

They create an on-chain unique place for your project and your assets on the blockchain.

Properties

Name

Namespaces function similarly to internet domains. Creating a namespace starts with choosing a name that you will use to refer to an account or asset. The name must be unique in the network, and has a maximum length of 64 characters (the only allowed characters are a through z, 0 through 9, _ and -).

Duration

At the time of the namespace registration, you must set the number of confirmed blocks you would like to rent the namespace for.

The public network defines a minimum namespace duration of 30 days and a maximum of 365 days, being these parameters editable per network.

You can use the following formula to convert approximately days to blocks:

\[duration ≈ \frac{numberOfDays * 86400}{blockGenerationTargetTimeInSeconds}\]

By default, blockGenerationTargetTimeInSeconds is 30 seconds.

During the renting period, the namespace creator can create subnamespaces, alias accounts and tokens. The creator can also extend the rental by sending a NamespaceRegistrationTransaction with the desired number of additional blocks.

The network can define a grace period that enables the namespace creator to renew the namespace past the expiration date before it becomes publicly available for registration. Bitxor’s public network has set the grace period to 30 days.

When the grace period ends, the namespace is deleted. At this point, the namespace becomes available for its registration again.

../_images/namespace-life-cycle.png

Namespace life-cycle

Permissions by namespace status

Action

Namespace unregistered

Namespace registered

Grace Period

Register a new namespace

✔️

Renew the namespace

✔️

✔️

Create subnamespaces

✔️

Link an alias to an address or token

✔️

Send a transaction using an alias

✔️

Note

Only namespaces created during the genesis block can have perpetual duration.

Subnamespaces

On the internet, a domain can have a sub-domain. Bitxor namespaces can have subnamespaces to identify and organize assets.

../_images/namespace-setup.png

Organizing assets with namespaces

In the public network namespaces can have up to 3 levels, i.e., a namespace and two levels of subnamespace domains. Each root namespace can have up to 256 subnamespaces.

A subnamespace does not have a duration by its own; it inherits the duration from its parent namespace.

You can create multiple subnamespaces with the same name in different namespaces. For example, you can create the subnamespaces foo.bar and foo2.bar, but the combination rootnamespace + subnamespace must remain unique.

Alias

AddressAliasTransaction link namespaces to accounts and tokens. An alias or its linked asset can be used interchangeably when sending a transaction. Using the alias makes long addresses rememberable and tokens recognizable.

The creator of the namespace can link the namespace to an account or token. This link will be editable, so the creator may unlink a previously set alias and link the namespace to a different asset.

The block receipts store the resolution of the alias for a given transaction. This is, what was the actual address or token ID behind a namespace when a transaction was issued.

Alias transactions have the following restrictions:

  • An account or token can be linked to many namespaces but a namespace can only be linked to one account or token.

  • An account can assign a namespace to any account that permits receiving AddressAliasTransaction.

  • An account can only link the alias to a token id when the account is the creator of the token.

Rental fee

An account willing to register a namespace or extend its duration has to pay a rental fee in addition to the transaction fee. Both fees will be deducted from the account’s balance after the announcement of a valid NamespaceRegistrationTransaction.

The REST Gateway provides an endpoint to get an estimation of how much network currency will cost you to register a namespace:

const nodeUrl = 'NODE_URL';
const repositoryHttp = new RepositoryFactoryHttp(nodeUrl);

const networkHttp = repositoryHttp.createNetworkRepository();
networkHttp.getRentalFees().subscribe((rentalFees) => {
  console.log(
    'RootNamespaceRentalFeePerBlock',
    rentalFees.effectiveRootNamespaceRentalFeePerBlock.compact(),
  );
  console.log(
    'ChildNamespaceRentalFee',
    rentalFees.effectiveChildNamespaceRentalFee.compact(),
  );
});
const nodeUrl = 'NODE_URL';
const repositoryHttp = new bitxor_sdk_1.RepositoryFactoryHttp(nodeUrl);
const networkHttp = repositoryHttp.createNetworkRepository();
networkHttp.getRentalFees().subscribe((rentalFees) => {
  console.log(
    'RootNamespaceRentalFeePerBlock',
    rentalFees.effectiveRootNamespaceRentalFeePerBlock.compact(),
  );
  console.log(
    'ChildNamespaceRentalFee',
    rentalFees.effectiveChildNamespaceRentalFee.compact(),
  );
});

The default namespace rental fees are configurable per network, but the network dynamically adjusts the namespace rental fees over time.

Default values for public network

Property

Value

Registering a namespace

0.000001 bitxor per block.

Extending a namespace duration

0.000001 bitxor per block.

Creating a subnamespace

0.0001 bitxor.

To calculate the effective rental fee, the network multiplies the default value set in the configuration by the network’s dynamic fee multiplier.