Skip to content

UseCases_regtest_Start regtest

BytzCK edited this page Nov 17, 2021 · 4 revisions

Use Cases, Scenarios, Walkthroughs - for regtest

Case "Start Regtest"

Scenario: Testing tokens on regtest

Feature: The Regtest network allows users to mine blocks on demand

Actor: A regtest network user

Summary:

The Regtest network allows a user to create its own local network. Nodes that are started in regtest mode do not automatically connect to other nodes. Nodes also do not automatically create new blocks. Instead, blocks are generated (both in the PoW and in the PoS phase) using the command generate [nr_of_blocks]. The BYTZ Regtest network is configured to start with 280 blocks in the PoW phase and then switch to PoS.

Preconditions:

  • The bytz client is installed
  • The bytz client is configured

Steps:

To start a node in regtest mode, the node needs to be started with the flag -regtest=1. Also, a node cannot both have -regtest=1 and testnet=1, so one needs to be sure that bytz.conf does not have testnet=1 set. Additionally, when using bytz-cli, the same parameter -regtest=1 needs to be passed. This parameter can be passed either on the command line or through editing ioncoin.conf.

The following commands should start a daemon on the Regtest network:

# start daemon in regtest modus, ensure the chain and transaction history are reset, enable debug logging, enable background mode
$ bytzd -regtest=1 -resync=1 -zapwallettxes=1 -debug=1 -daemon=1
BYTZ server starting

# view the status
$ bytz-cli -regtest=1 getnetworkinfo
{
  "version": 20001,
  "buildversion": "v0.2.0.1-2f804c7d5",
  "subversion": "/BYTZ Core:0.2.0.1/",
  "protocolversion": 70918,
  "localservices": "0000000000000405",
  "localrelay": true,
  "timeoffset": 0,
  "networkactive": true,
  "connections": 0,
  "socketevents": "epoll",
  "networks": [
    {
      "name": "ipv4",
      "limited": false,
      "reachable": true,
      "proxy": "",
      "proxy_randomize_credentials": false
    },
    {
      "name": "ipv6",
      "limited": false,
      "reachable": true,
      "proxy": "",
      "proxy_randomize_credentials": false
    },
  ],
  "relayfee": 0.00010000,
  "incrementalfee": 0.00001000,
  "localaddresses": [
    {
      "address": "x.x.x.x",
      "port": 47526,
      "score": 1
    },
    {
      "address": "::",
      "port": 0,
      "score": 4
    }
  ],
  "warnings": ""
}

# stop the bytz regtest daemon
$ bytz-cli -regtest=1 stop
BYTZ server stopping

# start daemon in regtest modus, use existing chain if it exists, enable debug logging, enable background mode
$ bytzd -regtest=1 -debug=1 -daemon=1
BYTZ server starting

# Mine 300 blocks on Regtest, bringing the chain to the PoS phase.
$ bytz-cli -regtest=1 generate 300

  • The same can be achieved by running the bytz Qt wallet.
  • The parameter -regtest=1 can be moved to bytz.conf as regtest=1.

Postconditions:

  • A running Regtest node.
  • A chain with 300 blocks.
    • Entered PoS phase
    • Moved past the TokenStart block height

Related use cases:

  • Case "Install and configure new client"
Clone this wiki locally