How to start a new blockchain – challenges that need to be considered
If you ever wanted to start a new blockchain you probably wondered what challenges come with a setup of your own blockchain, we have some experience to share with you. In this article, you will read about attacks performed with low effort on different blockchains you need to protect against; about features you should implement and learn how to preserve the state of the network when migrating to new codebase what we did when joining Exchange Coin team.
51% attacks on new blockchains – how to start a new blockchain that is resistant to it?
Blockchains, based on Proof-of-Work – such as Bitcoin, operate on a network of computers that performs costly work, which is assumed to protect the blockchain itself. The problem surfaces when one of the nodes obtains more than half of the computing power in the network. While this attack is not feasible for popular coins because of its high cost, it turns out to be relatively easy to do in case of immature blockchains where total hashing power is low. The attacker can reverse a transaction by rewriting recent blocks history after the other party assumed that transaction happened and credited the deposit.
A few examples of successful 51% attacks on blockchains:
More resources can be found here:
- https://en.bitcoin.it/wiki/Majority_attack
- https://blockonomi.com/51-attack-calculator/
- https://thenextweb.com/hardfork/2018/05/24/proof-work-51-percent-attacks/
Estimated costs of performing 51% attacks on new coins
The attacks on a big network like Bitcoin are considered highly unlikely because of high costs, but it is different when someone wants to attack a small/new blockchain. According to recent research, the per hour cost rate of the 51% oattacks is relatively low. For example, it takes about 3000$/hour to attack Bitcoin Gold, not to mention mining rewards.
If you want to learn more about the costs of 51% attacks, check this article here.
Prevention to the 51%attacks
There are two approaches to 51% attack prevention. The first one featured, for example, by the Komodo Decred project, calls this algorithm a hybrid proof-of-work (PoW) proof-of-stake (PoS) consensus voting system.
In the case of the Exchange Coin project, we used the hybrid PoW + PoS algorithm featured in Decred because we believed this is the cleanest approach to this problem that rewards coin owners.
Check Decred documentation to learn more: https://docs.decred.org/research/hybrid-design/
Analysis of potential consequences of changing chain parameters (game theory of cryptocurrency)
Starting a new blockchain presents an opportunity to specify all of the parameters and behaviors. These decisions are not easy and should be approved by the coin community. Using Exchange Coin as an example, you can point out some changes which happened after moving to the new codebase. Not to mention the PoS system, the whole reward (subsidy) program was changed. Before, EXCC was based on a reward halving every 18 months, but now it is reduced by 3% every 4 weeks. Going deeper, you could notice that Equihash parameters were changed to be ASICs resistant. Normally that type of change would cause a hard fork, that is why they should be considered very carefully because the community of blockchain has the right to not accept the new situation and leave the network. As you can see, the question of how to start a new blockchain might be tricky since you need to consider multiple aspects related to the blockchain game theory.
How to start a new blockchain and how to build the entire infrastructure around it?
Blockchain data, at the start, are distributed among all nodes in the network, and it is visible only to those who participate by running light or full nodes. When setting up the infrastructure for a new blockchain, you can not forget about the rest of the world and share some data with it. Blockchain explorer is the most desired tool by the coin community (there are some individuals who think if explorer is down, then blockchain is down). What is more, there is no good blockchain without a mining pool (and/or a stake pool). Setting up pools helps to distribute work and mine coins to the whole community, which includes participants with small computing power and balances.
Migration of an old chain
This is something that may not answer the question of how to start a new blockchain but it is a scenario which actually happened with Exchange Coin. Sometimes an organization that stands behind a specific blockchain wants to migrate to a new codebase for diverse reasons. Regardless of the approach, doing a new project or forking an existing one, developers need to keep compatibility with the old chain.
One of the most critical things from the user perspective is maintaining compatibility of the wallets and seamless migration of their funds to the new blockchain. There are several aspects to this:
HD wallets (mnemonic codes and derivation paths)
In order to let users restore their old wallets with mnemonics they already have, the new code needs to rely on the same word dictionary, derivation paths and address scheme.
WIF format
WIF is a special representation of Private Key which has a shorter format and includes a checksum so it can be verified if there are no mistakes. Additionally, WIF format is encoded in base58, which omits similar-looking signs like “O”, “0”, “I” and “l”. After all, it prevents many failures done by users when moving/exporting/importing private keys.
Same cryptographic algorithms
It is important to use the same hashing functions and elliptic curve algorithms to keep compatibility with address generation and signatures.
Performing a snapshot of an old chain and starting a new one
Moving blockchain from legacy to new coinbase requires taking care of user accounts balances. One of the possible several but convenient solutions is scanning all transactions from block 0 to the latest one and calculating the balances of all affected accounts. Snapshots created that way should be included in a set of pre-mined balances.
We hope that this description of the few challenges we recently faced during our work on Exchange Coin will help you answer the question of how to properly start a new blockchain.
If you wonder if it is worth building your own cryptocurrency exchange from scratch or using white label solution read this article >>