HowTo run AlphaNet

From Veriblock Wiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See: AlphaNet

Overview

When developing, it is helpful to run a local node with low difficulty and fast sync time. The AlphaNet allows this.

AlphaNet is separate from TestNet or MainNet... nodes do not talk across different networks, and coins cannot be sent from one network to the other. Alpha coins are intended for local development purposes.

AlphaNet uses port 7502 and 10502

This article assumes familiarity with NodeCore, including: NodeCore_QuickStart (has download instructions), HowTo_run_NodeCore, NodeCore_Networking

How to run alpha locally

Start NodeCore

Set nodecore.properties:

#NodeCore Configuration
#set network to alpha and do not pull any bootstrap nodes
network=alpha
peer.bootstrap.enabled=false

#Allow a CPU pool so that we can mine and get new blocks
pool.stats.bind.address=0.0.0.0
ucp.mining.bind.address=0.0.0.0

If you wanted to set up a network of multiple nodes in alpha, you can still explicitly add nodes:

peer.external.hosts.alpha=<ip_of_node>\:7502

Have just these 3 files in the bin folder (delete any previous "alpha" folder if it existed)

  • nodecore
  • nodecore.bat
  • nodecore.properties

Run NodeCore

This should create an "bin\alpha" folder (instead of a bin\testnet or bin\mainnet folder)

Connect via the NC_CLI

Alpha runs on port 10502 (instead of 10501 or 10500)

So connect to a local alpha instance via:

connect 127.0.0.1:10502

Run getstateinfo

  "network_version": "Alpha",

Run a CPU miner to get coins

In the NC_CLI, start a CPU pool

#Allow a CPU pool
startpool CPU

Run the PoW CPU Miner (part of the nodecore suite). See: HowTo_run_PoW_CPU_Miner. This will require 3 inputs:

  • Number of threads --> hit [ENTER] to accept default
  • Address/Port --> hit [ENTER] to accept default of connecting to local host
  • Address --> use any address, such as the result of getinfo in the NC_CLI

NOTE: If for some reason the CPU Miner gets stuck (block height is not increasing), then restart the CPU Miner.

Bootstrapping with current Bitcoin testnet block

To change out the starting bitcoin testnet block, get the values from the VeriBlock PoP miner using getlastbitcoinblock

Output:

 > getlastbitcoinblock
Block hash: 000000001fd874b858bf940102e1a8816b105b5eb30685ba1ded235117e16848
Block height: 1576454
Block header: 0000002037D955FA58D1E487CB3979CD0109185D292B44D4DF319A7277443408000000009C67028FA173C9EE0E4461E611A764252E3D474390747EC444B66322DCF31589295B695DFFFF001DBD329854
   INFO: (2019-08-30 13:27:20) [V200] Success
         000000001fd874b858bf940102e1a8816b105b5eb30685ba1ded235117e16848 @ 1576454: 0000002037D955FA58D1E487CB3979CD0109185D292B44D4DF319A7277443408000000009C67028FA173C9EE0E4461E611A764252E3D474390747EC444B66322DCF31589295B695DFFFF001DBD329854

Use the following script with the hash of the latest bitcoin testnet block:

output=( $( curl -s  https://testnet.blockchain.info/rawblock/$1 |  jq -r  '.time, .bits, .mrkl_root, .ver, .nonce, .prev_block, .height' ) )
echo "bitcoin.configured=true"
echo "initial.bitcoin.timestamp=${output[0]}"
echo "initial.bitcoin.difficulty=${output[1]}"
echo "initial.bitcoin.merkle=${output[2]}"
echo "initial.bitcoin.version=${output[3]}"
echo "initial.bitcoin.nonce=${output[4]}"
echo "initial.bitcoin.previous=${output[5]}"
echo "initial.bitcoin.height=${output[6]}"

Usage: ./script 000000001fd874b858bf940102e1a8816b105b5eb30685ba1ded235117e16848

Output:

bitcoin.configured=true
initial.bitcoin.timestamp=1567185705
initial.bitcoin.difficulty=486604799
initial.bitcoin.merkle=8915f3dc2263b644c47e749043473d2e2564a711e661440eeec973a18f02679c
initial.bitcoin.version=536870912
initial.bitcoin.nonce=1419260605
initial.bitcoin.previous=0000000008344477729a31dfd4442b295d180901cd7939cb87e4d158fa55d937
initial.bitcoin.height=1576454

Add the above inside nodecore.properties and restart NodeCore, it also may require that you remove the alpha directory from your data directory and start a new AlphaNet chain.

End Result

If everything is successful, the following will all be running locally:

  1. NodeCore is running.
    1. Block height is increasing.
    2. A folder "bin\alpha" has been created
  2. NC_CLI is running, and run getinfo to see latest block and balance. Run any command from the NodeCore_CommandLine
  3. PoW CPU miner is running, submitting shares