Skip to content
/ ln-dice Public

Dice gambling service using the Lightning Network for deposits and withdrawals

License

Notifications You must be signed in to change notification settings

mably/ln-dice

Repository files navigation

Dice gambling service using LN for payments

Installation

Requirements

Procedure

Fetch sources from the git repository:

git clone https://github.com/mably/ln-dice.git

Move into the newly created directory:

cd ln-dice

Fetch the dependencies and build the application by running:

npm install

Execution

Start the back-end server:

node server

Available command-line arguments:

node server --help

  Usage: server [options]

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number
    -s, --serverport [port]       web server listening port (defaults to 8280)
    -h, --serverhost [host]       web server listening host (defaults to localhost)
    -l, --lndhost [host:port]     RPC lnd host (defaults to localhost:10009)
    -t, --usetls [path]           path to a directory containing key.pem and cert.pem files
    -u, --user [login]            basic authentication login
    -p, --pwd [password]          basic authentication password
    -r, --limituser [login]       basic authentication login for readonly account
    -w, --limitpwd [password]     basic authentication password for readonly account
    -f, --logfile [file path]     path to file where to store the application logs
    -e, --loglevel [level]        level of logs to display (debug, info, warn, error)
    -n, --lndlogfile <file path>  path to lnd log file to send to browser
    -k, --le-email [email]        lets encrypt required contact email

Open your browser at the following address: http://localhost:8280

Enjoy!

Generate lnd certificates compatible with NodeJS gRPC

Beware that lnd autogenerated certificates are not compatible with current NodeJS gRPC module implementation.

Lnd uses the P-521 curve for its certificates but NodeJS gRPC module is only compatible with certificates using the P-256 curve (link).

You need to generate your own lnd certificates using the following commands (thanks to Alex Akselrod for helping me on this):

# Enter the Lnd home directory, located by default at ~/.lnd on Linux or 
# /Users/[username]/Library/Application Support/Lnd/ on Mac OSX
cd ~/.lnd
openssl ecparam -genkey -name prime256v1 -out tls.key
openssl req -new -sha256 -key tls.key -out csr.csr -subj '/CN=localhost/O=lnd'
openssl req -x509 -sha256 -days 3650 -key tls.key -in csr.csr -out tls.cert
rm csr.csr

For some reason the lnd web client must also now be run with root privileges.

You can write a lnd web client start script and add it to your sudoers file until a proper fix is found:

<lnd web client username> ALL=(ALL) NOPASSWD: <lnd web client start script command>

Screenshots

Check here for the mandatory screenshots: http://imgur.com/a/LgWcs

Enabling https for remote access

You need to have a key.pem (private key) file and a cert.pem (certificate) file available in your path (check the --usetls command-line option).

On Linux you can create the above files using a self-signed certificate by executing the following command:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365

You might need to run this extra command to remove the password protection:

openssl rsa -in key.pem -out newkey.pem && mv newkey.pem key.pem

And the you need to add the --usetls command-line option to point to the directory containing your two pem files.

Example command starting a password protected Lnd Web Client with readonly account enabled, running on port 443, and using https with corresponding pem files located in the app directory:

node server -s 443 --usetls . --user manager --pwd 33H966wG --limituser lnd --limitpwd rocks

Hoping that helps.

About

Dice gambling service using the Lightning Network for deposits and withdrawals

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •