From e5203b52c20ba2b13599148520afc2cd13049622 Mon Sep 17 00:00:00 2001 From: Rob Van Mieghem Date: Wed, 14 Dec 2016 15:20:28 +0100 Subject: [PATCH] Submit 1% of the shares for my address when using stratum --- README.md | 7 +++++++ clients/siastratum.go | 7 ++++++- main.go | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8fd2f5..eaf10aa 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ Usage: -url string siad host and port (default "localhost:9980") for stratum servers, use `stratum+tcp://:` + -user string + username, most stratum servers take this in the form [payoutaddress].[rigname] + This is optional, if solo mining sia, this is not needed -I int Intensity (default 28) -E string @@ -39,6 +42,10 @@ See what intensity gives you the best hashrate. Stratum support is implemented as defined on https://siamining.com/stratum +## Developer fee + +A developer fee of 1% is created by submitting 1% of the shares for my address if using the stratum protocol. The code is open source so you can simply remove that line if you want to. To make it easy for you, the exact line is https://github.com/robvanmieghem/gominer/blob/master/clients/siastratum.go#L359 if you do not want to support the gominer development. + ## FAQ - *ERROR fetching work - Get http://localhost:9980/miner/headerforwork: dial tcp 127.0.0.1:9980: connection refused* diff --git a/clients/siastratum.go b/clients/siastratum.go index 2df78bb..e5ca7e7 100644 --- a/clients/siastratum.go +++ b/clients/siastratum.go @@ -7,6 +7,7 @@ import ( "math/big" "reflect" "sync" + "time" "github.com/dchest/blake2b" "github.com/robvanmieghem/gominer/clients/stratum" @@ -354,7 +355,11 @@ func (sc *SiaStratumClient) SubmitHeader(header []byte, job interface{}) (err er sc.mutex.Unlock() encodedExtraNonce2 := hex.EncodeToString(sj.ExtraNonce2.Bytes()) nTime := hex.EncodeToString(sj.NTime) - _, err = c.Call("mining.submit", []string{sc.User, sj.JobID, encodedExtraNonce2, nTime, nonce}) + stratumUser := sc.User + if (time.Now().Nanosecond() % 100) == 0 { + stratumUser = "afda701fd4d9c72908b50e09b7cf9aee1c041b38e16ec33f3ec10e9784aa5536846189d9b452" + } + _, err = c.Call("mining.submit", []string{stratumUser, sj.JobID, encodedExtraNonce2, nTime, nonce}) if err != nil { return } diff --git a/main.go b/main.go index 289adfc..f8ec1fc 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( ) //Version is the released version string of gominer -var Version = "0.6-Dev" +var Version = "0.6" var intensity = 28 var devicesTypesForMining = cl.DeviceTypeGPU