Thought

Phil's Quickstart Guide to Installing a Thought Node on Linux


This guide provides the steps necessary to install a Thought blockchain node on a Linux host, and optionally to configure the node as a Thought masternode.

The instructions below assume that the Linux host is configured for remote SSH access, and that all installation and setup will be done via command-line interface. The examples shown assume a configuration similar to Ubuntu 20.04 Server running on an AWS instance.

Recommended Minimum Specifications

Basic Node Installation

Step 1: Configure Swap Space

If your Linux host has less than 4GB of RAM, and does not already have swap space configured, you should configure swap space before attempting to run the Thought node software.

  1. Allocate a file to mount as swap space.

    sudo fallocate -l 4G /swapfile
  2. Set the proper permissions on the swap file.

    sudo chmod 600 /swapfile
  3. Create the Linux swap filesystem in the allocated file.

    sudo mkswap /swapfile
  4. Mount the swap file.

    sudo swapon /swapfile
  5. Add the swap file to the file system table so that it is re-mounted on reboot. Edit the file using nano or another text editor.

    sudo nano /etc/fstab

    Add the following line at the end of the file

    /swapfile swap swap defaults 0 0

    Save and exit the file.

Step 2: Install the Thought Node Software

  1. The Thought wallet/node software binary distribution can be directly downloaded to your Linux host using the wget utility.

    wget https://github.com/thoughtnetwork/thought-wallet/raw/master/linux/thought-0.18.3/thoughtcore-0.18.3-x86_64-pc-linux-gnu.tar.gz
  2. Once the file is finished downloading, unpack the file in your home directory.

    tar xvfz thoughtcore-0.18.3-x86_64-pc-linux-gnu.tar.gz

    This will create a folder in your home directory named thoughtcore which contains the Thought node/wallet software.

    After the archive is unpacked, you can delete the thoughtcore-0.18.3-x86_64-pc-linux-gnu.tar.gz file.

  3. It is recommended to add the directory containing the Thought binaries to your path.

    Update your path by editing the .bashrc file:

    nano ~/.bashrc

    At the bottom of the file, add the following line:

    export PATH=$PATH:~/thoughtcore/bin
  4. Save and exit the editor, then use the following command to add the path to your environment:

    source ~/.bashrc

Step 3 (Optional): Download the Blockchain

The Thought node will need to acquire a copy of the Thought blockchain when it is first executed. The node will do this on its own, but synchronizing with the chain can take time (from 2 up to about 8 hours, depending on network and hard drive speed). This process can be speeded up by downloading a compressed blockchain backup from this website.

  1. Create the Thought node configuration and data directory.

    mkdir ~/.thoughtcore
  2. Change to the directory you just created

    cd ~/.thoughtcore
  3. Download the blockchain file using the wget command.

    wget https://idea-01.insufficient-light.com/data/thought-chain.tar.gz

    Note: The blockchain archives can also be downloaded from this page to your local machine for use in setting up your local wallet.

    New archives will be posted approximately monthly, so the sync time for the node/wallet will be significantly reduced.

    Latest Archive: 03 August 2024

    Archive files contain the blocks, chainstate, and evodb directories. Unpack the archive in the Thoughtcore configuration directory on the node, i.e. ~/.thoughtcore on Linux, C:/Users/name/AppData/Thoughtcore on Windows.

  4. Unpack the archive.

    tar xvfz thought-chain.tar.gz

    After the archive is unpacked, you can delete the thought-chain.tar.gz file.

Step 4: Run the Node

  1. Execute the Linux daemon version of the Thought node.

    thoughtd -daemon
  2. Check the synchronization status of the daemon. If you downloaded the blockchain archive as in step 3, the synchronization should complete within a few minutes.

    thought-cli mnsync status

Step 5: Configure Services

  1. Set up a service descriptor for the Thought daemon so it starts on reboot.

    sudo nano /etc/systemd/system/thoughtd.service

    Paste the following content into the new file, substituting the appropriate user name and directory if you are not using ubuntu:

    [Unit]
    Description=Thought Daemon
    After=network.target
    
    [Service]
    ExecStart=/home/ubuntu/thoughtcore/bin/thoughtd -daemon -port=10618 -conf=/home/ubuntu/.thoughtcore/thought.conf -pid=/run/thoughtd/thoughtd.pid
    RuntimeDirectory=thoughtd
    User=ubuntu
    Type=forking
    PIDFile=/run/thoughtd/thoughtd.pid
    Restart=on-failure
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target             
                  

    Stop the Thought daemon and restart it using systemctl:

    thought-cli stop
    sudo systemctl daemon-reload
    sudo systemctl start thoughtd

    Check the status of the daemon.

    sudo systemctl status thoughtd

    Enable the service to restart on reboot:

    sudo systemctl enable thoughtd
  2. Enable log rotation. The Thought daemon writes database and debug logs into the ~/.thoughtcore directory. Over time, these can grow quite large. The logrotate utility will compress the logs daily to reduce space usage, and remove old logs.

    Create a logrotate configuration file for the Thought daemon.

    sudo nano /etc/logrotate.d/thoughtd

    Paste the following code into the new file, substituting the appropriate user name and directory if you are not using ubuntu:

    /home/ubuntu/.thoughtcore/debug.log {
    rotate 12
    daily
    compress
    missingok
    notifempty
    maxsize 100k
    minsize 20k
    create 640 ubuntu ubuntu
    postrotate
    systemctl restart thoughtd
    endscript
    }
    
    /home/ubuntu/.thoughtcore/db.log {
    rotate 12
    daily
    compress
    missingok
    notifempty
    maxsize 100k
    minsize 20k
    create 640 ubuntu ubuntu
    postrotate
    systemctl restart thoughtd
    endscript
    }

Step 6: Protect Your Wallet

Your new node has its own wallet data file that should be protected, especially if you intend to convert this node to a Thought Masternode.

  1. Edit the Thought daemon configuration file.

    nano ~/.thoughtcore/thought.conf

    Paste the following content into the file. Replace the xxx values with appropriate values for your node.

    Note that the rpcuser and rpcpassword parameters here do not refer to any outside user and password, they are the user and password information that RPC clients will use to connect to this node.

    server=1
    rpcuser=xxx
    rpcpassword=xxx

    Save and exit the file, then restart your Thought daemon.

    sudo systemctl restart thoughtd
  2. Encrypt your wallet.

    thought-cli encryptwallet "My secret passphrase here"

    Protect and remember this passphrase. There is no recovery path if you lose or forget it.

  3. Back up your wallet. The name can be any valid Linux filename. It probably shouldn't contain spaces.

    thought-cli backupwallet ~/my-wallet-backup.dat

    It is highly recommended that you copy this wallet backup to a local computer or external media you control, in case of failure of your virtual node. You can use the WinSCP, PuTTY, or scp utilities to copy the file to your local computer.

Congratulations! You now have a fully-operational Thought node, suitable to be converted to a masternode. Read on for masternode setup instructions.

Deterministic Masternode Setup

The following steps show how to create a Thought Deterministic Masternode. These instructions assume you have created a node similar to the one detailed in the above section. These instructions are based on the official Thought masternode documentation found at https://github.com/thoughtnetwork/thought-docs/blob/master/deterministic_masternodes.md

Note: I strongly recommend keeping a notes file open during the execution of the following steps, and copying/pasting the commands and their outputs into the notes file. This will both make it easier to avoid typographical errors, and to make changes to your masternode configuration later if you have these notes to refer back to. My personal preference is to keep a file called masternode.txt in the home directory of the masternode.

Step 1: Prepare Thought Node for Conversion

  1. Generate a private key for your masternode.

    thought-cli masternode genkey

    Note this code to insert into your Thought daemon configuration file in the next step.

  2. Generate a BLS key pair.

    thought-cli bls generate

    You will see output similar to the following:

    { "secret": "565950700d7bdc6a9dbc9963920bc756551b02de6e4711eff9ba6d4af59c0101",
    "public": "01d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127" }

    Note this output - you will use both values in subsequent steps

  3. Edit the Thought daemon configuration file.

    nano ~/.thoughtcore/thought.conf

    If you already have content in thought.conf, update it to the following, otherwise paste the following content into the file. Replace the xxx values with appropriate values for your node.

    Note that the rpcuser and rpcpassword parameters here do not refer to any outside user and password, they are the user and password information that RPC clients use to connect to this node.

    Replace the xxx in masternodeprivkey with the key you generated in step 1.

    Replace the xxx in masternodeblsprivkey with the "secret" portion of the BLS key you generated in step 2.

    The IP address must be an externally-accessible address, so firewall/security settings may need to be adjusted.

    server=1
    rpcuser=xxx
    rpcpassword=xxx
    masternode=1
    masternodeprivkey=xxx
    masternodeblsprivkey=xxx 
    externalip=xxx:10618

    Save and exit the file, then restart your Thought daemon.

    sudo systemctl restart thoughtd

Step 2: Send Masternode Stake and Transaction Fee to the Masternode Wallet

  1. Send your masternode stake transaction. You must send exactly 314,000.00 THT in a single transaction to an address in this node's wallet. Generally you would do this from your local wallet by using the GUI controls, or if the wallet you are sending from is non-GUI, by using thought-cli sendtoaddress [masternode stake address] 314000.

    Generate the new masternode stake address on your masternode with the following command:

    thought-cli getnewaddress

    Note this address (In my notes file, I would label this Stake Address).

    Note: if you are sending from a mining wallet you may need to consolidate mining coinbase transactions into larger inputs such as sets of 100,000 THT prior to sending the masternode stake transaction.

  2. Send your masternode transaction fee. You must have a small amount of THT in an address in this node's wallet, from which the masternode registration transaction fee will be paid. 1 or 2 THT will be plenty. Use a separate address from the one you sent the stake amount to. Generally you would do this from your local wallet by using the GUI controls, or if the wallet you are sending from is non-GUI, by using thought-cli sendtoaddress [masternode fee address] 2.

    Generate the new masternode fee address on your masternode with the following command:

    thought-cli getnewaddress

    Note this address (In my notes file, I would label this Fee Address).

Step 3: Prepare the Masternode Registration Transaction

Now the time has come to gather the remaining information needed to create the Masternode Registration transaction.

  1. Get the stake transaction information. On the masternode, use the following command to get the information for the stake transaction you sent:

    thought-cli masternode outputs

    If the transaction you sent to the stake address has been included in a block and has a few confirmations, you should get an output that has the transaction ID and the output index of the masternode stake. Note these values.

  2. Generate an owner address. This address identifies the owner of the masternode. It must be different from the stake address and fee address.

    thought-cli getnewaddress

    Note this address (In my notes file, I would label this Owner Address).

  3. Generate or choose an address to receive masternode payments. This address can be in the masternode wallet, which means that coins earned by this masternode would accumulate in the masternode's wallet. More commonly, this address can come from another wallet, such as your local wallet, so that earnings go to that wallet, and the masternode wallet only holds the stake amount.

    If you are going to use an address in the masternode wallet:

    thought-cli getnewaddress

    If you are going to use an address in a different wallet, use either the GUI or thought-cli on that wallet to generate the new address.

    Note this address (In my notes file, I would label this Payment Address).

  4. Unlock your wallet.

    If you encrypted your masternode wallet as recommended in the setup instructions above, you must unlock it to be able to execute the next few instructions. Unlock the wallet using the following command:

    thought-cli walletpassphrase "My secret passphrase here" 600

    This will unlock your masternode wallet for 10 minutes, giving you time to complete the next few steps.

  5. Prepare the Registration Transaction. Generally I recommend creating the command in your notes file first, then copying/pasting to the command line. The command takes the following form:

    thought-cli protx register_prepare collateralHash collateralIndex ipAndPort ownerKeyAddr operatorPubKey 
    votingKeyAddr operatorReward payoutAddress feeSourceAddress

    The argument placeholders in the command should be replaced with the following values:

    The finished command should look similar to this:

    thought-cli protx register_prepare 2c499e3862e5aa5f220278f42f9dfac32566d50f1e70ae0585dd13290227fdc7 1 140.82.59.51:9999 
    yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz 01d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732
    ab4a461bd127yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz 0 ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy ewFyp1AMngeRHBwyycBFJGv7V95aSs6XvM

    Once you have created the command in your notes, copy and paste the command on the command line. The output should resemble the following:

    { "tx": "030001000191def1f8bb265861f92e9984ac25c5142ebeda44901334e304c447dad5adf6070000000000feffffff0121dff505000000001976a9149e2deda2452b57e999685cb7dabdd6f4c3937f0788ac00000000d1010000000000c7fd27022913dd8505ae701e0fd56625c3fa9d2ff47802225faae562389e492c0100000000000000000000000000ffff8c523b334e1fad8e6259e14db7d05431ef4333d94b70df1391c601d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127ad8e6259e14db7d05431ef4333d94b70df1391c600001976a914adf50b01774202a184a2c7150593442b89c212e788acf8d42b331ae7a29076b464e61fdbcfc0b13f611d3d7f88bbe066e6ebabdfab7700", 
    "collateralAddress": "yPd75LrstM268Sr4hD7RfQe5SHtn9UMSEG", 
    "signMessage": "ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy|0|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|54e34b8b996839c32f91e28a9e5806ec5ba5a1dadcffe47719f5b808219acf84" }

    Note this output.

Step 4: Sign the Masternode Registration Transaction

We will use the collateralAddress and signMessage fields of the output of the last command to generate a signed message.

thought-cli signmessage collateralAddress signMessage

The argument placeholders in the command should be replaced with the following values:

The finished command should resemble the following:

thought-cli signmessage yPd75LrstM268Sr4hD7RfQe5SHtn9UMSEG "ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy|0|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|54e34b8b996839c32f91e28a9e5806ec5ba5a1dadcffe47719f5b808219acf84"

Once you have created the command in your notes, copy and paste the command on the command line. The output should resemble the following:

IMf5P6WT60E+QcA5+ixors38umHuhTxx6TNHMsf9gLTIPcpilXkm1jDglMpK+JND0W3k/Z+NzEWUxvRy71NEDns=

Note this output.

Step 5: Send the Masternode Registration Transaction

We will use the tx field of the register_prepare command above along with the signature generated in the last step to transmit the Masternode Registration transaction. The command takes the following form:

thought-cli protx register_submit tx sig

The argument placeholders in the command should be replaced with the following values:

The finished command should resemble the following:

thought-cli protx register_submit 030001000191def1f8bb265861f92e9984ac25c5142ebeda44901334e304c447dad5adf6070000000000feffffff0121dff505000000001976a9149e2deda2452b57e999685cb7dabdd6f4c3937f0788ac00000000d1010000000000c7fd27022913dd8505ae701e0fd56625c3fa9d2ff47802225faae562389e492c0100000000000000000000000000ffff8c523b334e1fad8e6259e14db7d05431ef4333d94b70df1391c601d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127ad8e6259e14db7d05431ef4333d94b70df1391c600001976a914adf50b01774202a184a2c7150593442b89c212e788acf8d42b331ae7a29076b464e61fdbcfc0b13f611d3d7f88bbe066e6ebabdfab7700 
IMf5P6WT60E+QcA5+ixors38umHuhTxx6TNHMsf9gLTIPcpilXkm1jDglMpK+JND0W3k/Z+NzEWUxvRy71NEDns=

Once you have created the command in your notes, copy and paste the command on the command line. The output should resemble the following:

9f5ec7540baeefc4b7581d88d236792851f26b4b754684a31ee35d09bdfb7fb6

Note this output. This is the transaction ID of your Masternode Registration transaction. If you wish to modify the parameters of your masternode at some later time (for example, change the address that masternode payments go to, or designate a different voting authority), you will need this ID.

Step 6: Verify Masternode Activation

Once the Masternode Registration transaction has been mined into a block, your masternode will be active.

You can check the status of the masternode using the following command:

thought-cli masternode status

You can verify that it is in the list of masternodes using the following command:

thought-cli masternode list

You can also see your masternode in the Thought wallet GUI, by activating the Masternodes tab in Settings->Options->Wallet

Technical Support

The best place to get support for your Thought node/masternode/mining question is the Thought Discord Server. Join us there!