Bootstrapping a New Microcurrecy

Technical discussion about nodes, wallets, transfers, miners, etc.
Post Reply
mqpickens
Posts: 48
Joined: Sat Jun 04, 2022 11:38 pm

Bootstrapping a New Microcurrecy

Post by mqpickens »

This will .... It assumes there is a white paper all prepared

Generate a Genesis Block (Linux/Debian 11+ Bash Commands) Note: This may take a few attempts and several hours.
  • sudo apt-get -y update
  • sudo apt-get -y upgrade
  • sudo apt-get -y install git-core python3
  • cd ~/genesis
  • python3 genesis.py -z "Local newspaper of the day TODAY'S DATE Something interesting that happened"
  • #When finished, store the output somewhere for safe keeping
Create Header File
  • In the bitcoin repository (microcurrency edition) @ https://github.com/satoshiware/bitcoin
    • Create the file "./src/micros/micro_$NAME.h". This is not mandatory; it makes for convenient referencing.
      • Use another file in that same directory as an example.
      • Paste the output of the genesis.py program as a block comment.
      • Update all parameters according the microcurrency's white paper and the genesis block.
      • Generate some random bytes and update the "Magic bytes" section of the file.
    • Make a copy of the "micro_$NAME.h" file and place it in the "./src" directory with the name "micro.h".
      • This is in preparation for (manually) compiling the program for the new micro.
      • It may not be necessary when compiling using script automation (depends on the script).
Create Binary Files Create and Run Two Nodes (minimum) Create & Configure the bitcoin.conf File (on both/all nodes)
  • bitcoind -micro -daemon #Run bitcoind if it isn't already. This will create the ".bitcoin" directory and sub directories.
  • bitcoin-cli -micro stop #Stop bitcoind From Running
  • echo "server=1" > ./.bitcoin/bitcoin.conf
  • echo "rpcuser=USER" >> ./.bitcoin/bitcoin.conf #Consider a sensible user name with a strong password.
  • echo "rpcpassword=PASSWD" >> ./.bitcoin/bitcoin.conf
Run bitcoind with maxtipage (on both/all nodes)
In order to run bitcoind on a blockchain with the latest block (including the genesis) older than 24 hours,
you'll need to use the maxtipage option with the appropriate amount of time set. Adjust it accordingly.
Otherwise, the connecting application (e.g. minerd) will get an "RPC 500 Internal Server Error".
  • bitcoind -micro -daemon -maxtipage=1000000 #Maximum time (in seconds) that can pass from previous block (default = 24 hours)
Connect Both/All Nodes Generate First Address (for mining)
  • bitcoin-cli -micro createwallet "firstwallet"
  • bitcoin-cli -micro unloadwallet "firstwallet"
  • bitcoin-cli -micro listwallets
  • bitcoin-cli -micro loadwallet "firstwallet" true
  • bitcoin-cli -micro getnewaddress
  • #Record the outputted address... it will be used for initial mining. "Keep it secret; Keep it safe."
Install CPU Miner (on both/all nodes)
  • sudo apt-get -y install make libcurl4-openssl-dev git autotools-dev automake build-essential
  • cd cpuminer
  • ./autogen.sh
  • ./configure CFLAGS="-O3"
  • make clean
  • make
  • cd ..
Run CPU Miners (on both/all nodes)
  • ~/cpuminer/minerd -B -o 127.0.0.1:$PORT -a sha256d -u USER -p PASSWD --coinbase-addr=$ADDRESS
    • Default RPC port: 19332
    • Use previously generated $ADDRESS
  • pidof minerd #Command to see if there is minerd process running.
  • pkill minerd #Command to stop minerd.
Last edited by mqpickens on Tue May 09, 2023 10:41 pm, edited 1 time in total.
mqpickens
Posts: 48
Joined: Sat Jun 04, 2022 11:38 pm

Add/Remove/Manage Node Connections (Not Secure)

Post by mqpickens »

Here are some basic Linux commands (tested on Debian 11+) for managing peer connections with other nodes.
Note: This setup is not secure! It may be great for bootstrapping a new microcurrency, but the young network will need to adopt
secure tunneling soon! With regards to external factors such as network configuration, enforcing static IP addresses,
router port forwarding, etc., Network Chuck's Youtube channel is highly recommend for this kind of information!

Add Node
  • btc addnode $IP:$PORT "add" #default port: 19333
  • sudo ufw allow from $IP to any port $PORT #default port: 19333
  • sudo ufw reload #Reload UFW rules
Remove Node
  • btc addnode $IP:$PORT "remove" #default port: 19333
  • sudo ufw delete allow from $IP to any port $PORT #default port: 19333
  • sudo ufw reload #Reload UFW rules
UFW: Manage Node Connections
  • netstat -nputw #See what processes are listening on on what ports
  • sudo ufw enable/disable #Turn Firewall on/off
  • sudo ufw status #Check if UFW is active; list rules
  • sudo ufw status numbered #List associated numbers for each UFW rules
  • sudo ufw delete #RULENUM #Remove rule by its associated number
bitcoind: Manage Node Connections
  • btc getaddednodeinfo #See what nodes are added and if connected
  • btc getpeerinfo #See if anyone else is connected

Note: Without some sort of automation, each time Bitcoin Core (micro mode) restarts you will need to add the nodes again:
  • btc addnode IP1:PORT1 "add" # NAME1
  • btc addnode IP2:PORT2 "add" # NAME2
  • btc addnode IP3:PORT3 "add" # NAME3
  • .............................................
  • btc addnode IPn:PORTn "add" # NAMEn
Post Reply