Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: super3/zmine
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.2
Choose a base ref
...
head repository: super3/zmine
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 5,876 additions and 3,923 deletions.
  1. +13 −3 .travis.yml
  2. +18 −2 README.md
  3. +49 −0 appveyor.yml
  4. +24 −0 components/log-card.js
  5. +48 −0 components/main-panel.js
  6. +156 −0 components/mine-card.js
  7. +32 −0 components/update-check.js
  8. +71 −0 components/wallet-card.js
  9. +0 −110 cover.css
  10. +27 −0 css/custom.css
  11. +25 −0 css/pricing.css
  12. +19 −64 index.html
  13. +1 −1 index.js
  14. +90 −56 lib/ext-miner.js
  15. +64 −0 lib/parser.js
  16. +19 −0 lib/utils.js
  17. +82 −44 miners.js
  18. +4,827 −3,370 package-lock.json
  19. +24 −23 package.json
  20. +11 −0 process.json
  21. +9 −82 scripts/app.js
  22. +0 −104 server.js
  23. +0 −27 test/ext-miner.js
  24. +42 −0 test/ext-miner.unit.js
  25. +4 −0 test/helper.js
  26. +171 −0 test/parser.unit.js
  27. +0 −18 test/server.unit.js
  28. +22 −19 test/spec.js
  29. +28 −0 test/utils.unit.js
16 changes: 13 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
language: node_js
node_js:
"8"
services:
- redis-server
"node"
after_script:
- npm run coverage
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
- npm run dist
- ls dist/*

deploy:
provider: releases
api_key: "GITHUB OAUTH TOKEN"
file:
- "dist/zmine*.AppImage"
- "dist/dist/zmine*.snap"
skip_cleanup: true
on:
tags: true
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
# zmine

[![Build Status](https://travis-ci.org/super3/zmine.svg?branch=master)](https://travis-ci.org/super3/zmine)
[![Build Status](https://travis-ci.org/ovsoinc/zmine.svg?branch=master)](https://travis-ci.org/ovsoinc/zmine)
[![AppVeyor](https://img.shields.io/appveyor/ci/super3/zmine.svg)](https://ci.appveyor.com/project/super3/zmine)
[![Coverage Status](https://coveralls.io/repos/github/super3/zmine/badge.svg?branch=master)](https://coveralls.io/github/super3/zmine?branch=master)
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?label=license)](https://github.com/Storj/super3/zmine/blob/master/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/super3/zmine.svg)](https://github.com//super3/zmine/graphs/contributors/)
[![Maintenance Status](https://img.shields.io/maintenance/no/2018.svg)](#)

### Run Client
```bash
git clone https://github.com/super3/zmine
cd ~/zmine
npm install
npm start
```

### Official Threads
### Run Server
```bash
git clone https://github.com/super3/zmine
cd ~/zmine
npm install pm2 -g
pm2 start process.json
```

## Official Threads
- [BitcoinTalk - [ANN] Zmine GUI - Easiest GUI Miner for Zcash (Windows/Linux)](https://bitcointalk.org/index.php?topic=3249018.0)
- [Zcash Forum - Zmine GUI - Easiest GUI Miner for Zcash](https://forum.z.cash/t/zmine-gui-easiest-gui-miner-for-zcash/28091)

## Contributors (:clap:)
| [![super3](https://avatars3.githubusercontent.com/u/60975?v=4&s=80)](https://github.com/super3) | [![montyanderson](https://avatars0.githubusercontent.com/u/3048503?v=4&s=80)](https://github.com/montyanderson) |
| :--:|:--:|
| [super3](https://github.com/super3) | [montyanderson](https://github.com/montyanderson) |
49 changes: 49 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
platform: x64

environment:
nodejs_version: "8"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version x64
- choco install redis-64
- redis-server --service-install
- redis-server --service-start
# install modules
- rm package-lock.json
- npm install

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# Show home directory
- node -p "os.homedir()"
# Run tests
- npm test

build_script:
# Build Windows binary
- npm run dist
- ls dist

artifacts:
- path: 'dist\squirrel-windows\zmine*Setup*.exe'
name: zMine

deploy:
release: zmine-v$(appveyor_build_version)
description: 'Automatic Build'
provider: GitHub
auth_token:
secure: QbUdvt8xBGWxhuqNsGX/cSHNxQz2Zpn6tnhKlMX/KLT3i2dwPP2LVJiPiTxh7b+I
artifact: zMine
draft: true
prerelease: false
on:
appveyor_repo_tag: true # deploy on tag push only

# Don't actually build.
#build: off
24 changes: 24 additions & 0 deletions components/log-card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const Vue = require('vue/dist/vue.common');

module.exports = Vue.component('wallet-card', {
template: `<div class="card text-center box-shadow">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Log</a>
</li>
</ul>
</div>
<div class="card-body">
<textarea class="form-control" disabled
style="height: 205px; font-size: 12px; margin-bottom:10px;"
ref="output">{{log}}</textarea>
</div>
</div>`,
props: ['log'],
watch: {
log() {
this.$refs.output.scrollTop = this.$refs.output.scrollHeight;
}
}
});
48 changes: 48 additions & 0 deletions components/main-panel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const Vue = require('vue/dist/vue.common');

module.exports = Vue.component('main-panel', {
template: `
<div>
<div>
<div class="card-deck mb-3 text-center">
<Wallet-Card
v-bind:mineroutput="minerOutput"
v-bind:mining="isMining"
v-on:address-change="addressChange"
></Wallet-Card>
<Mine-Card
v-bind:address="address"
v-on:update="minerUpdate"
v-on:start="isMining = true"
v-on:stop="isMining = false"
></Mine-Card>
</div>
</div>
<div>
<Log-Card v-bind:log="output"></Log-Card>
</div>
</div>`,
data: () => ({
output: '',
isMining: false,
downloaded: false,
minerOutput: {},
address: ''
}),
methods: {
minerUpdate(output, minerOutput) {
this.output = output;
this.minerOutput = minerOutput;
},
addressChange(address) {
this.address = address;
}
},
components: {
UpdateCheck: require('./update-check'),
MineCard: require('./mine-card'),
WalletCard: require('./wallet-card'),
LogCard: require('./log-card')
}
});
156 changes: 156 additions & 0 deletions components/mine-card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/* global localStorage */
const Vue = require('vue/dist/vue.common');
const io = require('socket.io-client');

// internal libs
const extMiner = require('../lib/ext-miner');
const utils = require('../lib/utils');

// vars
const socket = io(process.env.DEV ? 'http://localhost' :
'http://zfaucet.org');

module.exports = Vue.component('mine-card', {
template: `
<div class="card box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Mine</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">
{{minerOutput.sols}} <small class="text-muted"> sol/s</small>
</h1>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="mode">Mode</label>
</div>
<select class="custom-select" id="mode"
v-model="mode" v-bind:disabled="isMining">
<option v-bind:value="miner" v-for="miner in miners">{{miner}}</option>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" v-if="mode === 'CPU'">Threads</span>
<span class="input-group-text" v-else>GPUs</span>
</div>
<input class="form-control" type="number" v-model="cores"
min="1" max="16" v-bind:disabled="isMining"/>
<div class="input-group-append">
<button class="btn btn-outline-secondary"
type="button"
v-bind:disabled="isMining"
v-on:click="upCores"
>+</button>
<button class="btn btn-outline-secondary"
type="button"
v-bind:disabled="isMining"
v-on:click="downCores"
>-</button>
</div>
</div>
<div>
<button type="submit"
v-on:click="startMining"
v-if="!isMining"
v-bind:disabled="!validAddress"
class="btn btn-lg btn-block btn-success"
>
<span class="oi oi-play-circle center-icon" style="top: 4px; margin-right: 3px;"></span>
Start Mining
</button>
<button type="submit"
v-on:click="stopMining"
v-else
class="btn btn-lg btn-block btn-danger"
>
<span class="oi oi-media-stop center-icon" style="top: 4px; margin-right: 3px;"></span>
Stop Mining
</button>
</div>
</div>
</div>
`,
props: ['address'],
data: () => ({
output: '',
isMining: false,
downloaded: false,
minerOutput: {
sols: 0,
shares: 0
},
mode: localStorage.getItem('mode') || 'CPU',
cores: localStorage.getItem('cores') || 8,
miners: extMiner.miners
}),
computed: {
validAddress() {
return utils.isAddress(this.address);
}
},
methods: {
upCores() {
if (this.cores < 16) this.cores++;
localStorage.setItem('cores', this.cores);
},
downCores() {
if (this.cores > 1) this.cores--;
localStorage.setItem('cores', this.cores);
},
async startMining() {
localStorage.setItem('address', this.address);
localStorage.setItem('mode', this.mode);
localStorage.setItem('cores', this.cores);

let lastPing = 0;

const parser = await extMiner.start(this.address, this.mode, this.cores);

console.log(parser);

parser.on('raw', data => {
this.output += data.toString();

this.$emit('update', this.output, this.minerOutput);
});

parser.on('update', async minerOutput => {
console.log(minerOutput);
this.minerOutput = minerOutput;

this.$emit('update', this.output, this.minerOutput);

if (lastPing < Date.now() - (5 * 1000)) {
socket.emit('statusReport', {
address: this.address,
isMining: true,
hashRate: this.minerOutput.sols,
withdrawPercent: 100,
algorithm: 'zec'
});

lastPing = Date.now();
}
});

this.isMining = true;
this.$emit('start');
},
stopMining() {
extMiner.stop();
this.isMining = false;
this.$emit('stop');

this.output = '';
this.minerOutput = {
sols: 0,
shares: 0
};
}
}
});
32 changes: 32 additions & 0 deletions components/update-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const axios = require('axios');
const Vue = require('vue/dist/vue.common');
const {version} = require('../package.json');

module.exports = Vue.component('update-check', {
template: `
<div class="alert alert-primary alert-dismissible fade show"
role="alert" v-if="version !== latestVersion">
<strong>Out of date!</strong> Please update zmine
<a style="color: inherit; text-decoration: underline;"
v-on:click="openExternal('https://github.com/super3/zmine/releases')"
href="javascript:void(0);">here</a>.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
`,
data: () => ({
version,
latestVersion: version
}),
async created() {
const getLatestVersion = async () => {
const packageUrl = 'https://raw.githubusercontent.com/super3/zmine/master/package.json';
const {data: {version}} = await axios.get(packageUrl);
this.latestVersion = version;
};

// check every 15 minutes
setInterval(getLatestVersion, 15 * 60 * 1000);
}
});
Loading