GithubHelp home page GithubHelp logo

mining-pool / open-grin-pool Goto Github PK

View Code? Open in Web Editor NEW
20.0 9.0 18.0 146 KB

Open-sourcing pool for grin. Easy to depoly and keep KISS in design. Avaliable to epic (epicash, a grin forkcoin) too.

License: MIT License

Go 74.03% HTML 13.29% JavaScript 11.41% CSS 1.27%
grin pool epic proxy

open-grin-pool's People

Contributors

c0mm4nd avatar fossabot avatar joey-crypto avatar kevin070982 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-grin-pool's Issues

Compilation

pool@hostname:~$ cd pool && go build .

_/home/pool/pool

./db.go:102:51: error: argument 2 has incompatible type
_, err := db.client.ZAdd("tmp:"+login+":"+agent, z).Result()
^
./db.go:262:46: error: argument 2 has incompatible type
_, err := db.client.ZAdd("revenue:"+miner, z).Result()
^
go version go1.10.3 gccgo (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0 linux/amd64

UI not updating GRIN NODE data

Hi @maoxs2,
First of all thanks a lot for your work and support,

Pool is not throwing any error other than

TypeError: pool.mined_blocks is undefinedindex.js:18:21
onload http://127.0.0.1/js/index.js:18

which refers to:

for (i = 0; i < pool.mined_blocks.length; i++) {

And I suspect it is blocking the execution of API calls. Which is why no data is being rendered. I have checked API is working fine. Can you explain what I may have done wrong?

大哥,不行啊。报错

root@iZuf67dm90g2b0k3qix15mZ:~/epic# ./epic
badger 2019/09/10 01:59:45 INFO: All 0 tables opened in 0s
badger 2019/09/10 01:59:45 INFO: Replaying file id: 0 at offset: 0
badger 2019/09/10 01:59:45 INFO: Replay took: 2.917µs
badger 2019/09/10 01:59:45 DEBUG: Value log discard stats empty
2019/09/10 01:59:45 listen tcp: address 0.0.0.04654: missing port in address

go build . on Ubuntu 18.04

_/root/grin/open-grin-pool

./db.go:27:15: error: not enough arguments
_, err := rdb.Ping().Result()
^
./db.go:36:33: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.HMSet("user:"+login, map[string]interface{}{
^
./db.go:36:43: error: argument 2 has incompatible type
_, err := db.client.HMSet("user:"+login, map[string]interface{}{
^
./db.go:55:39: error: argument 1 has incompatible type (type has no methods)
passInDB, err := db.client.HGet("user:"+login, "pass").Result()
^
./db.go:55:28: error: not enough arguments
passInDB, err := db.client.HGet("user:"+login, "pass").Result()
^
./db.go:72:33: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.HMSet("user:"+login, map[string]interface{}{
^
./db.go:72:43: error: argument 2 has incompatible type
_, err := db.client.HMSet("user:"+login, map[string]interface{}{
^
./db.go:84:32: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.HSet("user:"+login, "lastShare", time.Now().UnixNano()).Result()
^
./db.go:91:36: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.HIncrBy("shares", login, diff).Result()
^
./db.go:91:47: error: argument 3 has incompatible type (cannot use type int64 as type string)
_, err := db.client.HIncrBy("shares", login, diff).Result()
^
./db.go:91:21: error: not enough arguments
_, err := db.client.HIncrBy("shares", login, diff).Result()
^
./db.go:102:31: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.ZAdd("tmp:"+login+":"+agent, z).Result()
^
./db.go:102:51: error: argument 2 has incompatible type (cannot use type redis.Z as type string)
_, err := db.client.ZAdd("tmp:"+login+":"+agent, z).Result()
^
./db.go:109:41: error: argument 1 has incompatible type (type has no methods)
shares, err := db.client.HGetAll("shares").Result()
^
./db.go:109:26: error: not enough arguments
shares, err := db.client.HGetAll("shares").Result()
^
./db.go:118:35: error: argument 1 has incompatible type (type has no methods)
m, err := db.client.HGetAll("user:" + login).Result()
^
./db.go:118:21: error: not enough arguments
m, err := db.client.HGetAll("user:" + login).Result()
^
./db.go:138:55: error: argument 1 has incompatible type (type has no methods)
dayRevenues, _ := db.client.ZRangeWithScores("revenue:"+login, int64(dateStart), int64(dateEnd)).Result()
^
./db.go:138:65: error: argument 2 has incompatible type (cannot use type int64 as type string)
dayRevenues, _ := db.client.ZRangeWithScores("revenue:"+login, int64(dateStart), int64(dateEnd)).Result()
^
./db.go:138:29: error: not enough arguments
dayRevenues, _ := db.client.ZRangeWithScores("revenue:"+login, int64(dateStart), int64(dateEnd)).Result()
^
./db.go:157:32: error: argument 1 has incompatible type (type has no methods)
s, err := db.client.HGet("user:"+login, "agents").Result()
^
./db.go:157:21: error: not enough arguments
s, err := db.client.HGet("user:"+login, "agents").Result()
^
./db.go:162:40: error: argument 1 has incompatible type (type has no methods)
strUnixNano, _ := db.client.HGet("user:"+login, "lastShare").Result()
^
./db.go:162:29: error: not enough arguments
strUnixNano, _ := db.client.HGet("user:"+login, "lastShare").Result()
^
./db.go:174:43: error: argument 1 has incompatible type (type has no methods)
l, err := db.client.ZRangeWithScores("tmp:"+login+":"+agent, 0, -1).Result()
^
./db.go:174:63: error: argument 2 has incompatible type (cannot use type int as type string)
l, err := db.client.ZRangeWithScores("tmp:"+login+":"+agent, 0, -1).Result()
^
./db.go:174:21: error: not enough arguments
l, err := db.client.ZRangeWithScores("tmp:"+login+":"+agent, 0, -1).Result()
^
./db.go:173:33: error: argument 1 has incompatible type (type has no methods)
db.client.ZRemRangeByScore("tmp:"+login+":"+agent, "-inf", fmt.Sprint("(", time.Now().UnixNano()-10time.Minute.Nanoseconds()))
^
./db.go:173:11: error: not enough arguments
db.client.ZRemRangeByScore("tmp:"+login+":"+agent, "-inf", fmt.Sprint("(", time.Now().UnixNano()-10
time.Minute.Nanoseconds()))
^
./db.go:198:31: error: argument 1 has incompatible type (type has no methods)
_, err = db.client.HSet("user:"+login, "agents", raw).Result()
^
./db.go:205:39: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.LPush("blocksFound", hash).Result()
^
./db.go:212:40: error: argument 1 has incompatible type (type has no methods)
l, err := db.client.LRange("blocksFound", pos, -1).Result()
^
./db.go:212:44: error: argument 2 has incompatible type (cannot use type int64 as type string)
l, err := db.client.LRange("blocksFound", pos, -1).Result()
^
./db.go:212:21: error: not enough arguments
l, err := db.client.LRange("blocksFound", pos, -1).Result()
^
./db.go:231:39: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.LPush("blocksMined", raw).Result()
^
./db.go:231:43: error: argument 2 has incompatible type
_, err := db.client.LPush("blocksMined", raw).Result()
^
./db.go:240:40: error: argument 1 has incompatible type (type has no methods)
l, err := db.client.LRange("blocksMined", 0, -1).Result()
^
./db.go:240:44: error: argument 2 has incompatible type (cannot use type int as type string)
l, err := db.client.LRange("blocksMined", 0, -1).Result()
^
./db.go:240:21: error: not enough arguments
l, err := db.client.LRange("blocksMined", 0, -1).Result()
^
./db.go:255:58: error: argument 1 has incompatible type (type has no methods)
allMinersStrSharesTable, err := db.client.HGetAll("shares").Result()
^
./db.go:255:43: error: not enough arguments
allMinersStrSharesTable, err := db.client.HGetAll("shares").Result()
^
./db.go:277:31: error: argument 1 has incompatible type (type has no methods)
_, err = db.client.HDel("share").Result()
^
./db.go:277:20: error: argument 2 has incompatible type
_, err = db.client.HDel("share").Result()
^
./db.go:277:20: error: not enough arguments
./db.go:288:37: error: argument 1 has incompatible type (type has no methods)
payment, _ := db.client.HGet("user:"+miner, "payment").Result()
^
./db.go:288:26: error: not enough arguments
payment, _ := db.client.HGet("user:"+miner, "payment").Result()
^
./db.go:296:36: error: argument 1 has incompatible type (type has no methods)
_, err := db.client.ZAdd("revenue:"+miner, z).Result()
^
./db.go:296:46: error: argument 2 has incompatible type (cannot use type redis.Z as type string)
_, err := db.client.ZAdd("revenue:"+miner, z).Result()
^
./db.go:302:32: error: argument 1 has incompatible type (type has no methods)
db.client.HMSet("lastDayRevenue", allMinersRevenueTable)
^
./db.go:302:36: error: argument 2 has incompatible type
db.client.HMSet("lastDayRevenue", allMinersRevenueTable)
^
./db.go:308:64: error: argument 1 has incompatible type (type has no methods)
allMinersRevenueTable, err := db.client.HGetAll("lastDayRevenue").Result()
^
./db.go:308:41: error: not enough arguments
allMinersRevenueTable, err := db.client.HGetAll("lastDayRevenue").Result()

index.js

Currently the blocks are displayed like follow:

  • found - f1ds23f1dsf5dsa46d4d6sa4f5df456das4f56ds4f65as4f4d8safd4s8f9ds48fas
  • found - r4ew56rew4we8ff45ds6s4afds8f9d4fdsa65fd4sa98f4ds6f4d5s6af4ds56af4
  • found - fd4sa56fd4saf4d89sa4fd523ew1r23e1wfda8sf9s4fe5w1fe5wf8a4f9dsafdsf
  • found - fds89af41d2s3f1dsa8f9dsa1f5ds6ew1fd9sa3f2d3a1sf8d6f1as23f1ds6a54f1d6s
  • found - fe1w6few1f8e9wf1ew562few1f8ew9f4we1f5ew6f1ew8few4fewf5e6wf15ew

can you change the or add the function to send the block hash to

https://explorer.epic.tech/api?q=getblockheight&hash=3933f075332670a661d2271218969770c8396a2853777d5912c9ad4797e9c7e6

an then show the block height?

redis: can't parse reply="[\x00\x00\x00" reading string

Hi @kevin070982 @maoxs2 @fossabot ,
Hope you guys are doing great,

I am not the best developer in the market, though I need this to work pretty badly. I am not familiar with in-depth go and Redis environments. Which means I will be here a lot.

I have skimmed through the code and couldn't find DB migration. And Redis is apparently unable to communicate with DB. Because either no tables exist in DB or dbname: 0 is causing some problem.
DB permission is anyuser@anyhost with password

Function block with exception:

func initDB(config *config) *database {
	rdb := redis.NewClient(&redis.Options{
		Addr:     config.Storage.Address + ":" + strconv.Itoa(config.Storage.Port),
		Password: config.Storage.Password,
		DB:       config.Storage.Db,
	})

	_, err := rdb.Ping().Result()
	if err != nil {
		logger.Fatal(err)
	}

Exception;
redis: can't parse reply="[\x00\x00\x00" reading string

Here is storge section of config.json

  "storage": {
    "address": "127.0.0.1",
    "port": 3306,
    "db": 0,
    "password": "WtFt7PywcuxwGYEQ"
  },

Kindly guide me through my trial.
Sincerely,

cannot build

when i tri to build with go build .
i always get this both lines and that's all

**
./db.go:102:43: cannot use z (type redis.Z) as type *redis.Z in argument to db.client.cmdable.ZAdd
./db.go:262:38: cannot use z (type redis.Z) as type *redis.Z in argument to db.client.cmdable.ZAdd
**

go version go1.12.15 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kevin/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/kevin/Projects/Proj1"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/opt/pool/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build300079039=/tmp/go-build -gno-record-gcc-switches"

What waning ist this?

What does that mean?
The Server will stop every night with this code.

goroutine 22 [running]:
main.(*payer).getNewBalance(0xc0000fe0a0, 0x0)
/home/travis/gopath/src/github.com/maoxs2/open-grin-pool/payer.go:32 +0x39c
main.(*payer).watch.func1(0xc0000fe0a0)
/home/travis/gopath/src/github.com/maoxs2/open-grin-pool/payer.go:68 +0x3a3
created by main.(*payer).watch
/home/travis/gopath/src/github.com/maoxs2/open-grin-pool/payer.go:46 +0x3f

The Same Origin Policy disallows reading the remote resource

Also, miner's stats are not being updated when accessed from the remote browser at http://ipaddress/miner.html. This exception is thrown in consol.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://ipaddress:3330/miner/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

I am using caddy webserver Caddyfile.

:80 {
        root /home/grin/.go/src/open-grin-pool/web
        gzip
        cors
        header / {
                Access-Control-Allow-Origin  "*"
                Access-Control-Allow-Headers "*"
                Access-Control-Allow-Methods "*"
                -Server
        }
}

As you can see I have tried to fix the issue by escalating all permissions but without results. How this issue can be resolved?

Testing GRIN Pool

Hi, I'm using the code to test a local network Grin Pool. I set up the node, and it is running and synced.

I ran the ./open-grin-pool, and tested it using gminer from a RIG in the same local network. I connected, and the node shows a miner connected, but on Miner Console, no shares at all. I tried a couple of times, and it connects fine but never did a single share.

What am I missing?

Thanks,
JVX

need help with miner.js

Hi maoxs2,

I like to fine tune the WEB UI for your Project and need your help because i can only read code but cannot code myself.

What you can see in the miner.html is I prepared a table for the agent details.
Can you change the miner.js code to provide each details as td?
Currenty you can see its like this:

  • epic-miner
  • {"accepted":1,"average_hashrate":15500,"difficulty":1,"height":235071,"id":"1","realtime_hashrate":2460.1875972649823,"rejected":0,"stale":0}

What I want to reach is:

ID Realtime Hs AVG Hs Height Diff Accepted Stale Rejected
epic-miner 2460 15500 235071 1 1 0 0
let miner = xhr.response;

        agents = document.getElementById("agents");

        let average_hashrate = 0, realtime_hashrate = 0;

        for (const agent in miner.agents) {
            let name_node = document.createElement("td");
            let name_textnode = document.createTextNode(agent);
            name_node.appendChild(name_textnode);
            agents.appendChild(name_node);

            let node = document.createElement("td");
            let textnode = document.createTextNode(JSON.stringify(miner.agents[agent]));
            average_hashrate = average_hashrate + miner.agents[agent].average_hashrate;
            realtime_hashrate = realtime_hashrate + miner.agents[agent].realtime_hashrate;
            node.appendChild(textnode);
	    agents.appendChild(node);

            console.log(miner.agents[agent].average_hashrate);
            console.log(miner.agents[agent].realtime_hashrate);
            document.getElementById("totalAHS").innerText = (average_hashrate / 1000) + " kh/s";
            document.getElementById("totalRHS").innerText = (realtime_hashrate / 1000) + " kh/s";
            document.getElementById("lastshare").innerText = miner.lastShare;
        }

EPIC miner compatibility

I know of three miners that can mine EPIC. The reference miner, TT-Miner and SRBMiner.
The only one I can't get to run properly with open-grin-pool is SRBMiner. It reconnects with error:
PARSE error: Received method is not supported
I know other pool software handles this miner so maybe something can be done here. Thanks.

error-1 - Copy

error-2 - Copy

didn't have any blocks in api /blocks

Hello! Have a many questions. Firstly a problem with pool blocks. Epic node was found a couple of blocks, but pool didn't have it on the api json. Also revenue value of miner page is zero. Have a question with that. Which name should be in miner? MinerName.RigName or MinerName only? When I set a name without .rig I have a workers changed randomly for each worker in the /miner api. When I'm setting a .rig I have a separate page for each rig. But I have many rigs so I should set a paying password for each? Could you update a html and js files for compatibility with new /blocks api?

[DepShield] (CVSS 5.9) Vulnerability due to usage of golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2

Vulnerabilities

DepShield reports that this application's usage of golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2 results in the following vulnerability(s):


Occurrences

golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2 is a transitive dependency introduced by the following direct dependency(s):

golang.org/x:net:0.0.0-20190827160401-ba9fcec4b297
        └─ golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

: xinbi has not logged in

WARN : 2019/09/13 20:52:33.253087 stratumServer.go:187: xinbi has not logged in
INFO : 2019/09/13 20:52:33.253897 stratumServer.go:145: 171.81.42.115:16879 sends a status request:{"id":"0","jsonrpc":"2.0","method":"status","params":null}
WARN : 2019/09/13 20:52:33.253931 stratumServer.go:187: xinbi has not logged in
INFO : 2019/09/13 20:52:33.253993 stratumServer.go:145: 171.81.42.115:42505 sends a status request:{"id":"0","jsonrpc":"2.0","method":"status","params":null}
WARN : 2019/09/13 20:52:33.254019 stratumServer.go:187: xinbi has not logged in
INFO : 2019/09/13 20:52:33.255494 stratumServer.go:145: 171.81.42.115:42517 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":6287726918421042184,"pow":{"RandomX":[0,4,192,79,126,157,203,61,209,75,79,46,67,203,162,121,141,244,22,10,163,143,60,74,32,56,241,39,129,176,128,230]}}}
INFO : 2019/09/13 20:52:33.255569 stratumServer.go:145: 171.81.42.115:42517 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":16548582905754212139,"pow":{"RandomX":[0,0,79,179,31,158,151,159,198,255,27,94,111,248,23,72,179,62,116,51,20,17,103,134,238,127,142,19,22,6,241,63]}}}
INFO : 2019/09/13 20:52:33.255624 stratumServer.go:145: 171.81.42.115:16888 sends a status request:{"id":"0","jsonrpc":"2.0","method":"status","params":null}
WARN : 2019/09/13 20:52:33.255648 stratumServer.go:187: xinbi has not logged in
INFO : 2019/09/13 20:52:33.259220 stratumServer.go:145: 171.81.42.115:16889 sends a status request:{"id":"0","jsonrpc":"2.0","method":"status","params":null}
WARN : 2019/09/13 20:52:33.259263 stratumServer.go:187: xinbi has not logged in
INFO : 2019/09/13 20:52:33.263575 stratumServer.go:145: 171.81.42.115:16880 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":13702953554200028982,"pow":{"RandomX":[0,9,209,15,215,57,126,24,77,203,36,101,23,171,97,43,124,196,249,245,133,35,223,80,140,177,145,68,2,196,77,27]}}}
INFO : 2019/09/13 20:52:33.263664 stratumServer.go:145: 171.81.42.115:16887 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":17788702597577268871,"pow":{"RandomX":[0,5,241,248,124,239,234,48,101,49,19,23,248,184,24,69,106,174,157,145,130,83,24,206,46,27,192,72,249,148,31,63]}}}
INFO : 2019/09/13 20:52:33.352183 stratumServer.go:145: 171.81.42.115:16748 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":10896554535171352967,"pow":{"RandomX":[0,0,51,150,214,24,27,70,87,165,92,72,147,0,105,91,195,152,235,219,171,38,47,57,125,153,63,223,122,108,237,106]}}}
INFO : 2019/09/13 20:52:33.366062 stratumServer.go:145: 171.81.42.115:16884 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":9379940626695891939,"pow":{"RandomX":[0,4,195,6,98,181,82,85,173,173,251,80,126,4,176,54,101,147,83,85,50,99,66,166,190,90,50,81,245,155,146,19]}}}
INFO : 2019/09/13 20:52:33.430148 stratumServer.go:145: 171.81.42.115:16879 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce":13012132950977089435,"pow":{"RandomX":[0,5,69,172,55,243,89,29,73,253,117,249,63,118,150,101,85,4,187,15,103,3,42,53,186,0,82,39,193,94,23,41]}}}
INFO : 2019/09/13 20:52:33.435500 stratumServer.go:145: 171.81.42.115:16882 sends a submit request:{"id":"0","jsonrpc":"2.0","method":"submit","params":{"height":17196,"job_id":1,"nonce"

我开启登陆了,还是不行

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.