The most relevant scenario is when using a main account opted-in from a NIS1 account. In this case you can directly use the key obtained in the opt-in process as your Main key instead of the randomly-generated one.
投票
If your node is to be a voting node it must have linked a voting key for the period in which you intend to vote. This is interesting as voting nodes receive voting rewards.
ただし、投票キーの生成は、以前の生成よりも少し複雑です:
Still from within the _build directory create another directory called votingkeys.
投票キーの作成 (またはキー):
Voting keys are different from the other keys in that they have a period of validity, for example. They are only valid from a Start Epoch to an End Epoch (see side box).
Nodes are only eligible as voters if they are linked to a valid voting key for the current blockchain epoch, so remember to renew your voting key periodically.
To help you with that task, you can have up to 3 linked voting keys, with different periods, so you can easily renew one key while there's still another one active (you will need to unlink an older key to be able to link more than 3 keys).
A voting key is created using catapult.tools.votingkey and providing its period of validity (note you do not use catapult.tools.addressgen as before):
This creates a file named votingkeys/private_key_tree1.dat and prints the voting key on the terminal. As your voting keys expire and you create new ones, increase the number on the file name.
generating 361 keys, this might take a while
votingkeys\private_key_tree1.dat generated
verifying generated file
saved voting public key: ****************
loaded voting public key: ****************
Copy the voting key public key into the temporary text file where you keep the rest of the keys, label it Voting and save it for later.
設定
Symbol is highly customizable and this means there are a lot of parameters that can be adjusted to suit your node's needs. Some of these parameters are network-related and must match the rest of nodes in the network (for example currencyMosaicId) whereas some others are node-related and you can set freely (for example friendlyName).
You should now have at least the following files in the certificates folder: ca.pubkey.pem, ca.crt.pem, node.full.crt.pem, node.crt.pem and node.key.pem.
(Optional) To create a harvesting node. The Remote key will automatically be used so that リモートハーベスティング is enabled by default.
--voting
(Optional) To create a voting node. If you enable this copy the private_key_tree1.dat file you created above into this directory.
--output
(オプション) 設定を保存するフォルダ。
例:
python3 generator.py --mode dual --harvesting --voting --output settings
i | extracting nemesis seed
i | preparing base settings
i | turning on harvesting
i | turning on voting
i | extracting mongo scripts
i | copying certificates
i | moving private_key_tree1.dat
This command will produce all the required node configuration files in the settings directory and you need to copy them to _build, in the machine where your node will run:
You should see a lot of debug output while the node starts synchronizing with the rest of the network:
... peer returned 42 blocks (heights 2 - 43)
The node can be stopped by pressing Ctrl-C and restarted simply by running catapult.server again.
If you see no error messages, your client is up and running and you can continue with this guide.
キーのリンク
The client is now running but it will not be able harvest because a number of keys need to be linked to it. These links are created through transactions announced to the network.
These transactions can be announced from ANY machine. In particular, this can be done from a machine other than the one running your node so your main account's private key is never stored on the node.
Your node's API server is not running yet (this will be done later) so you cannot use it to announce transactions. Fortunately, you have a list of available API nodes in the network in ../resources/peers-api.json.
Open this file and pick any of the hosts listed in the lines starting with "host":. You will use this in the next command instead of HOST.
実行:
$ symbol-cli profile import --network MAIN_NET --url http://HOST:3000 --default
✔ Enter a profile name: ... Main
✔ Enter your wallet password: ... *********
✔ Select an import type: › PrivateKey
✔ Enter your account private key: ... ********************************
プロファイル名を入力します (例 メイン )
プロファイルを保護するためにパスワードを入力します。
インポートタイプとして 秘密鍵 を選択します。
メイン 秘密鍵を入力します。
The profile information is stored (encrypted) in ~/symbol-cli.config.json and symbol-cli is now ready to use.
注釈
All the key links created in the next subsections can be undone at any time by announcing an equivalent unlink transaction (--actionUnlink). Therefore you can always mend any mistake or change your node configuration (Each transaction has a fee, though).
リモートキー
You configured the node to sign created blocks using the Remote key, but the harvesting fees should go to your Main account. This is accomplished by announcing an AccountKeyLinkTransaction:
symbol-cli transaction accountkeylink --sync --action Link \
--max-fee 1000000 --mode normal
✔ Enter your wallet password: ... *********
✔ Enter the public key of the remote account: ********************************
プロファイルのパスワードを入力します。
リモート公開 鍵を入力します。
...
✔ Do you want to announce this transaction? ... yes
SUCCESS Transaction announced
SUCCESS Transaction confirmed
symbol-cli transaction vrfkeylink --sync --action Link \
--max-fee 1000000 --mode normal
✔ Enter your wallet password: ... *********
✔ Enter the public key to link: ... ********************************
VRF 公開 鍵を入力します。
投票キー
If your node is to be a voting node it must link the voting key you generated above. The link is accomplished by announcing a VotingKeyLinkTransaction:
symbol-cli transaction votingkeylink --sync --action Link \
--max-fee 1000000 --mode normal
✔ Enter your wallet password: ... *********
✔ Enter the public key of the voting key account: ****************
✔ Enter the start point: ... 100
✔ Enter the end point: ... 460
プロファイルのパスワードを入力します。
直前で取得した 投票公開キー を入力します。
投票キーの作成時に使用した開始エポックと終了エポックを入力します。
...
✔ Do you want to announce this transaction? ... yes
SUCCESS Transaction announced
SUCCESS Transaction confirmed
When the next epoch starts, if it is inside the Start and End epochs of one of your registered keys, your node should participate in the finalization process and collect voting rewards.
注釈
Every epoch, more than 67% of all eligible voting nodes need to cast their votes or finalization stalls.
Therefore, if you are planning to take your node offline for a long time it is important that you unlink your voting keys for that period so that finalization is not affected.
API ノードのビルド
Catapult クライアントを実行したら 追加サービス を追加して API ノードに変えることができます:
As shown in the diagram above, besides the Catapult client you will also need:
データベース は REST データを保持します。
A Catapult Broker serializing accesses to the database.
A REST gateway accepting requests and turning them into Catapult client commands or database queries.