Create new genesis block - planetarium/NineChronicles.Headless GitHub Wiki
Create new genesis block
To start new blockchain network, you have to start from genesis block.
This document will guide you to create new genesis block and run headless node with your own genesis block.
Requirements
- Dotnet
- (Optional) Node.js
- LTS version recommended
Instructions
1. Clone and setup repository
git clone https://github.com/planetarium/NineChronicles.Headless
cd NineChronicles.Headless
git submodule update --init --recursive
2. (Optional) Preparation
All of following steps are optional. You can select some of them or skip all preps.
1. Create activation keys
Activation key is the key to activate new 9c address in NineChronicles game.
You can make activation key whenever you want, so you can skip this step if you don't want include activation keys inside genesis block.
dotnet run --project ./.Lib9c.Tools tx create-activation-keys 10 > activationKey.csv # change [10] to your number of new activation keys
dotnet run --project ./.Lib9c.Tools tx create-pending-activations activationKey.csv > PendingActivation
2. Create address to mint initial currency
You have to sign to the initial currency mining Tx. when you create new genesis block.
If you want to specify initial minter, you have to create a private key else Headless
will create new address to mint.
You need Planet CLI Tools to create address and export private key.
- Install platnet cli
npm install -g @planetarium/cli # or, dotnet tool install -g Libplanet.Tools
- Create initial minter address
Check and keep your initial minter's address.planet key create Passphrase: ***** # Keep this and DO NOT FORGET IT Retype passphrase: ***** Key ID Address ---------------- ---------------- 12345678-1234... 0x1234567890a...
- Export private key using address
Do not expose your private key to anywhere. Keep this for later use.planet key export 12345678-1234... # Use Key ID Passphrase: ***** 1234567890abcdef... # This is the private key
3. Create admin address
If you don't want admin for your network, skip this step.
planet key create
Passphrase: *****
Retype passphrase: *****
Key ID Address
---------------- ----------------
12345678-1234... 0x1234567890a...
Keep admin address and passphrase for later use.
3. Set config to create genesis block
The sample config is prepared for accessibility.
cp config.json.example config.json
And edit config file as you want. Please check README to get config structure.
4. Create new genesis block
dotnet run --project ./NineChronicles.Headless.Executable genesis config.json
The new genesis block will be generated and saved to genesis-block
file.
If you do not provide curerncy
config, the initial_deposit.csv
file will also be created.
5. (Test) Run headless node from new genesis block
Run your local headless node using new genesis block.
dotnet run --project ./NineChronicles.Headless.Executable/ \
-V=100260/6ec8E598962F1f475504F82fD5bF3410eAE58B9B/MEUCIQCG2yQNyXu3ovuUBNMEQiqx1vdo.FCMet9FoayFiIL89QIgXGRTU84nrcmLL4ud2j9ogrGt7ScmqaD97N.4rrtraXE=/ZHUxNjpXaW5kb3dzQmluYXJ5VXJsdTU2Omh0dHBzOi8vZG93bmxvYWQubmluZS1jaHJvbmljbGVzLmNvbS92MTAwMjYwL1dpbmRvd3MuemlwdTk6dGltZXN0YW1wdTEwOjIwMjItMDctMjhl \
-G=[PATH/TO/GENESIS/BLOCK] \
--store-type=memory \
--store-path= [PATH/TO/BLOCK/STORAGE] \
--workers=1000 \
--host=localhost \
--port=43210 \
--miner-private-key=[PRIVATE_KEY_OF_BLOCK_MINER]