MultiFaucet an Easy to setup Crypto Currency Faucet that Supports Multiple Currencies.

MutiFaucet is an easy to setup crypto currency faucet that supports multiple currencies. It was loosely derived from the Simple Faucet script by Dogenes. This faucet is built using the Enchilada Frame Work 3.0 and Enchilada Libraries 2.0.

A live example with the multi-site feature running off a single code base can be seen at: http://faucet.securepayment.cc

Download it from https://github.com/tuaris/multifaucet/archive/master.zip.

Requirements

  • MySQL 5.1 or later
  • PHP 5.3 or later
  • Crypto currency wallet with RPC access (can be on a seprate server)

Features

  • Web installer that makes it easy to setup, just extract and go.
  • Automatic locale and translation into any language.
  • Support for either Hot or Cold crypto wallets.
  • Themes.
  • Simple Captcha, re-CAPTCHA, or Solve Media.
  • SpammerSlapper Anti-Proxy Abuse.
  • Remote Management via JSON-RPC.
  • Muti-site capable (premium add-on).

Installation

  1. Create a MySQL database and user that will be used for the faucet.
  2. Download the archive and extract into any folder or root folder on your web server.
  3. Allow write permissions to the "config" folder
  4. Open the website in your browser to start the web based installer or visit
    http://webserver/upload_folder/install.php.
  5. Delete or rename install.php

If you want to re-configure any settings in the future simply (restore install.php if needed) and re-run the installation script or manually edit the config files.

If you are using the cold wallet it's recommended that you place the data file outside your web directory. For example as a relative path:

../cold_wallets/datafile.dat

Or an absolute path:

/var/cold_wallets/datafile.dat

Note: The "datafile" will be prefixed by what you use as the MySQL table prefix.

The promo codes feature awards an extra amount of coins to the visitor. At the moment the codes and rewards will need to be manually entered into the database table "PRFX_promo_codes".

Managing the Faucet

If you are using the hot wallet, payments will be sent immediately. If you are using the cold wallet the funds need to be sent manually or by a script/cron job. The faucet’s RPC interface can aid with this process.

The current RPC functions are:

/*
* Returns an array of all the unpaid transactions
* array(id, payout_address, payout_amount, created_date, ip_address, promo_code, promo_payout_amount, timestamp, lastupdate)
*/
getPendingTx()
/*
* Updates a payout record with the transaction ID and deletes the pending payment
* $id is the id of the pending payment obtained from getPendingTx()
* $txid is the transaction ID from the crypto wallet.
*
*/
public function setPaidTx($id, $txid)
/*
* Adds funds to the cold wallet
* $amount: amount to be added
*
*/
public function addFunds($amount = 0)
/*
* Deducts funds to the cold wallet
* $amount: amount to be subtracted (note if the total is less than 0, 0 is used)
*
*/
public function deductFunds($amount = 0)
/*
* Sets funds to the given amount
* $amount: amount to be set
*
*/
public function setFunds($amount = 0)
/*
* Gets the current available funds
*
*/
public function getFunds()

A sample PHP script that interacts with the faucet's RPC interface to send payments and re-fill the faucet can be found below. The include file 'jsonRPCClient.php' can be copied from the classes directory from the faucet:

require_once('jsonRPCClient.php');

$RPC_faucet = new jsonRPCClient('http://admin:password@www.myserver.tld/faucet/rpc.php');
$RPC_wallet = new jsonRPCClient('http://admin:password@zetacoin.mysecureserver.tld:1234');

$pendingTx = array();
try{
$pendingTx = $RPC_faucet->getPendingTx();
}
catch(Exception $e){
echo "No Pending Transactions\n";
}

foreach($pendingTx as $tx){
echo "Sending Payment to {$tx['payout_address']} Amount: {$tx['payout_amount']}\n";

//Check address
$addressvalid = @$RPC_wallet->validateaddress($tx['payout_address']);
if (!$addressvalid['isvalid']){continue;}

$txid = @$RPC_wallet->sendtoaddress((string)$tx['payout_address'], (float) $tx['payout_amount']);
$RPC_faucet->setPaidTx($tx['id'], $txid);
}

try{
echo "\nFaucet Balance: {$RPC_faucet->addFunds(100)}\n";
}
catch(Exception $e){
echo "\nFaucet is empty or error adding funds.\n";
}

Note that the above script is very simple. It has no validation or error control and blindly adds 100 coins to the faucet funds. It should be noted that the faucet has already validated the wallet address so it's (almost) safe to assume that any address in the payments list can be considered valid. The script can be ran as a cron job a any desired interval.

The script will only provide a list of 'pending', that is unpaid requests.

The username and password is what you specified during install as the RPC username and password for the wallet configuration. Don't forget to cal the setPaidTx() function on the address to update the database with the transaction ID and to also prevent this payout from being duplicated.

Using MultiSite

The MultiSite add-on allows you to run multiple faucets each with there own unique configuration off a single code base. This is a premium add-on that must be purchased. Installation is very easy.

  1. Place the received PHP include file in the "system" folder of your installation.
  2. If you have an existing configuration, move it to a sub folder named "default" under the config directory.
  3. Setup Apache directory aliases (Note, URL rewriting will not work)
  4. Create a config sub folder for each domain or sub path.
  5. Run the installer

Configuration sub directories can take the form of any of these examples:

	Highly complex:
		http://subdomain1.subdomain2.domain.tld.tld/subfolder1/subfolder2
		codebase/config/subdomain1.subdomain2.domain.tld.tld.subfolder1.subfolder2

	The simplest form being:
		http://domain.tld
		codebase/config/domain.tld

	A common form:
		http://domain.tld/subfolder
		codebase/config/domain.tld.subfolder

	Another common form:
		http://subdomain.domain.tld/subfolder
		codebase/config/subdomain.domain.tld.subfolder

	You get the picture...
		http://subdomain.domain.tld
		codebase/config/subdomain.domain.tld

If no suitable config directory is found, the "default" directory will be used. Below is a sample extract of location aliases that can be used in your Apache httpd.conf:

Alias /coin1 "/var/www/multifaucet"
Alias /coin2 "/var/www/multifaucet"
Alias /coin3 "/var/www/multifaucet"

The corresponding configuration directories can therefor be:

/var/www/multifaucet/config/coin1
/var/www/multifaucet/config/coin2
/var/www/multifaucet/config/coin3

Then run the installation script for each:

http://myfaucet.tld/coin1/install.php
http://myfaucet.tld/coin2/install.php
http://myfaucet.tld/coin3/install.php

To get pricing information and to purchase the multi-site module, please use the website contact form. An automated solution will be available in the future.

Preventing Proxy and Tor Abuse

Enabling the "SpammerSlapper" feature will cause the faucet to query the SpammerSlapper service's IP address based verification services. This will (in theory) prevent users from abusing your faucet with the use of proxy servers or Tor exit nodes. It's not yet 100% effective and could generate false positives which may annoy your users. Additionally, the service is still very much in it's alpha stages and could slow down your faucet while it's scans the visitor's IP address.

To use the service you will need to get a free API key: http://api.spammerslapper.com.

Securing your Installation

To improve security you should rename the rpc.php file to something cryptic to prevent a malicious user from attempting to access. Additionally it's a good idea to either delete or rename the install.php file since this allows you to not only change settings but view current values. This file can be restored any time you need to run the install script.

Another option may be to password protect the installer:

<Files "install.php">
AuthName "Faucet Installer"
AuthType Basic
AuthUserFile /etc/.faucet-htpasswd
require valid-user
</Files>

Download

Download it from https://github.com/tuaris/multifaucet/archive/master.zip.

If you found this program useful please show your appreciation by sending me some
BTC: 1B6eyXVRPxdEitW5vWrUnzzXUy6o38P9wN
ZET: ZK6kdE5H5q7H6QRNRAuqLF6RrVD4cFbiNX

Pacy
Powered by Pacy