Giter Club home page Giter Club logo

mojocoin-faucet's Introduction

Mojocoin::Faucet has been discontinued and kept here for historical reasons

Mojocoin::Faucet - Bitcoin Faucet Implementation

Mojocoin::Faucet is a lightweight implementation of a Bitcoin faucet in Perl. It is built on top of the popular Mojolicious web framework and uses Redis as an in-memory key/value data store. Mojocoin::Faucet delegates most bitcoin-related tasks to the original Satoshi bitcoind client. We use bootstrap from twitter for CSS designs. Here is a wrap up of the technologies used:

Frameworks & Tools

Mojolicious is a cooperative multitasking web framework as it runs on a single-process event loop (usually EV). You can leverage the power of GNU/Linux pre-forking using the built-in Hypnotoad web server.

Mojolicious is an asynchronous web framework. The programming style is mostly callback-oriented. You install listeners on the event loop and provide callbacks for specifying your program continuations. This shouldn't been too alien if you have some javascript or node.js background.

To make asynchronous programming easier with Mojolicious, we designed the Continuum framework. It allows us to run asynchronous commands in parallel and provide merge-point callbacks very easily. This should be fairly simple to understand:

    use Continuum;
    use Continuum::BitcoinRPC # $bitcoin
    use Continuum::Redis # $redis
    

    $bitcoin->GetBalance
        ->merge( $bitcoin->ValidateAddress( $address ) )
        ->merge( $redis->hget( ip => value ) )
        ->then( sub { 
            my ( $balance, $validation, $ip ) = @_;
            # This callback is called once all 3 asynchronous
            # operations above are completed
        });

To communicate with the Satoshi Bitcoin implementation, I wrote Continuum::BitcoinRPC. It is a simple JSON/RPC interface to bitcoind.

Installation

Upgrade to Perl v5.14 if you haven't already. This program requires some features that are only well supported from that version.

You will need the following Perl modules from github:

And at least the following modules from CPAN:

You may be missing upstream dependencies from CPAN. Just install them as you go.

You'll need to install bitcoind and configure it to use RPC:

bitcoin.org

The Faucet needs some configuration settings in the file mojocoin-faucet.conf at the root directory of the application. Look at mojocoin-faucet.conf.example.

Finally, install Redis.io and make it available on the localhost interface, port 6379 (default port). If you change the Redis network settings, you'll need to update the Faucet.pm file.

To launch the server, use the following commands from the project root:

Development

morbo script/mojocoin-faucet.pl -l http://127.0.0.1:3000

Production (single process)

script/mojocoin-faucet.pl daemon -l http://*:80

You can use Hypnotoad for a prefork Unix-optimized server, Although it has not been tested with the faucet yet. The default Mojolicious server should be enough since the application is optimized for asynchronous IO.

Bugs

Please report any bugs in the projects bug tracker:

http://github.com/plaprade/Mojocoin-Faucet/issues

You can also submit a patch.

Contributing

We're glad you want to contribute! It's simple:

  • Fork Mojocoin::Faucet
  • Create a branch git checkout -b my_branch
  • Commit your changes git commit -am 'comments'
  • Push the branch git push origin my_branch
  • Open a pull request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.