Adblocker is cool.

We post our content for free, since we use Google Ads, to pay for servers and coffee.Would you please give us a chance to prove you that we drop dope content, by whitelisting our site in your ad blocking software?After you whitelist us, hit CTRL+F5 or just F5 to reload the page.Thank you!

FHMW Installation

/
/
/
img

This guide will cover basic installation of FHMW with Bitcoin wallet, running on a Unix based system (tested on Ubuntu 18.04).

Prerequisites
Before attempting to install FHMW following this guide, please make sure you have the following:

VPS or Dedicated server running Ubuntu 18.04
SHH access with root credentials (or your user account is allowed to run sudo commands)
At least 300 GB free space on disk

Installing Bitcoin Core
Login on your server through SSH as root or as a normal user. If you log in as a normal user, you will notice that some commands have (sudo) in front of them – for example:

# (sudo) make install

If you are logged in as root, just run the command as

# make install

If you are logged in as a regular user, run the command with sudo as well

# sudo make install

Let’s begin. 

First of all, you need to install the packages needed to compile source code and a few dependencies:

# (sudo) apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3

# (sudo) apt-get install libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev

Berkeley DB

Bitcoin Core requires Berkeley DB 4.8 in order to properly run. This version of Ubuntu (18.04) provides precompiled packages for Berkeley DB 5.1 which will break your build so you will need to manually compile and install the 4.8 version:

# cd $HOME
# wget http://download.oracle.com/berkeley-db/db-4.8.30.zip
# unzip db-4.8.30.zip
# cd db-4.8.30
# cd build_unix/
# ../dist/configure –prefix=/usr/local –enable-cxx
# make
# (sudo) make install

Now let’s get to the Bitcoin Core.

If you haven’t ever used the `git` command, it’s probably not even installed so first make sure you have it. You won’t break anything, you’ll just get a notification that it’s already installed:

# (sudo) apt get update
# (sudo) apt install git

Get the bitcoin core source code:

# cd $HOME
# git clone https://github.com/bitcoin/bitcoin

It should take a while to download everything.

Configure and install:

# cd bitcoin
# ./autogen.sh
# ./configure
# make
# (sudo) make install

The make command will take a pretty long time so go get a cup or coffee or something.

If you are logged in as root, you need to create a regular user account that will run the bitcoin daemon. If you are already logged in as a user, skip this step.

# adduser btc

You will be asked to enter a password and you can leave empty the full name and everything else.

Now login as the newly created user through SSH.

Create a new directory for the bitcoind files:

$ mkdir ~/.bitcoin/

$ cd ~/.bitcoin/

Add the default config file:

$ nano bitcoin.conf

Copy and paste this config:
(Shift+Insert is the Paste hotkey in terminal, btw)

server=1
daemon=1
rpcuser=USERNAME
rpcpassword=PASSWORD
rpcallowip=127.0.0.1
rpcallowip=99.88.77.66
rpcport=8332
paytxfee=0.0006
mintxfee=0.00007
fallbackfee=0.0001
txconfirmtarget=30

Replace USERNAME and PASSWORD with an username of your choice. Replace the 99.88.77.66 IP with the IP of your apache server (if you’re running apache on a different server/IP than the bitcoin daemon).

Save it with Ctrl+X, press Y and Enter.

Now run the daemon:

$ cd $HOME

$ bitcoind

Make sure it’s running with:

$ bitcoin-cli -getinfo

If everything worked out good, you should see some info there version, blocks etc.

At this point, the Bitcoin Core Daemon is running and it’s synching with the blockchain (it’s gonna download the whole blockchain so this will take probably hours – if not even days).

FHMW Script Installation

Hopefully, this isn’t your first encounter with a webserver so you probably have a good idea about what to do.

Download

First, download the script, it will open a Dropbox page, click on Download from the upper right corner and Direct Download.

This will download the zip file to your computer.

Upload it to your webserver and extract it to /var/www

You should now have a /var/www/fh-microwallet-script_V1 folder, you can rename it or whatever

# (sudo) mv /var/www/fh-microwallet-script_V1 /var/www/microwallet

Add the .htaccess:

# (sudo) nano /var/www/microwallet/public_html/.htaccess

And paste this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?path=/$1

Database setup

Create an username and a database for it – from phpMyAdmin is the easiest way:

login to phpMyAdmin
go to User Accounts
click Add user account
enter username, password and check the “Create database with same name and grant all privileges” and “Grant all privileges on wildcard name” options.

Next, go to an online sha512 hash generator like this one. Enter a password and click generate hash.

Open the FHMH config file with

# (sudo) nano /var/www/microwallet/config.json

And edit the following:

“admin”: {
“username”: “SOME-USERNAME-HERE”,
“password_hash”: “HASH-GENERATED-ABOVE”,
“email”: “YOUR-EMAIL”

“database”: {
“host”: “localhost”,
“port”: 3306,
“user”: “DATABASE-USERNAME”,
“password”: “DATABASE-PASSWORD”,
“name”: “DATABASE-NAME”

You can also edit the name, title of your page and so on.

Import the database

I ran into a few issues and i’ve edited the db.sql file before importing it like this:

Table structure for table `payouts`

`network_fee` decimal(32,8) NOT NULL,
`txid` varchar(150) NOT NULL,

replaced them with these:

`network_fee` decimal(32,8) NOT NULL DEFAULT 0,
`txid` varchar(150) NOT NULL DEFAULT 0,

You can easily import the database file from terminal:

# mysql -u database-username -p database-name < /var/www/microwallet/db.sql

Enter database-password.

Apache VirtualHost Setup

Create a virtual host for a new subdomain or for a domain you already have and point its DocumentRoot to the new created folder. Here’s an example of a default Virtual host for apache:

# (sudo) nano /etc/apache2/sites-available/microwallet.conf

Paste this:


ServerName subdomain-or-domain-name-here.com

ServerAdmin your-email-address

DocumentRoot /var/www/microwallet/public_html

ErrorLog ${APACHE_LOG_DIR}/error.microwallet.log
CustomLog ${APACHE_LOG_DIR}/access.microwallet.log combined
ErrorDocument 403 /custom403.html

 

Save the apache config file and load it with

# cd /etc/apache2/sites-available/

# (sudo) a2ensite microwallet.conf

# (sudo) systemctl reload apache2

SSL Cert

You should now install a ssl certificate for the newly created domain:

# sudo apt install certbot

# sudo certbot

Select the number of your new domain from the list and chose auto redirect to https.

If everything worked out, you should be able to access the FHMW from your browser. You can login with username and password for which you generated the sha512 hash.

Adding the Wallet to FHMW

Before anything, you should setup a wallet type. Go to your phpMyAdmin, click on the microwallet database and go to SQL or login to your mysql from terminal and run this:

INSERT INTO wallet_types (id, name) VALUES (1, “Bitcoin”);

Now go to FHMW Admin Panel / Wallets and click on Add a Wallet button.

Fill the following info:

Name: BitCoin

Symbol: BTC

Type: Select Bitcoin from drop-down

HTTPS: No

RPC Host: 127.0.0.1 (assuming daemon is running on the same server as webserver – otherwise enter the remote public ip)

RPC Port: 8332 (as set in the bitcoin.conf)

RPC Username: some-username (as set in the bitcoin.conf)

RPC Password: some-password (as set in the bitcoin.conf)

Block Explorer URL: https://www.blockchain.com/btc/tx/

Click Add Wallet. You should see it under Your Wallets section.

Adding an API KEY for your faucet

Go back to phpMyAdmin or mysql terminal and select the microwallet database, then type this:

INSERT INTO `api_keys` (`id`, `api_key`, `name`, `url`, `allowed_ips`, `enabled`, `created`) VALUES
(1, ‘SOME-API’, ‘SITE-NAME’, ‘SITE-URL’, ‘SERVER-IP’, 1, 1574575602);

SOME-API: enter a 32 characters string here (google for password generators or something)

SITE-NAME: YourFaucetName

SITE-URL: https://your-site-domain.com

SERVER-IP: This is the server IP that will perform api calls on the microwallet so insert here the public webserver IP address

Setting up CRON

FHMW comes with 4 cron files that need to be run regulary:

# (sudo) crontab -e

Enter the following lines:

*/10 * * * * /usr/bin/php -q /var/www/microwallet/cron/balance.php

*/10 * * * * /usr/bin/php -q /var/www/microwallet/cron/lastblock.php

*/10 * * * * /usr/bin/php -q /var/www/microwallet/cron/run.php

*/10 * * * * /usr/bin/php -q /var/www/microwallet/cron/uptime.php

*/10 * * * * /usr/bin/php -q /var/www/microwallet/cron/withdraw.php

Setting Up Your Faucet

Switching should be easy, you just need to edit the include/faucethub.php library and replace `faucethub.io` with ‘your-microwallet-domain’

CREDITS FOR THIS TUTORIAL TO:
devrawl, from freebitcoin.win

  • Facebook
  • Twitter
  • Reddit

1 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar