Insight - Automated Stratum V2 mining pool for Nervos

ckb version: 0.38.1 (e1fd4b0 2020-12-02) This version is too old, ckb has done a hardfork, the minimum support version v0.103.0, it is recommended to use the latest version provided by the official Releases · nervosnetwork/ckb · GitHub

Full node wallet Neuron GitHub - nervosnetwork/neuron: Neuron: Nervos CKB Wallet
app wallets: imtoken, safepal

Thanks… what I’m trying to do here is to have my own node and pool for mining with my own asics.
I was able to get the whole startum working but the node does not sync because it is old version.
Do you know how I can run all these dockers updated to so I can run my own pool? or do you know anything simpler than this for mining from asic for nervos?

Nervos Network (CKB) Eaglesong | Mining Pools You can join to these mining pools.

thanks buddy, of course I know that… I want to run my own node …let me know if you can help!

Look, I run everything from scratch, I modify .env to reflect ckb node version 0.107.0, then I run cargo update on deprecated packages, then compile and everything go without error, but the ckb do not start and see the log:

/btcpool-docker-compose$ sudo docker ps
CONTAINER ID   IMAGE                                                        COMMAND                  CREATED         STATUS                           PORTS                                                                                                                                                                                                                            NAMES
bf04e5a663eb   btcpool-docker-compose_nodebridge                            "./start.sh"             8 minutes ago   Up 8 minutes                                                                                                                                                                                                                                                      btcpool-docker-compose_nodebridge_1
cad5fc8833a7   btccom/btcpool:2019.09.26-17-support-ckb-mining_bch-0.18.5   "/entrypoint.sh blkm…"   8 minutes ago   Up 8 minutes                                                                                                                                                                                                                                                      btcpool-docker-compose_blockmaker_1
8739d49ce9fc   btccom/btcpool:2019.09.26-17-support-ckb-mining_bch-0.18.5   "/entrypoint.sh /bin…"   8 minutes ago   Up 8 minutes                     0.0.0.0:1800->1800/tcp, ::                                                                                               :1800->1800/tcp, 0.0.0.0:9101->9101/tcp, :::9101->9101/tcp                                              btcpool-docker-compose_btcpool_1
e575df6fa7b8   btccom/btcpool:2019.09.26-17-support-ckb-mining_bch-0.18.5   "/entrypoint.sh jobm…"   8 minutes ago   Up 8 minutes                                                                                                                                                                                                                                                      btcpool-docker-compose_jobmaker_1
09934c68060d   confluentinc/cp-kafka:5.5.1                                  "/etc/confluent/dock…"   8 minutes ago   Up 8 minutes                     127.0.0.1:9092->9092/tcp,                                                                                                127.0.0.1:19092->19092/tcp, 9101/tcp                                                                    btcpool-docker-compose_kafka_1
aa1ef90c8f81   btcpool-docker-compose_miner-list                            "./app"                  8 minutes ago   Up 8 minutes                     127.0.0.1:8000->8000/tcp                                                                                                                                                                                                         btcpool-docker-compose_miner-list_1
8d04fa90cbdb   danielqsj/kafka-exporter                                     "/bin/kafka_exporter…"   8 minutes ago   Up 8 minutes                     0.0.0.0:9308->9308/tcp, ::                                                                                               :9308->9308/tcp                                                                                         btcpool-docker-compose_kafkaexporter_1
0c4d9c668c9b   mariadb                                                      "docker-entrypoint.s…"   8 minutes ago   Up 8 minutes                     0.0.0.0:3306->3306/tcp, ::                                                                                               :3306->3306/tcp                                                                                         btcpool-docker-compose_mysql_1
a5799aa0c5e3   redis:latest                                                 "docker-entrypoint.s…"   8 minutes ago   Up 8 minutes                     127.0.0.1:6379->6379/tcp                                                                                                                                                                                                         btcpool-docker-compose_redis_1
ec1095ffa4aa   nervos/ckb:v0.107.0                                          "/bin/docker-entrypo…"   8 minutes ago   Restarting (65) 25 seconds ago                                                                                                                                                                                                                                    btcpool-docker-compose_ckb-node_1
8c34b4313b6f   stefanprodan/caddy                                           "/sbin/tini -- caddy…"   8 minutes ago   Up 8 minutes                     0.0.0.0:3000->3000/tcp, ::                                                                                               :3000->3000/tcp, 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 0.0.0.0:9093->9093/tcp, :::9093->9093/tcp   caddy
a28b3e24dbe8   prom/alertmanager:v0.21.0                                    "/bin/alertmanager -…"   8 minutes ago   Up 8 minutes                     9093/tcp                                                                                                                                                                                                                         alertmanager
31333290e5c0   gcr.io/cadvisor/cadvisor:v0.37.0                             "/usr/bin/cadvisor -…"   8 minutes ago   Up 8 minutes (unhealthy)         8080/tcp, 0.0.0.0:9080->90                                                                                               80/tcp, :::9080->9080/tcp                                                                               cadvisor
9ebcdf089f17   confluentinc/cp-zookeeper:5.5.1                              "/etc/confluent/dock…"   8 minutes ago   Up 8 minutes                     2888/tcp, 127.0.0.1:2181->                                                                                               2181/tcp, 3888/tcp                                                                                      btcpool-docker-compose_zookeeper_1
9f5f998c860f   grafana/grafana:7.2.1                                        "/run.sh"                8 minutes ago   Up 8 minutes                     3000/tcp                                                                                                                                                                                                                         grafana
0368a3e6a458   prom/node-exporter:v1.0.1                                    "/bin/node_exporter …"   8 minutes ago   Up 8 minutes                     0.0.0.0:9100->9100/tcp, ::                                                                                               :9100->9100/tcp                                                                                         nodeexporter
d19c58ca9a7f   prom/prometheus:v2.22.0                                      "/bin/prometheus --c…"   8 minutes ago   Up 8 minutes                     9090/tcp                                                                                                                                                                                                                         prometheus

log:

/btcpool-docker-compose$ sudo su
root@ip-172-31-0-241:/home/ubuntu/btcpool-docker-compose# docker logs -f --tail 10 ec1095ffa4aa
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }
Config Error: Error { inner: ErrorInner { kind: Custom, line: Some(177), col: 0, at: Some(6387), message: "unknown field `threads`, expected `exporter`", key: ["metrics"] } }

do you have any idea how to fix this?

Thank you!

Dude did you run it successfully?

Hey! Thanks for asking.

Well yes and no… all seems to be running, I modified the database a little bit (still need more updates) miner-list does not work properly, only alice and bob work, if I rebuild the docker still does not allow to add more users, last but now least, if I try to connect to my asic miner I can see it in the log of btcpool like this:

btcpool_1     | I0315 00:48:26.847534     8 StratumSessionCkb.cc:160] receive handleRequest_Subscribe jparams : ["GodMiner/2.0.0",null]
btcpool_1     | I0315 00:48:26.847616     8 StratumSessionCkb.cc:175] send mining  :{"id":1,"result":["null","000004",5],"error":null}
btcpool_1     | I0315 00:48:26.869228     8 StratumServer.cc:1187] socket closed

But never authorize it, if I use the ckb-miner it works (only with alice or bob) , I mean it is authorized but then it does not work.

from the asic miner side this is what I get:

JSON-RPC call failed: [
   2147483647,
   "Unknown",
   null
], req_id=1"

I tried 0.103.0 and 0.108.0 not worked, I also tried:

of course I run cargo updates.
explored with this:

this is a log snapshot of how it is running right now:

btcpool_1     | I0321 14:46:52.782593     9 StratumServer.cc:367] remove expired stratum job, id: 7213009789624778753, time: 2023-03-21 14:41:52
jobmaker_1    | I0321 14:46:53.735181    19 JobMaker.cc:121] received CkbRawGw message len: 286
jobmaker_1    | I0321 14:46:53.735239    19 JobMakerCkb.cc:88] remove timeout work: 2023-03-21 14:45:53|1679409953, height:9456218, headerHash:0x299ebf6ef3b02b67a72287948e2d7c5ff7b4cb8b276715b1eaad480d18ad7d53
jobmaker_1    | I0321 14:46:53.735283    19 JobMaker.cc:127] handleMsg returns true, new stratum job
jobmaker_1    | I0321 14:46:53.735299    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410007,"work_id":36980,"jobid":7213011056640131073,"pow_hash":"0xbd419d242780d5bd3895102ac4cd97747a1af8bef624401c3add900ac64574ad","parent_hash":"0x8659b37dbd09d3f9ef2e47a4faf4d3edc0722eef78d7cc7e26bddd06afcfa019","height":9456223,"target":"0xa158b00000000000000000000000000000000000000000000","timestamp":1679410007720}
btcpool_1     | E0321 14:46:53.798205     9 StratumServer.cc:310] jobId already existed
btcpool_1     | I0321 14:46:54.808806     9 StratumServer.cc:367] remove expired stratum job, id: 7213009798214713345, time: 2023-03-21 14:41:54
ckb-node_1    | 2023-03-21 14:46:55.306 +00:00 ChainService INFO ckb_chain::chain  block: 9456223, hash: 0xb9b4b0cda4cc71e5c5a61241cf89d84b2886c6ec2f65dc84baab2cf69d178d40, epoch: 7303(1233/1394), total_diff: 0x4d556516ef4f3fa0d888e, txs: 1
ckb-node_1    | 2023-03-21 14:46:55.749 +00:00 GlobalRt-8 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 6, size: 51089/596370, cycles:20258483/3500000000
jobmaker_1    | I0321 14:46:55.763341    19 JobMaker.cc:121] received CkbRawGw message len: 286
jobmaker_1    | I0321 14:46:55.763382    19 JobMakerCkb.cc:88] remove timeout work: 2023-03-21 14:45:55|1679409955, height:9456218, headerHash:0xe3dfb9ca729495d6e3c06ec631338f5239a0756af9d8ca69d3591a0aa102e366
jobmaker_1    | I0321 14:46:55.763432    19 JobMaker.cc:127] handleMsg returns true, new stratum job
jobmaker_1    | I0321 14:46:55.763440    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410015,"work_id":36982,"jobid":7213011090999869441,"pow_hash":"0xcf4d6293ee3505cc0723401d00b6a3d6c3875e4ce5fa307a44e2cf947ff4df28","parent_hash":"0xb9b4b0cda4cc71e5c5a61241cf89d84b2886c6ec2f65dc84baab2cf69d178d40","height":9456224,"target":"0xa158b00000000000000000000000000000000000000000000","timestamp":1679410015750}
btcpool_1     | I0321 14:46:55.841632     9 StratumServerCkb.cc:181] broadcast stratum job 6419c35f00000001
btcpool_1     | I0321 14:46:55.841667     9 StratumServerCkb.cc:188] received new height stratum job, height: 9456224, hash: 0xcf4d6293ee3505cc0723401d00b6a3d6c3875e4ce5fa307a44e2cf947ff4df28
jobmaker_1    | I0321 14:46:57.765517    19 JobMaker.cc:121] received CkbRawGw message len: 286
jobmaker_1    | I0321 14:46:57.765570    19 JobMakerCkb.cc:88] remove timeout work: 2023-03-21 14:45:57|1679409957, height:9456218, headerHash:0x60246eb89558b0f93d82e92b24829ea918d2b2636c2811997ddc59bdb5eafefc
jobmaker_1    | I0321 14:46:57.765590    19 JobMaker.cc:127] handleMsg returns true, new stratum job
jobmaker_1    | I0321 14:46:57.765640    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410015,"work_id":36982,"jobid":7213011090999869441,"pow_hash":"0xcf4d6293ee3505cc0723401d00b6a3d6c3875e4ce5fa307a44e2cf947ff4df28","parent_hash":"0xb9b4b0cda4cc71e5c5a61241cf89d84b2886c6ec2f65dc84baab2cf69d178d40","height":9456224,"target":"0xa158b00000000000000000000000000000000000000000000","timestamp":1679410015750}
btcpool_1     | E0321 14:46:57.846483     9 StratumServer.cc:310] jobId already existed

obmaker_1    | I0321 14:49:54.457437    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410192,"work_id":37019,"jobid":7213011851209080833,"pow_hash":"0xaeaff853aefaae4eb93f4b9693d4fad44bff46c1e87df849898d61cdccb4ec22","parent_hash":"0xcc83e88557a41a600824103bd68e51b0156405e7ed515fbbf6d9d244269474d6","height":9456244,"target":"0xa158b00000000000000000000000000000000000000000000","timestamp":1679410192445}
btcpool_1     | E0321 14:49:54.511085     9 StratumServer.cc:310] jobId already existed
btcpool_1     | I0321 14:49:55.521283     9 StratumServer.cc:367] remove expired stratum job, id: 7213010575603793921, time: 2023-03-21 14:44:55
btcpool_1     | I0321 14:49:55.521646     9 StratumSession.cc:104] client connect, ip: (HIDDEN)
btcpool_1     | I0321 14:49:55.524391     9 StratumSessionCkb.cc:160] receive handleRequest_Subscribe jparams : ["GodMiner/2.0.0",null]
btcpool_1     | I0321 14:49:55.524417     9 StratumSessionCkb.cc:175] send mining  :{"id":1,"result":["null","00000d",5],"error":null}
btcpool_1     | I0321 14:49:55.551331     9 StratumServer.cc:1187] socket closed
jobmaker_1    | I0321 14:49:56.460327    19 JobMaker.cc:121] received CkbRawGw message len: 286
jobmaker_1    | I0321 14:49:56.460424    19 JobMakerCkb.cc:88] remove timeout work: 2023-03-21 14:48:56|1679410136, height:9456239, headerHash:0xa4dc1323d3f9b95e040e25fc6496d7ac11b665ad9ef55a339b45c1be03cae79e
jobmaker_1    | I0321 14:49:56.460456    19 JobMaker.cc:127] handleMsg returns true, new stratum job
jobmaker_1    | I0321 14:49:56.460485    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410192,"work_id":37019,"jobid":7213011851209080833,"pow_hash":"0xaeaff853aefaae4eb93f4b9693d4fad44bff46c1e87df849898d61cdccb4ec22","parent_hash":"0xcc83e88557a41a600824103bd68e51b0156405e7ed515fbbf6d9d244269474d6","height":9456244,"target":"0xa158b



jobmaker_1    | I0321 14:50:16.527736    19 JobMaker.cc:127] handleMsg returns true, new stratum job
jobmaker_1    | I0321 14:50:16.527745    19 JobMaker.cc:139] new CkbJob job: {"created_at_ts":1679410192,"work_id":37019,"jobid":7213011851209080833,"pow_hash":"0xaeaff853aefaae4eb93f4b9693d4fad44bff46c1e87df849898d61cdccb4ec22","parent_hash":"0xcc83e88557a41a600824103bd68e51b0156405e7ed515fbbf6d9d244269474d6","height":9456244,"target":"0xa158b00000000000000000000000000000000000000000000","timestamp":1679410192445}
btcpool_1     | E0321 14:50:16.543165     9 StratumServer.cc:310] jobId already existed
btcpool_1     | I0321 14:50:16.543277     9 StratumSession.cc:108] close stratum session, ip: (HIDDEN), name: "", agent: "GodMiner/2.0.0"
btcpool_1     | I0321 14:50:16.543285     9 StratumSession.cc:108] close stratum session, ip: (HIDDEN), name: "", agent: "GodMiner/2.0.0"
btcpool_1     | I0321 14:50:17.554550     9 StratumServer.cc:367] remove expired stratum job, id: 7213010670093074433, time: 2023-03-21 14:45:17

I think database and code needs to be updated for the net RPCs and fix the miner-list thing.

Any help will be really appreciated.

Thank you!

As you can see above, not 100% but close…

Are you running the nodebridge container with this GitHub - antpoolcom/ckbNodeBridge

yes… and about the height:

2023-03-22 01:34:47.781 +00:00 ChainService INFO ckb_chain::chain  [block_verifier] block number: 9460497, hash: Byte32(0x11a8690a02c1ede109035d2b843d95d997495b59c728861a2b3f1352745af4f1), size:1513/597000, cycles: 1793447/3500000000
2023-03-22 01:34:47.781 +00:00 ChainService INFO ckb_chain::chain  block: 9460497, hash: 0x11a8690a02c1ede109035d2b843d95d997495b59c728861a2b3f1352745af4f1, epoch: 7306(946/1595), total_diff: 0x4d6d8cf44f5c1557a75db, txs: 2
2023-03-22 01:34:48.600 +00:00 ChainService INFO ckb_chain::chain  [block_verifier] block number: 9460498, hash: Byte32(0xbb54e2a47dfc9ff819add237f7fbb44e6308ab975d5bfc33d8c2f419e964d2eb), size:1175/597000, cycles: 1709852/3500000000
2023-03-22 01:34:48.601 +00:00 ChainService INFO ckb_chain::chain  block: 9460498, hash: 0xbb54e2a47dfc9ff819add237f7fbb44e6308ab975d5bfc33d8c2f419e964d2eb, epoch: 7306(947/1595), total_diff: 0x4d6d8e5e249091d4db9b4, txs: 2
2023-03-22 01:34:49.623 +00:00 GlobalRt-2 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 1, size: 3436/596320, cycles:6599423/3500000000
2023-03-22 01:34:53.628 +00:00 GlobalRt-10 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 1, size: 3436/596270, cycles:6599423/3500000000
2023-03-22 01:34:57.633 +00:00 GlobalRt-4 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 1, size: 3436/596250, cycles:6599423/3500000000
2023-03-22 01:35:01.640 +00:00 GlobalRt-11 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 1, size: 3436/596240, cycles:6599423/3500000000
2023-03-22 01:35:07.829 +00:00 GlobalRt-8 INFO ckb_relay  RelayProtocol.disconnected peer=SessionId(63171)
2023-03-22 01:35:07.829 +00:00 GlobalRt-6 INFO ckb_sync::synchronizer  SyncProtocol.disconnected peer=SessionId(63171)
2023-03-22 01:35:10.294 +00:00 ChainService INFO ckb_chain::chain  [block_verifier] block number: 9460499, hash: Byte32(0xdb9f304f537acdcbbb71adb1ccce73015aa2a599cec908ddb36c6a474a218271), size:4076/597000, cycles: 6599423/3500000000
2023-03-22 01:35:10.295 +00:00 ChainService INFO ckb_chain::chain  block: 9460499, hash: 0xdb9f304f537acdcbbb71adb1ccce73015aa2a599cec908ddb36c6a474a218271, epoch: 7306(948/1595), total_diff: 0x4d6d8fc7f9c50e520fd8d, txs: 2
2023-03-22 01:35:11.662 +00:00 GlobalRt-11 INFO ckb_tx_pool::process  [get_block_template] candidate txs count: 5, size: 134794/596290, cycles:466763436/3500000000

mainnet

don’t worry about the front end for now. are you able to connect an ASIC miner and mine? - I dont believe it… code needs to be updated… just a little but needs to be updated, database and RPCJSON.
If you are mining and the only problem is the front end, let me know and I will solve the front end issue.

nodebridge I failed to run, can you commit your changes to your repo? This will make it easier for others to make fixes on top of yours.

once is fully functional I will update… right now and fixing based on reverse engineering (or trying).
What kind of miner you have for testing?

Were you able to get the pool going?

he eventually ran into the k7 kicking back this over RPC

btcpool_1 | I0326 01:09:38.223323 9 StratumSession.cc:104] client connect, ip: 168.110.60.207 btcpool_1 | I0326 01:09:38.223613 9 StratumSessionCkb.cc:160] receive handleRequest_Subscribe jparams : [“GodMiner/2.0.0”,null] btcpool_1 | I0326 01:09:38.223685 9 StratumSessionCkb.cc:175] send mining :{“id”:1,“result”:[“null”,“000002”,5],“error”:null} btcpool_1 | I0326 01:09:38.243556 9 StratumServer.cc:1187] socket closed
and … this is what I see in the k7 LOG (k7 nminer):
time=“2023-03-27 18:27:49” level=error pid=983 msg=“n1size 3, n2size 5, n1size + n2size != 16, in parse_extranonce” time=“2023-03-27 18:27:49” level=error pid=983 msg=“JSON-RPC call failed: [ 2147483647, “Unknown”, null ], req_id=1”
the k7 miner does not like “something” from the pool

Do you have the latest code? I can check it out.

i pinged @gmenarvino on discord, get back to you soon

He says it runs on Docker 1.28.5