Litedoge Web Scrypt Miner
Getting Started
First Run
- Copy
config.default.jstoconfig.js, and fill it out with the appropriate details. - Install the dependencies using
npm install. - In order to compile the SASS file, you need to install
rubyand thesass gem. Something likesudo apt-get install rubyandsudo gem install sass. - Install
grunt-cliglobally usingnpm install grunt-cli --global. You may need tosudothat. - Build all the client-side JS and CSS files using
grunt. - (Optional) Build the scrypt module by changing into the
scryptdirectory and runningmake node.
Running
I’ve gotten a few questions about running the application. So here’s some snippets that will hopefully help people get started.
- First of all, there’s
node server.js. It’s your basic run command. - If you want to log the output to a file, you can add
>> /tmp/file.log. - Putting
&at the end of the command runs it in the background, so it won’t be killed when you close your terminal window or SSH connection. - If you want to pass in options to the application, you put them at the beginning in the form of
NODE_PORT=9870.
When you put them all together, you get what I use in my start script:
NODE_PORT=9870 NODE_ENV=production node server.js >> /tmp/server.log &
server.js
Options
NODE_ENVmodifies settings specified in Environments.NODE_PORTorPORTcontrols the port for HTTP requests. It will overwrite the setting inconfig.js. HTTPS is not yet supported.
payer.js
Options
NODE_CLEANUPis the number of milliseconds between cleanup actions, which removes old shares from the database and performs the BGREWRITEAOF command.
Environments
Express checks the NODE_ENV environment variable to know what features to turn on. I’ve configured two:
developmentserves files from thepublicdirectory. Logs requests to the console.productiondoes not serve files. Turns ontrust proxy. Turns onview cache. Does not log requests. I run it behind NGINX, which I have set up to serve the files from thepublicdirectory and log everything.
Paying Out
This is a manual process right now, for a lot of reasons. You’re welcome to automate it if you see fit though. Here’s the basics of how it works. All of this goes on in the processing directory.
- Connect to the redis database using
redis-cli. - Run
LRANGE withdraw 0 -1. You’ll get something like this:
1) "{\"email\":\"hello@example.com\",\"amount\":\"1\",\"address\":\"DM7BaRfSxUhvz8eJ9dHeChzEifJaP5poFL\"}"
2) "{\"email\":\"blank@example.com\",\"amount\":\"1\",\"address\":\"DM7BaRfSxUhvz8eJ9dHeChzEifJaP5poFL\"}"
- Copy the results into the
data.txtfile, and remove the line numbers and junk from the front. Like so:
"{\"email\":\"hello@example.com\",\"amount\":\"1\",\"address\":\"DM7BaRfSxUhvz8eJ9dHeChzEifJaP5poFL\"}"
"{\"email\":\"blank@example.com\",\"amount\":\"1\",\"address\":\"DM7BaRfSxUhvz8eJ9dHeChzEifJaP5poFL\"}"
- Run the
generate.jsfile. This will put the proper information into theoutput.jsonfile, which will look like this since the above addresses are the same:
{
"DM7BaRfSxUhvz8eJ9dHeChzEifJaP5poFL": 2.00000001
}
- The
payout.jsfile has the line that actually makes the transaction commented out by default. I run it once to make sure the balance will cover the transaction. If it will, I uncomment it, and run it again. When the transaction is made, the transaction ID will be logged. Or an error, depending on what actually happened. - To get rid of the processed transactions, run the command
LTRIM withdraw # -1, replacing the number sign with the number of records processed. In the above example, it would be2. This makes sure you don’t remove any withdrawal requests that were made since theLRANGEcommand, because that would be bad.
Changes You Might Care About
Version 2.0.2
- Use
PORTorNODE_PORTenvironment variables. - The default config file is now separate.
- There’s options for which scrypt implementation you use.
Version 2.0.1
- Minor changes for HTTPS.
- Uses another scrypt implementation on the server for easier install.
- Checks Dogecoin addresses properly, by decoding and validating the checksum.
Version 2.0.0
- Brand new look.
- Using Grunt for minifying and combining front-end files.
- All the scrypt implementations use the same C++ code base.
- In Chrome, we now use PNACL instead of JavaScript.
- Switched to SASS for CSS.
- The giant JS file has been split up into manageable chunks.