This guide shows you how to extend the rental period of a namespace.
Complete registering a namespace guide.
Have an account with a namespace.
Have an account with enough bitxor
to pay for the transaction and renewal fees.
Click on the “Namespaces” on the left-side menu.
Click on the “Edit” button (pen bitxor) for the namespace you desire to extend the duration of. Then click on “Extend duration”.
Enter the amount of blocks to extend the duration of the namespace. Select the amount of fees you are willing to spend. Click “Send”.
Review the information, enter your wallet password, and click “Confirm”.
1. Get your namespace information, and inspect the value of the property endHeight
.
The guide uses the namespace foo
, but you should follow along with the namespace name you have registered and want to extend its duration.
bitxor-cli namespace info --name foo
Namespace: foo
--------------
hexadecimal: 82a9d1ac587ec054
uint: [ 1484701780, 2192167340 ]
type: Root namespace
owner: TBULEA...IPS4
startHeight: 52000
endHeight: 53000
The CLI returns that the namespace will become inactive at height 5300
.
The next step is to figure out the current height of the chain, and calculate the number of blocks remaining before your namespace becomes inactive.
Check the current blockchain height.
bitxor-cli blockchain height
52500
As you can see, the namespace is going to expire in 500
blocks (53000-52500).
To avoid losing all the subnamespaces and aliases linked to foo, we are going to extend the namespace duration.
Extend the namespace duration for 172800
more blocks.
// replace with namespace name
const namespaceName = 'foo';
// replace with duration (in blocks)
const duration = UInt64.fromUint(172800);
// replace with network type
const networkType = NetworkType.TEST_NET;
const namespaceRegistrationTransaction = NamespaceRegistrationTransaction.createRootNamespace(
Deadline.create(epochAdjustment),
namespaceName,
duration,
networkType,
UInt64.fromUint(2000000),
);
// replace with private key
const privateKey =
'1111111111111111111111111111111111111111111111111111111111111111';
const account = Account.createFromPrivateKey(privateKey, networkType);
// replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash =
'1DFB2FAA9E7F054168B0C5FCB84F4DEB62CC2B4D317D861F3168D161F54EA78B';
const signedTransaction = account.sign(
namespaceRegistrationTransaction,
networkGenerationHash,
);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp.announce(signedTransaction).subscribe(
(x) => console.log(x),
(err) => console.error(err),
);
// replace with namespace name
const namespaceName = 'foo';
// replace with duration (in blocks)
const duration = bitxor_sdk_1.UInt64.fromUint(172800);
// replace with network type
const networkType = bitxor_sdk_1.NetworkType.TEST_NET;
const namespaceRegistrationTransaction = bitxor_sdk_1.NamespaceRegistrationTransaction.createRootNamespace(
bitxor_sdk_1.Deadline.create(epochAdjustment),
namespaceName,
duration,
networkType,
bitxor_sdk_1.UInt64.fromUint(2000000),
);
// replace with private key
const privateKey =
'1111111111111111111111111111111111111111111111111111111111111111';
const account = bitxor_sdk_1.Account.createFromPrivateKey(
privateKey,
networkType,
);
// replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash =
'1DFB2FAA9E7F054168B0C5FCB84F4DEB62CC2B4D317D861F3168D161F54EA78B';
const signedTransaction = account.sign(
namespaceRegistrationTransaction,
networkGenerationHash,
);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new bitxor_sdk_1.RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp.announce(signedTransaction).subscribe(
(x) => console.log(x),
(err) => console.error(err),
);
Note
Use the following formula to convert approximately days to blocks duration ≈ numberOfDays * 86400 / blockGenerationTargetTime
.
Once the RegisterNamespaceTransaction gets confirmed, double-check that the namespace duration has been extended.
Validate that endHeight
has increased by 172800
block units.
bitxor-cli namespace info --namespace-name foo
Namespace: foo
--------------
hexadecimal: 82a9d1ac587ec054
uint: [ 1484701780, 2192167340 ]
type: Root namespace
owner: BXRBDE...32I
startHeight: 52000
endHeight: 225800
Open a terminal window and run the following command.
Replace foo
with the namespace name and 172800
with the number of blocks to extend.
bitxor-cli transaction namespace --name foo --rootnamespace --duration 172800