- Detects if a user has already used the faucet in the last 24 hours (by default)
- Can change the output of the faucet based on country (for things like cpm rate differences) -
badly done, may change in futureNow uses coingecko API for pricing data - Has reCAPTCHA V2 to stop bots and automated traffic
- Very simple layout
http://ip-api.com/
which is used to check the user's country, only allows 45 requests per minute per ip.https://api.coingecko.com/api/v3/simple/
which is used to check the price of the coin, only allows [10-30] (https://www.coingecko.com/en/api/pricing)requests per minute per ip.
- Node of cryptocurrency with RPC open
- reCAPTCHA v2 API keys. Get them here.
- SQL Database
- URL Shortener (optional)
- Navigate to the default data directory,
C:\Users\username\AppData\Roaming\Coinname\
by default on windows or/home/username/.coinname/
on linux. - create a file called
coinname.conf
in the directory. - make sure it includes:
rpcuser=username
rpcpassword=password
rpcport=port
rpcallowip=127.0.0.1
daemon=1
server=1
listen=1
- Done, put the credentials and port into the php script.
This is just for setup of what the faucet expects the table to look like, not a full installation guide.
- Create a new schema.
CREATE SCHEMA your_schema_name;
- Create the table with these specific columns:
CREATE TABLE your_schema_name.your_table_name (
ip VARCHAR(45),
timestamp TIMESTAMP,
unique_id VARCHAR(255),
crypto_address VARCHAR(255),
country VARCHAR(50) NOT NULL,
used INT NOT NULL DEFAULT '0'
);
- Done, put the credentials, port, schema and table name into the php script.
- Any Shortener is supported if the syntax is similar to this:
?api={$api_token}&url={$long_url}&format=text
for plaintext response. - Get the site location from your webserver, eg,
https://https://example.com/faucet/
orhttps://example.com/faucet/coin.php
and set it in the script. - Be sure to set the shortlink service API key.
A coin's ID can be found on the coin page for example, bitcoin's would be bitcoin
, you can find it on the right side of the page labelled API ID
To try to prevent users from using the wrong address, on line 63 there is a check to make sure that the address starts with the correct letters, currently it is set to litecoin's, change it to whatever your currency has.
On line 69, NOW() - INTERVAL 24 HOUR")
can be changed to any number, but to make it more readable use: NOW() - INTERVAL 24 MINUTE")
for minutes or NOW() - INTERVAL 24 DAY")
for days.
Lines 189-256 are setup to deal with country by country payments, the numbers are setup like: CPM / 1000 / pricePerCoin
where cpm is how much the shortlink service pays you, 1000 stays the same and pricePerCoin is at what sell rate you want to sell the coin to users.
Line 402 is space for an iframe ad with some margin away from the submit box.
Feel free to change the footer text, I just wanted it to look a bit professional but please leave the html comment under it.