Introducing ThunderCore Local Chain

Changzheng Liu
Oct 19, 2018 · 4 min read

[NOTICE: The ThunderCore Local Chain is out of date and will soon be deprecated for an updated and separate release. Since the local chain is still functional and mostly compatible with ThunderCore, we’re leaving content up in case it’s useful for someone]

It’s been two months since we released our ThunderCore Testnet. With a publicly available Testnet, anyone can easily test their DApps on Thunder’s scalable EVM-compatible Blockchain. In addition, we are releasing a local chain that allows developers to deploy and test their DApps on their local setup.

The ThunderCore local chain implementation is based on a fork from Ethereum’s go-ethereum repository. It contains a Thunder module which acts as an abstraction interface to ThunderCore’s consensus protocol. Each local chain will run as a single node, so users can get the source code, build, and run in their local environment.

Please note: the local chain generates blocks with Thunder block headers, but it does not implement ThunderCore’s consensus protocol. These local chains, therefore, do not include the proposal and voting process of the ThunderCore Testnet. For more information on ThunderCore Testnet, please refer to this blog.

Once they get the source code, DApp developers can start, stop, test, and modify ThunderCore local chains without dealing with transaction fees and external network dependencies. This feature is a starting point — we will continue to build and share more tools that simplify the development cycle and enable more developers to utilize ThunderCore. In this blog post, we will explain how to start a ThunderCore local chain.

0. Prerequisites

Running Thunder local chain requires Golang environment. Go to to find the resource on how to install and set up.

1. Get the source code

# git clone

2. Build the binaries

# make thunder
# make all

3. Start local chain

3.1 Create accounts and initial configuration

3.1.1 Create an account

Run “thunderlocal account new” from the build/bin folder and set a password at the prompt:

# build/bin/thunderlocal account new --datadir ./datadirYour new account is locked with a password. Please give a password. Do not forget this password.Passphrase:Repeat passphrase:Address: {0af454242c456d1fc25c1d74a56a00a816ec336b}

This command will create an account and the account information is saved in ./datadir/keystore/UTC -- XXX

3.2 Chain initialization

3.2.1 Genesis file

Genesis file is a configuration file in json format which defines the start of a blockchain. Users can create the file by one of two methods: Create genesis file by a template

The template below pre-funds the account created above. Please take note of the “alloc” block. Name this file “thunder.json”

"config": {
"chainId": 3606,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"thunder": {

"nonce": "0x0",
"gasLimit": "0x47b760",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0x0af454242c456d1fc25c1d74a56a00a816ec336b" : { "balance": "1000000000000000000000000000000000000000" }
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"

Please also note the “thunder” block in the JSON file, which will tell the program to use thunder consensus engine when starting a local chain. Create the genesis file by using puppeth setup wizard

Users can also create genesis JSON file by using puppeth setup wizard. puppeth binary is built when you build the whole suite by running “make all”. The wizard will run through a few steps. it will guide you to set up genesis config which otherwise you have to create manually, for example via a template. Start the wizard from the command line,

# puppeth

Please specify a network name to administer (no spaces or hyphens, please)

> thunder

What would you like to do? (default = stats)

1. Show network stats
2. Configure new genesis
3. Track new remote server
4. Deploy network components
> 2

Which consensus engine to use? (default = thunder)

1. Ethash — proof-of-work
2. Clique — proof-of-authority
3. Thunder — thundercore
> 3

Which accounts should be pre-funded? (advisable at least one)

> 0x8ddf4f3e475f5b5f10ec5bf3452f94830e9d2ce9

Specify your chain/network ID if you want an explicit one (default = random)

> 3606What would you like to do? (default = stats)
1. Show network stats
2. Manage existing genesis
3. Track new remote server
4. Deploy network components
> 21. Modify existing fork rules
2. Export genesis configuration
3. Remove genesis configuration
> 2

Which file to save the genesis into? (default = ThunderLocal.json)

> thunder.json

Then, you can move to next step.

3.2.2 Initialize the chain

# build/bin/thunderlocal init thunder.json --datadir ./datadir

3.3 Start the chain

# build/bin/thunderlocal --datadir ./datadir --networkid 3606 --rpc  --rpcport “8545” --rpccorsdomain “*” --rpcapi “db,eth,net,miner,web3,personal” --nodiscover --mine

Now, you are good to go! Try to send some transactions or deploy smart contracts. Also, please note that command line option “ — mine” will start generating blocks. New blocks are generated in roughly 1-second intervals. You can pause or restart the block generation via thunderlocal console commands, which are described below.

3.4 Interactive Javascript console

# build/bin/thunderlocal attach

3.4.1 Some useful console commands

List accounts
# eth.accounts
Create a new account
# personal.newAccount
Get account balance
# eth.getBalance(<account address>)
Unlock account
# personal.unlockAccount(<account address>)
Start generating blocks
# miner.start()
Stop generating blocks
# miner.stop()
Get block information
# eth.getBlock(<block number>)
# eth.getBlock("latest")

4 Reset the chain:

In case you want to reset the chain, you can stop the existing process and delete the “geth” directory.

# rm -rf datadir/geth

Then, return to step 3.2.2 above to restart the chain

Please let us know if you encounter any issues and send us your feedback. We hope you enjoy the new local chain functionality; we believe this key feature is essential to the development experience.


Real Blockchain. Real Benefits.

Changzheng Liu

Written by


Real Blockchain. Real Benefits.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade