Skip to content

Commit

Permalink
Updates to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
trey-jones committed Jan 28, 2018
1 parent 26f19dc commit 5ba4a22
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR $GOPATH/src/github.com/trey-jones/xmrwasp
RUN go install

WORKDIR /config
RUN touch config.json
VOLUME /config

ENTRYPOINT ["xmrwasp"]
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# XMR WASP

XMR is a **W**ebsocket **A**nd **S**tratum **P**roxy for Monero (XMR) miners. It accepts connections from miners over both websocket and plain TCP sockets using the monero stratum protocol. Written in Go and inspired heavily by XMRig-Proxy.
XMR is a **W**ebsocket **A**nd **S**tratum **P**roxy for Monero (XMR) miners. It accepts connections from miners over both websocket and plain TCP sockets using the monero stratum protocol. Written in Go and partly inspired by XMRig-Proxy.

## Goals

Expand All @@ -15,6 +15,7 @@ XMR is a **W**ebsocket **A**nd **S**tratum **P**roxy for Monero (XMR) miners. I
* Low system overhead per connection.
* Accepts most miners, including Browser Miners!
* Reduce Pool Load by using one connection for many miners.
* Release builds for many platforms (not all thoroughly tested)

## Installation

Expand All @@ -28,7 +29,7 @@ Move to a directory in your system PATH if desired.

As long as you don't pass the `-d` flag, `go get` will install the package as well.

`go get -u github.com/trey-jones/xmrwasp`
`go get github.com/trey-jones/xmrwasp`

### Get the Docker Image

Expand All @@ -55,7 +56,7 @@ To run in the background and write to a log file instead of stdout:
XMRWASP_URL='xmrpool.eu:3333' \
XMRWASP_LOGIN='47sfBPDL9qbDuF5stdrE8C6gVQXf15SeTN4BNxBZ3Ahs6LTayo2Kia2YES7MeN5FU7MKUrWAYPhmeFUYQ3v4JBAvKSPjigi.250+env_example' \
XMRWASP_PASSWORD='x' \
XMRWASP_LOG='xmrwasp.log'
XMRWASP_LOG='xmrwasp.log' \
xmrwasp &
tail -f xmrwasp.log
```
Expand All @@ -67,15 +68,15 @@ tail -f xmrwasp.log
```bash
docker run --rm -e 'XMRWASP_URL=xmrpool.eu:3333' \
-e 'XMRWASP_LOGIN=47sfBPDL9qbDuF5stdrE8C6gVQXf15SeTN4BNxBZ3Ahs6LTayo2Kia2YES7MeN5FU7MKUrWAYPhmeFUYQ3v4JBAvKSPjigi.250+env_example' \
-e 'XMRWASP_PASSWORD=x'
-e 'XMRWASP_PASSWORD=x' \
treyjones/xmrwasp
```

#### File Config

```bash
docker run --rm -v $(pwd)/example/example.config.json:/config \
treyjones/xmrwasp -c example.config.json
docker run --rm -v $(pwd)/example.config.json:/config/config.json \
treyjones/xmrwasp -c config.json
```

### Run the example with docker-compose
Expand Down Expand Up @@ -108,15 +109,23 @@ XMRWASP_STRPORT | strport | 1111 | Port to listen for stratum+tcp connections.
XMRWASP_WSS | wss | false | If true, try to serve websocket connections with TLS encryption.
XMRWASP_TLSCERT | tlscert | "" | Path to a TLS certificate file. Required for `wss = true`
XMRWASP_TLSKEY | tlscert | "" | Path to private key used to create the above certificate. Required for `wss = true`
XMRWASP_STATS | stats | 60 | XMR WASP will print a report to the log at this interval of seconds.
XMRWASP_STATS | stats | 60 | XMR WASP will print a report to the log at this interval (seconds)
XMRWASP_LOG | log | STDOUT | Path to your desired log file. Will be created if necessary. Takes precedence over `nolog`
XMRWASP_NOLOG | nolog | false | If true, no log will be generated and nothing will be written to STDOUT.
XMRWASP_DONATE | donate | 2 | Percentage of mining time to do jobs for the donation server.
XMRWASP_DEBUG | debug | false | Print debug messages to the log.

## Compatibility

The example is using [CryptoNoter](https://github.com/cryptonoter/CryptoNoter) for the browser miner. Since the Monero miner in that library is ripped straight from CoinHive, the latter can be used as well. If there are other browser miners that you want compatibility for, you can make an issue here, and I'll do my best to make it work.

Same goes for other mining software. Most any miner that can connect to a stratum mining pool should be able to connect to this proxy, excluding Claymore, [for now](#roadmap). This proxy can also connect to another instance of itself, which is how donate works. If you have compatibility problems, let me know!

I also aim to have excellent compatibility with mining pools. I would love to know if you find a pool that isn't working with this proxy. If you are a pool operator I would love to have a conversation about how I can better handle errors, etc. Pool operators possibly have a lot to gain from their users connecting through a proxy since it reduces the number of connections that must be maintained by the pool (by a factor of up to 1000 in this case).

## A Word About Responsibility

One of the primary features of this piece of software has to do with enabling Monero mining in the browser. The author of this project believes that browser mining **can** be a win-win. Even a win-win-win (users, website owners, and the blockchain). The users **can** win by not being subjected to ads, if browser mining proves to be lucrative enough for a site owner to stay afloat. But they can also lose, and lose badly, if the site owner doesn't excercise some restraint over the opportunity. Here are some things that you, as a site owner probably know, but might be tempted to *forget* for the sake of maybe mining a few extra Moneroj:
One of the primary features of this piece of software has to do with enabling Monero mining in the browser. The author of this project believes that browser mining **can** be a win-win. Even a win-win-win (users, website owners, and the blockchain). The users **can** win by not being subjected to ads, if browser mining proves to be lucrative enough for a site owner to stay afloat. But they can also lose, and lose badly, if the site owner doesn't excercise some restraint over the opportunity. Here are some things that you, as a site owner, probably know, but might be tempted to *forget* for the sake of maybe mining a few extra Moneroj:

* Don't mine on mobile devices, lest you destroy their battery and their ability to browse your site.
* Don't mine without telling your users that you are doing it.
Expand All @@ -125,18 +134,18 @@ One of the primary features of this piece of software has to do with enabling Mo

## Roadmap

* Max Proxy Lifetime and Eventual Spindown
* Max connection lifetime and eventual spindown
* Web Interface exposing current status and history
* Multiple Pool Configs for fallback
* Multiple pool configs for fallback
* Performance Improvements: Faster release of memory on broken connections
* User Feedback?
* TLS support for stratum listeners
* TLS support for stratum+tcp listeners
* Just tons of little things that could be better
* Linux repositories?
* Linux package manager repositories?

## Support This Project

The project has a donation mechanism built in. By default it donates (without breaking your pool connection) 1 minute and 12 seconds (donate=2) of every hour of mining. This is configurable down to 36 seconds (donate=1) per hour. Or higher if you feel generous. Saavy users of course may find that they can disable the donation mechanism. If you do so, consider a one time donation if you would be so kind:
The project has a donation mechanism built in. By default it donates for 1 minute and 12 seconds (donate=2) of every hour. It does this without breaking your pool connection. This is configurable down to 36 seconds (donate=1) per hour. Or higher if you feel generous. Saavy users of course may find that they can disable the donation mechanism. If you do so, consider a one time donation.

* Monero: `47sfBPDL9qbDuF5stdrE8C6gVQXf15SeTN4BNxBZ3Ahs6LTayo2Kia2YES7MeN5FU7MKUrWAYPhmeFUYQ3v4JBAvKSPjigi`
* Bitcoin: `1NwemnZSLhJLnNUbzXvER6yNX55pv9tAcv`
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ func Get() *Config {
var err error
instantiation.Do(func() {
if File != "" {
f, err := os.Open(File)
var f *os.File
f, err = os.Open(File)
if err != nil {
log.Fatal("open config file failed: ", err)
return
Expand Down
2 changes: 1 addition & 1 deletion example.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"wsport": "8888",
"wsport": 8888,

"login": "47sfBPDL9qbDuF5stdrE8C6gVQXf15SeTN4BNxBZ3Ahs6LTayo2Kia2YES7MeN5FU7MKUrWAYPhmeFUYQ3v4JBAvKSPjigi.250+example_config",
"password": "x",
Expand Down
8 changes: 2 additions & 6 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ type Proxy struct {

ready bool

currentJob *Job
currentBlob []byte
currentNonce uint32
prevJob *Job
currentJob *Job
prevJob *Job

donateJob *Job
donateBlob []byte
donateNonce uint32
prevDonateJob *Job

jobMu sync.Mutex
Expand Down
1 change: 0 additions & 1 deletion proxy/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func setEnv() {
os.Setenv("XMRWASP_LOGIN", "testwallet")
os.Setenv("XMRWASP_PASSWORD", "x")
os.Setenv("XMRWASP_URL", mockPoolURL)
// os.Setenv("XMRWASP_DONATE", "98")
os.Setenv("XMRWASP_VALIDATESHARES", "1")
}

Expand Down

0 comments on commit 5ba4a22

Please sign in to comment.