Skip to content

Getting Started

Lee Dogeon edited this page Aug 4, 2022 · 3 revisions

Goal

This document guides you to create your own local blockchain with a headless node from scratch.
You also can attach to the existing NineChronicles blockchain as one of the Nodes.
We hope you can easily start participating and/or contributing NineChronicles from here.

Instructions

1. Environment

  • Windows 10 or 11 is recommended
  • Linux/macOS also works, but compatibility is not guaranteed.
    • Also support apple silicon.

2. Requirements

  • .NET SDK
    • .NET 6.0

3. Prepare repository

git clone https://github.com/planetarium/NineChronicles.Headless -- recursive
cd NineChronicles.Headless
git checkout main  # If you're a contributor, skip this step
git pull
git submodule update --recursive

4. Build and run headless

4.1. Attach to existing blockchain network as one of nodes.

We're going to use mainnet config that is same as the released game client uses.
You will attach to NineChronicles mainnet with this instruction.


WARNING

You have to download blockchain snapshot to run mainnet node.
This will consume over 30GB of your computer.
If you do not have enough disk space, please do not try this.


  1. Get configurations to connect
curl https://download.nine-chronicles.com/9c-launcher-config.json -o dist/config.json
  1. Download blockchain snapshot Download latest snapshot from HERE. Extract zip file to suitable place to persist blockchain data. The path will be used to run headless node.

  2. Build and run

dotnet run --project .\NineChronicles.Headless.Executable\
  --V=[App Protocol version]
  --G=https://download.nine-chronicles.com/genesis-block-9c-main  # Genesis block of NineChronicles mainnet
  --store-type=rocksdb
  --store-path=[Absolute path of snapshot data]
  -I=turn://0ed3e48007413e7c2e638f13ddd75ad272c6c507e081bd76a75e4b7adc86c9af:0apejou+ycZFfwtREeXFKdfLj2gCclKzz5ZJ49Cmy6I=@turn-us.planetarium.dev:3478
  -I=turn://0ed3e48007413e7c2e638f13ddd75ad272c6c507e081bd76a75e4b7adc86c9af:0apejou+ycZFfwtREeXFKdfLj2gCclKzz5ZJ49Cmy6I=@turn-us2.planetarium.dev:3478
  -I=turn://0ed3e48007413e7c2e638f13ddd75ad272c6c507e081bd76a75e4b7adc86c9af:0apejou+ycZFfwtREeXFKdfLj2gCclKzz5ZJ49Cmy6I=@turn-us3.planetarium.dev:3478
  -I=turn://0ed3e48007413e7c2e638f13ddd75ad272c6c507e081bd76a75e4b7adc86c9af:0apejou+ycZFfwtREeXFKdfLj2gCclKzz5ZJ49Cmy6I=@turn-us4.planetarium.dev:3478
  -I=turn://0ed3e48007413e7c2e638f13ddd75ad272c6c507e081bd76a75e4b7adc86c9af:0apejou+ycZFfwtREeXFKdfLj2gCclKzz5ZJ49Cmy6I=@turn-us5.planetarium.dev:3478
  --peer=027bd36895d68681290e570692ad3736750ceaab37be402442ffb203967f98f7b6,9c-main-tcp-seed-1.planetarium.dev,31234
  --peer=02f164e3139e53eef2c17e52d99d343b8cbdb09eeed88af46c352b1c8be6329d71,9c-main-tcp-seed-2.planetarium.dev,31234
  --peer=0247e289aa332260b99dfd50e578f779df9e6702d67e50848bb68f3e0737d9b9a5,9c-main-tcp-seed-3.planetarium.dev,31234
  --no-miner
  --workers=1000

You can get all the options in README.md.

4.2. Create your own isolated blockchain.

  1. Create new genesis block
## WIP
  1. Create private key for block miner
dotnet tool install -g Libplanet.Tools
planet key generate
[... New private key ...]

Please save generated private key. It'll be used to mine blocks of your own chain.

  1. Build and run Do not use your own option and mainnet option.
dotnet run --project .\NineChronicles.Headless.Executable\ 
  -V=[App Protocol Version] 
  -G=[Absolute path of your genesis] 
  --store-type=memory 
  --workers=1000 
  --host=localhost 
  --port=[port number to use] 
  --miner-private-key=[Your miner's private key]

Because we use memory as store type, everytime you run this program will reset and mine block from #1 again.
If you want persist your own blockchain, change --store-type option to rocksdb instead memory.

Troubleshooting

  1. I cannot install .NET Core 3.1 on my machine
    • If you're running ubuntu 22.04 LTS or later, you cannot install .NET Core 3.1.
    • To resolve this, you should download .NET 3.1 tarball and merge it with .NET 6.0 folder.
    • You can get some help in this page (Korean)

References