A Rails application to run a peercoin faucet website.
Available on peercoinfaucet.com
You can also give and receive peercoins on the testnet blockchain on testnet.peercoinfaucet.com
-
Install Ruby 1.9+
-
Install the bundler gem (you may need root):
gem install bundler
-
Install git
-
Clone the repository
git clone https://github.com/sigmike/peercoin-faucet.git cd peercoin-faucet
-
Decide a database backend:
-
sqlite3: easiest to setup, only install the sqlite3 development libraries and you’re ready, but may not be good enough for production
-
postgresql or mysql: install the development libraries, and create a database
-
-
Install the gems without the databases you don’t want. Examples:
bundle install --without mysql postgresql bundle install --without sqlite3 mysql
-
Create
database.yml
.-
Example for sqlite3:
production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000
-
Example for postgresql:
production: adapter: postgresql host: localhost database: peercoin_faucet username: peercoin_faucet password: password encoding: unicode pool: 5
-
Example for mysql:
production: adapter: mysql2 database: peercoin_faucet host: localhost username: peercoin_faucet password: password
-
-
Create
config.yml
cp config/config.yml{.example,}
-
Edit
config.yml
(see below) -
Initialize the database
RAILS_ENV=production bundle exec rake db:migrate
-
Make sure
ppcoind
is running with RPC enabled -
Run the server
RAILS_ENV=production bundle exec rails server
-
Connect to the server at localhost:3000/
To make it run in production I recommend Phusion Passenger with Apache or nginx.
To fulfill request and update state, commands must be run frequently with cron. To display the cron you must use, run:
bundle exec whenever -s "environment=production"
To automatically setup your cron, run:
bundle exec whenever --update-crontab -s "environment=production"
Sample config file:
ppcoind_path: ppcoind ppcoind_account: "" amount_per_request: 0.1 minimum_confirmations: 3 request_time_frame_duration: 1 hour time_between_request_fulfilling: 30 minutes secret: GENERATE A SECRET WITH "rake secret" AND PASTE IT HERE captcha: true recaptcha: public_key: YOUR RECAPTCHA PUBLIC KEY private_key: YOUR RECAPTCHA PRIVATE KEY donation_address: PAkkURv3ZxYDMiU2qYjyYZj3ENGcM2eAR5 donation_currency: peercoins tracking_code: > <!-- REPLACE WITH YOUR TRAFFIC TRACKING CODE --> canonical_host: example.com donation_request_url: http://example.com/
- ppcoind_path
-
Path to the ppcoind executable.
- ppcoind_account
-
The account on ppcoind used to determine the peercoin address, balance and to make transactions. The default account is the empty string “”.
- amount_per_request
-
Amount given to each request.
- minimum_confirmations
-
Minimum confirmations to determine balance.
- request_time_frame_duration
-
Current time is divided in steps of this duration. An IP cannot create two requests in the same time frame. Format: “<amount> <unit>” where unit can be second, minute, hour, week, month or year (plural form is allowed).
- time_between_request_fulfilling
-
Requests will be processed at this frequency. Same format as
request_time_frame_duration
. - secret
-
A random string used to sign cookies and prevent session forging. Run +bundle exec rake secret+ to generate one and paste it there.
- captcha
-
Set to false to remove the captcha.
- recaptcha
-
Set your public and private keys here if you enabled the captcha.
- tracking_code
-
The visitor tracking code. Copy/paste the code provided by Google Analytics or your other tracker.
- canonical_host
-
Optional forced hostname for the website. Access to the website using another hostname will redirect to this hostname (see github.com/tylerhunt/rack-canonical-host).
- donation_request_url
-
The link that will be displayed when the faucet is empty.
If you want to donate for this project, send
-
Bitcoins to 1pfUuPS7sfY5TY3Wh5B91tqjxcvwDPLH1
-
Peercoins to PAkkURv3ZxYDMiU2qYjyYZj3ENGcM2eAR5