このガイドでは、ネームスペース期限の延長の仕方を示します。
symbol.xym を持たせてください。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.
symbol-cli namespace info --name foo
Namespace: foo
--------------
hexadecimal: 82a9d1ac587ec054
uint: [ 1484701780, 2192167340 ]
type: Root namespace
owner: TBULEA...IPS4
startHeight: 52000
endHeight: 53000
CLI はネームスペースがブロック高 5300 で非アクティブになることを返却します。次のステップは現在のチェーン高を把握し、ネームスペースが非アクティブになるまでに残っているブロック数を計算することです。
symbol-cli blockchain height
52500
ご覧のとおり、ネームスペースは 500 ブロック(53000-52500)で期限切れになります。foo にリンクしているすべてのサブネームスペースとエイリアスが失われないようにするためにネームスペースの期間を延長します。
172800 ブロック延長します。 // 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 = 'http://api-01.us-east-1.testnet.symboldev.network:3000';
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 = symbol_sdk_1.UInt64.fromUint(172800);
// replace with network type
const networkType = symbol_sdk_1.NetworkType.TEST_NET;
const namespaceRegistrationTransaction = symbol_sdk_1.NamespaceRegistrationTransaction.createRootNamespace(
symbol_sdk_1.Deadline.create(epochAdjustment),
namespaceName,
duration,
networkType,
symbol_sdk_1.UInt64.fromUint(2000000),
);
// replace with private key
const privateKey =
'1111111111111111111111111111111111111111111111111111111111111111';
const account = symbol_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 = 'http://api-01.us-east-1.testnet.symboldev.network:3000';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp.announce(signedTransaction).subscribe(
(x) => console.log(x),
(err) => console.error(err),
);
注釈
この公式 duration ≈ numberOfDays * 86400 / blockGenerationTargetTime を使っておよその日数をブロックに変換します。
RegisterNamespaceTransaction が承認されたら、ネームスペースの期限が延長されたことも確認してください。
endHeight が ブロック単位で 172800 増加していることを確認してください。 symbol-cli namespace info --namespace-name foo
Namespace: foo
--------------
hexadecimal: 82a9d1ac587ec054
uint: [ 1484701780, 2192167340 ]
type: Root namespace
owner: TCHBDE...32I
startHeight: 52000
endHeight: 225800
お探しのものは見つかりましたか? フィードバックをください。