/tapin

Python-based BitShares faucet

Primary LanguagePythonMIT LicenseMIT

Tapin

tapin is a python-based faucet for Graphene-based blockchains (e.g. BitShares).

Installation

  • edit config.py and provide private keys and settings
  • python manage.py install

Usage

  • python manage.py runserver

The faucet is then available at URL http://localhost:5000

Deploy on Heroku

Deploy

Remark: Please understand the risks of exposing private keys to heroku!

Nginx configuration

Run uwsgi --ini wsgi.ini

and use a configuration similar tothis

user bitshares;
worker_processes  4;

events {
    worker_connections  2048;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    access_log  /www/logs/access.log;
    error_log  /www/logs/error.log;
    log_not_found off;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;

    upstream websockets {
      server localhost:9090;
      server localhost:9091;
    }

    server {
        listen       80;
        if ($scheme != "https") {
                return 301 https://$host$request_uri;
        }

        listen       443 ssl;
        server_name  bitshares-wallet.com;
        ssl_certificate      /etc/nginx/ssl/bitshares-wallet.com.crt;
        ssl_certificate_key /etc/nginx/ssl/bitshares-wallet.com.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location ~ /ws/? {
            access_log on;
            proxy_pass http://websockets;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_next_upstream     error timeout invalid_header http_500;
            proxy_connect_timeout   2;
        }
        location ~ ^/[\w\d\.-]+\.(js|css|dat|png|json)$ {
            root /www/wallet;
            try_files $uri /wallet$uri =404;
        }
        location / {
            root /www/wallet;
        }
        location /api {
                include uwsgi_params;
                uwsgi_pass unix:/tmp/faucet.sock;
        }

    }
}