Monthly Archives: July 2017

Install Ubuntu 16.04, CUDA 8.0 and EwbfMiner for zCash mining with nVidia GPU


// Install Ubuntu Server 16.04.2

// On OK go next

// Set static IP by editing: /etc/network/interfaces

$ cd /etc/network

$ sudo nano interfaces

// Change from:

auto lo

iface lo inet loopback


auto enp2s0f0 (name of interface)

iface enp2s0f0 inet dpch

// Change to:

auto lo

iface lo inet loopback


auto enp2s0f0 (name of interface)

iface enp2s0f0 inet statis





// Save and exit.


// Change default SSH port:

$ cd /etc/ssh

$ sudo nano sshd_config

// Change Port 22 into Custom Port.

// OK: now the server can be access remotely by SSH at

// Reboot server (for static IP get effect):

$ sudo nano reboot


// Install CUDA to support nvidia graphic cards

// Instruction (

// Verify You Have a CUDA-Capable GPU

$ lspci | grep -i nvidia

// Verify the system has gcc installed

$ gcc –version

// If not installed yet. Then install it:

$ sudo apt install gcc

// ok with gcc 5.4.0

// Verify the system has the correct Kernel Headers and Development Packages installed

$ uname -r

// (if not installed) The kernel headers and development packages for the currently running kernel can be installed with:

$ sudo apt-get install linux-headers-$(uname -r)


// Now download cuda at –> Menu: Linux > x86_64 > Ubuntu > 16.04 > deb (local)

$ mkdir apps && cd apps

$ wget

// Install repository meta-data (unpack):

$ sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb

// Update the Apt repository cache

$ sudo apt-get update

// Install CUDA

$ sudo apt-get install cuda

// on ok go next


// Post CUDA installation actions:

// Environment Setup (must do)

$ sudo nano .profile

// The PATH variable needs to include /usr/local/cuda-8.0/bin

// To add this path to the PATH variable in .profile:





// OK


// To install the Display Driver, the Nouveau drivers must first be disabled.

// Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

$ cd /etc/modprobe.d

$ sudo nano blacklist-nouveau.conf

// Add 2 below lines:

blacklist nouveau

options nouveau modeset=0

// Save and exit file editing.


// Install nVidia Toolkit and Drivers

$ sudo apt install nvidia-cuda-toolkit

// Check if driver of nvidia GPU is installed correctly:

$ nvidia-smi

// OK


// Install ewbfminer:

// Source:

$ mkdir ewbfminer && cd ewbfminer

$ wget

// Unzip and Install downloaded file in ewbfminer folder:

$ tar -xzf Zec.miner.0.3.4b.Linux.Bin.tar.gz

// Config ewbfminer in miner.cfg

$ sudo nano miner.cfg

# main server



port   4444

user   xxxUser.worker

pass   password


#additional server 1



port   3357

user   xxxAddress.worker

pass   password

// Config to include only below line:

$ sudo nano

./miner –config miner.cfg

// Save and exit

// OK


// Run ewbfminer:

$ cd apps/ewbfminer

$ ./

// Run ewbfminer inside screen session to allow closing current ssh terminal:

$ screen

$ cd apps/ewbfminer

$ ./

$ Ctrl-A   -then-  d  (to exit ‘screen’ session)

// Close ssh terminal



Screen – terminal multiplexer in Ubuntu Server



Screen is a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session (such as when using SSH).



The screen package can be installed on Ubuntu using any method.

Starting with the Jaunty release, the screen-profiles package (later renamed Byobu) provides advanced features such as status bars, clocks, and notifiers. The package can also be manually installed on previous Ubuntu releases.



Screen can be started by typing



in a terminal. Press Enter after reading the introductory text.

Virtual terminals in Screen can be manipulated by pressing the Ctrl+A key combination, and subsequently pressing a key to execute one of the commands given below:

  • c creates a new virtual console

  • n switches to the next available virtual console

  • p switches back to the previous virtual console

  •  lists all available virtual consoles and their assigned numbers

  • hitting a number key brings the corresponding virtual console to the foreground
  • Esc lets you scroll back and forth in your terminal output

  • d detatches the current screen sessions and brings you back to the normal terminal

When a Screen session is detached, the processes that were running inside it aren’t stopped. You can re-attach a detached session by typing

screen -r


in a terminal

To remove the annoying copyright notice at startup, edit your /etc/screenrc with

sudo nano /etc/screenrc


and remove the hash which begins the line

#startup_message off


Save the file, and you will not see it again.

For further information and more advanced commands, you can refer to the screen man page. Source:

Install and Run Bitcoin Core and Wallet in Ubuntu Server 16.04

  1. Install Bitcoin Core:
    • $ sudo apt-add-repository ppa:bitcoin/bitcoin
    • $ sudo apt-get update
    • $ sudo apt-get install bitcoind
  2. Run Bitcoin Node:
  3. Optional: start Bitcoin node at boot:
    • Run the following command to edit your crontab:
      • $ crontab -e
    • Scroll to the bottom of the file displayed and add the following line:
      • @reboot bitcoind -daemon
    • Save the file and exit.
  4. Verify if Bitcoin node is running:
    • $ bitcoin-cli getinfo
  5. Stop Bitcoin Core/Node process:
    • $ bitcoin-cli stop
  6. Create a new wallet address:
    • $ bitcoin-cli getnewaddress               # create an address in default account
    • $ bitcoin-cli getnewaddress “John”   # create an address in John account
    • (understanding account in wallet)
  7. Show current wallet addresses:
    • $ bitcoin-cli listreceivedbyaddress 0 true      # show all address from all accounts
    • $ bitcoin-cli getaddressesbyaccount “”     # show address in default account
    • $ bitcoin-cli getaddressesbyaccount “John”   # # show address in John account

Install and Run zCash in Ubuntu Server 16.04

  1. Install zCash node (website:
    • $ sudo apt-get install apt-transport-https
    • $ echo “deb [arch=amd64] jessie main” | sudo tee /etc/apt/sources.list.d/zcash.list
    • $ sudo apt-get update
    • $ sudo apt-get install zcash
    • $ zcash-fetch-params    (# download parameters)
    • $ cd .zcash
    • $ nano zcash.conf    (create file: zcash.conf)
    • Add following line into zcash.conf, then save and exit:
      •     (# connect to zcash main network)
        rpcuser=user-name     (# user, no matter)
        rpcpassword= password-text  (# anything, no matter)
        gen=0      (# value=0: not mining; value=1: mining when run zcashd)
  2. Run zcash core (zcashd):
    • $ zcashd    :   run zcashd in normal mode and showing running info.
    • $ zcashd –daemon  :   run zcashd in background
    • It will take several hours to download all blockchain to local server.
  3. Use zcash client app (zcash-cli):
    • To check if zcashd is running:
    • Create new t-Address (account for wallet is not supported yet – 2017/07):
      • $ zcash-cli getnewaddress
    • List t-address:
      • zcash-cli getaddressesbyaccount “”  (# show address of default account)
      • zcash-cli listreceivedbyaddress 0 true  (# show all addresses of all accounts)
    • Create new z-address:
      • $ zcash-cli z_getnewaddress
    • List z-address:
      • $ zcash-cli z_listaddresses

Install and configure SSH server for Ubuntu 16.04

  • Intall SSH Server:

$ sudo apt install openssh-server

  • Change SSH Port, if needed:

$ cd /etc/ssh/

$ sudo nano sshd_config

The change port number, save and exit.

  • Restart SSH service:

$ sudo systemctl restart ssh

  • Open SSH session to control another machine:

$ ssh hostname@host_ip_address -p ssh_port

  • Temporary let ssh session (that is controlling a remote host) run under background (i.e. a special command to suspend the SSH client):

Press “–” (Shift -),  “Enter", then “~", followed by “Ctrl-Z"

  • Re-enter interactive mode after Ctrl-Z (i.e. back to the process that is let running in background after press Ctrl-Z):

Type “fg” and hit “enter” in terminal.





How to run Siad as a background service in Ubuntu server

Configure a service that allow siad to run on boot (and restart in case of crashed):

    • Assume that you already install Sia Core and ./siad is operational (i.e. you can run command ./siad to start Sia application)
    • Stop siad process.
    • Create a file named: siad.service at a folder you need. In the below example, you create file siad.service in folder /home/your-user-name/config/services
      • $ mkdir config && cd config && mkdir services && cd services
      • $ sudo nano siad.service
      • Add these lines to siad.service file:

        Description=Sia Daemon
    • Save file and exit to root user.
    • Configure firewall (if ufw is in use):
      • $ ufw allow 9982
    • Start siad as a service:
      • $ systemctl daemon-reload
      • $ systemctl enable ~/.config/systemd/siad.service
      • $ systemctl start siad.service
  • Sia should now be running as a service which can be confirmed/verifyed with:

Sia wallet error when unlock or show addresses

Run commands:

./siac wallet unlock

./siac wallet addresses

Error: Could not unlock wallet: error when calling /wallet/unlock: wallet has not been encrypted yet

Cause: Wallet was unlocked before all blockchain had been downloaded. The wallet is in “incomplete” status.


  • Let all blockchain downloaded (by running ./siad)
  • Encrypt wallet with your current recovery seed:
    • Run ./siac wallet init-seed
    • Input your current recovery seed
    • Wait for a while (few minutes)
  • Now your Sia Wallet is completed.
  • Decrypt wallet with your current password:
    • Run ./siac wallet unlock
    • Input your current 29-word long password
    • Wait few minutes for scanning clock height, then done.
  • Now you can use ./siac wallet [flag/command] again.