Bitcoin Forum
December 10, 2024, 12:01:31 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3]  All
  Print  
Author Topic: [Guide] Solo mine testnet bitcoins with cgminer, Bitcoin Core, and a Compac F  (Read 1913 times)
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
May 29, 2024, 11:22:05 AM
Merited by ABCbits (1)
 #41

Aside from low hashrate, you probably better use solo mining pool (such as ckpool or kano) which supposed to offer better block propagation speed.

I know, alledgedly pools are supposed to have lower latency.

TBH I'm not so sure given I have a low latency GBit fibre connection to the internet I cant see why it'd be any less effective than a server in a data centre somewhere that only has a 400Mbit capped link tied to it. Unless the other bitcoin nodes are located in the same data centre, the latency between nodes would be similar.

Anyway, this was purely a fun experiment and technical exercise to see if I could get it to work.

I merged the changes from https://github.com/cmmodtools/cgminer into the last maintained version of cgminer 4.12.1 https://github.com/kanoi/cgminer/ and getting it to build, that was technical exercise 1.

Then the challenge was getting bitcoind running and accepting RPC connections for testnet, that worked ok then moving over to mainnet.

Once I'd figured that the named block in the config file was [main] not [MainNet] or [mainnet] it all started to work as it did for testnet, although it did take nearly 3 days to sync the blockchain.

Its been running overnight and statistically its performing similar to that of a pool looking at the volume of data exchanged and the current best share.

There's nothing presently that makes me think solo mining to a pool has any advantage, of course I dont know how things would perform should it hit a block and if the block would successfully propagate. Like I said it could be a very long time before I found out.


Never the less with that said, I guess it's easier to rely on someone else's technical expertise in setting up the bitcoind and maintaining the back-end of things.

ABCbits
Legendary
*
Offline Offline

Activity: 3080
Merit: 8175


Crypto Swap Exchange


View Profile
May 30, 2024, 09:09:14 AM
 #42

Aside from low hashrate, you probably better use solo mining pool (such as ckpool or kano) which supposed to offer better block propagation speed.
I know, alledgedly pools are supposed to have lower latency.

TBH I'm not so sure given I have a low latency GBit fibre connection to the internet I cant see why it'd be any less effective than a server in a data centre somewhere that only has a 400Mbit capped link tied to it. Unless the other bitcoin nodes are located in the same data centre, the latency between nodes would be similar.

--snip--

Never the less with that said, I guess it's easier to rely on someone else's technical expertise in setting up the bitcoind and maintaining the back-end of things.

Aside from latency, i also hear claim that node run by mining pool connected to other node which belong to different mining pool and node run by major company. Anyway, i agree the biggest reason to use them is we don't have to setup and maintain stuff.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
May 30, 2024, 09:58:54 AM
Merited by Halab (2), vapourminer (1), BitcoinSoloMiner (1)
 #43

Aside from latency, i also hear claim that node run by mining pool connected to other node which belong to different mining pool and node run by major company. Anyway, i agree the biggest reason to use them is we don't have to setup and maintain stuff.

I don't think the nodes connected to other nodes is any different to any other machine connecting to a server elsewhere on the net, it still has to traverse the same gateways, routers, switches and other network infrastructure.

Bitcoind looks like it handles all of the node to node connections automatically anyway. In that respect it looks no different from any other DNS lookup or TCP/IP communication.

Presently I just can't see anything to support the claim that mining solo to a pool is any better than mining directly to bitcoind beyond the fact that someone else has taken the time to set-up and maintain the pool and all the backend side of it reducing the initial technical hassles.

Once I have a couple more mining boards built, I'll point them at my bitcoind server and let them run indefinately, if by chance (and it is a remote chance) they hit a block I'll celebrate that here!

Cheers

G.
BitcoinSoloMiner
Member
**
Offline Offline

Activity: 148
Merit: 25


View Profile
July 01, 2024, 03:12:36 PM
 #44

What needs to be changed for this to work on main net? Remove testnet=1 ?


I know I'm late to the party with this one but, for mainnet you have to change the [test] to [main] as well as removing testnet=1

Code:
txindex=1
server=1
[main]
rpcport=5000
rpcallowip=YOUR_MINER_IP
rpcuser=YOUR_RPC_USER
rpcpassword=YOUR_RPC_PASSWORD
rpcbind=0.0.0.0

Anyone's guess as to if it'll actually mine a valid block, but it does seem to be running.

Code:
[2024-05-28 14:41:03.526] Solo mining to valid address: 3MbtxahpbkC1fGhvcWR7Ja38u8cwN9wzY8

With 500GH/s pointed at it, I guess I'll be waiting a while to find out.  Grin

Thanks for the reply, I am going to get a bitaxe supra I think and do this method. What is giving you 500G/H? How much power?

Goodluck!
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
July 01, 2024, 04:55:04 PM
 #45

-SNIP-

Thanks for the reply, I am going to get a bitaxe supra I think and do this method. What is giving you 500G/H? How much power?

Goodluck!

I have something of my own creation a somewhat overclocked (725Mhz) BM1397 that averages 480GH/s, its using about 18Watts at the DC port including the power for the fan and the RaspberryPI Zero 2W thats controlling it.

Presently its pointing at CK pool, but I had it running on my local node for about a week without any issue.

Updating Kano's CGMiner is a bit of a chore but its achievable provided you follow the differences carefully.

Good luck!
vjudeu
Copper Member
Legendary
*
Offline Offline

Activity: 909
Merit: 2290



View Profile
July 09, 2024, 07:28:17 AM
Merited by vapourminer (1)
 #46

A bash script to mine coins on derived addresses, to improve privacy:
Code:
$ cat mining4.sh
nonce=0
while [ 1 ]
do
  numberofblocks=$(./bitcoin-cli -testnet4 getblockcount)
  address=$(./bitcoin-cli -testnet4 deriveaddresses "wpkh([badc0ded/84h/1h/0h]tpub.../0/*)#00000000" "[$numberofblocks,$numberofblocks]" | grep "tb1q")
  echo ./bitcoin-cli -testnet4 generatetoaddress 1 $address 100000000 > address.sh
  ./address.sh
  echo nonce: $nonce
  ((nonce=nonce+1))
done
Of course, instead of bitcoin-cli, the same trick can be used to mine on mining pools. However, note that many pools require producing at least N shares before paying anything, so make sure you produce enough, before you switch to some other address. But: as far as I understand it, that method of switching addresses seems to be good enough, right?

I also thought about mining on silent payment addresses, but I have to think about deriving it properly, because existing clients don't understand "sp1q" addresses.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nullama (OP)
Hero Member
*****
Offline Offline

Activity: 1190
Merit: 985



View Profile
July 09, 2024, 12:29:46 PM
 #47

~snip~
I merged the changes from https://github.com/cmmodtools/cgminer into the last maintained version of cgminer 4.12.1 https://github.com/kanoi/cgminer/ and getting it to build

Nice, I wonder if kano would be OK bringing those changes upstream.

At least for me, @kano branch of cgminer is the one that I use whenever I build cgminer after CKolivas stopped development.

Hopefully there is only one branch with all the required changes.

░░░▄████████████████████████
░▄████████████████████████████
████████████████████████████
████████████████████████████
█████████████████████████████
█████████████████████████████
██████████████████████████████
████████████████████████████▀
█████████████████████████▀
████████████████████
█████████████████████
██████████████████████
░░███████████████████▀
█████████████████████████
█████████████████████████
█████░▄▄█████████████████
█████░███████████████████
█████░███████░███████████
████████████░████████████
██████████░█████████████
██████████░██████████████
██████████░██████████████
██████████░██████████████
████████░████████████████
█████████████████████████
█████████████████████████
 100% 
WELCOME BONUS
 UP TO 15% 
CASHBACK
 NO KYC 
PROVABLY FAIR
█████████████████████████
█████████████████████████
█████████████████████████
█████░██░░██░██░░██░█████
████░████████████████████
█████████░░███░░█████████
█████░░██████████████████
███████░░████████████████
█████████░█████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
 
  Play Now  
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
July 09, 2024, 01:57:00 PM
Merited by vapourminer (1)
 #48

~snip~
I merged the changes from https://github.com/cmmodtools/cgminer into the last maintained version of cgminer 4.12.1 https://github.com/kanoi/cgminer/ and getting it to build

Nice, I wonder if kano would be OK bringing those changes upstream.

At least for me, @kano branch of cgminer is the one that I use whenever I build cgminer after CKolivas stopped development.

Hopefully there is only one branch with all the required changes.

The changes aren't that difficult to do if you're careful patching them into the correct locations. If I recall most of it is in cgminer.c and there's only a handfull of functions that are affected.

I'm no expert on driving GIT otherwise I'd create my own branch with the adaptations already done.

I don't know if Kano is interested in porting in the GBT mods from cmmodtools, they released these updates quite a long time ago and its never made it back into the master branch.


myminingmine
Newbie
*
Offline Offline

Activity: 2
Merit: 1


View Profile
October 04, 2024, 11:21:46 AM
Merited by vapourminer (1)
 #49

I bought a second hand red compac F miner, and followed your instructions. I need help to get it working.

Bitcoin Core, cgminer and the compac F are installed on the same system.

Now let's prepare the configuration file. Create a text file named bitcoin_testnet.conf in ~/bitcoin_testnet/ and put these content in it:
I use this:
Code:
testnet=1
txindex=0
server=1
[test]
rpcport=5000
rpcallowip=172.0.0.1
rpcuser=USESR
rpcpassword=PASS
rpcbind=0.0.0.0
prune=550


Now, in theory we should be ready, but we need one extra change. Open the file cgminer.c with your favorite text editor and change this line:

Code:
if (opt_btc_address[0] != '1') {

To this:

Code:
if (opt_btc_address[0] != '1' && opt_btc_address[0] != 'm' && opt_btc_address[0] != 'n'  ) {

I think I can skip this because the code on github is updated already:
Code:
      switch (opt_btc_address[0]) {
            case '1':
            case 'm':
            case 'n':
                  break;
            default:
                  applog(LOG_ERR, "Bitcoin address %s is NOT a P2PKH address, unable to mine solo on %s",
                         opt_btc_address, pool->rpc_url);
                  goto out;
      }
.
Create a text file named ~/bitcoin_testnet/cgminer_testnet.conf with these contents:
I use this (last comma removed, thanks n0nce)
Code:
{
"pools" : [
        {
                "url" : "http://172.0.0.1:5000",
                "user" : "USER",
                "pass" : "PASS"
        }
],

"btc-address": "moZKMsGTNSd3Ngu5i6RN7CC7PHaQ5wd5ms",

"gekko-compacf-freq" : "400",
"gekko-compacf-detect" : true,
"gekko-start-freq" : "300",
"gekko-mine2" : true,
"gekko-tune2" : "60",

"suggest-diff" : "442",
"failover-only" : true
}

And now you can simply run cgminer like this:

Code:
sudo /home/user/bitcoin_testnet/cgminer/cgminer -c /home/user/bitcoin_testnet/mine_testnet.conf
It doesn't work. I get:
Code:
[date] Started cgminer 4..12.1
A minute later:
Code:
Loaded configuration file ../cgminer_testnet.conf
Probing for an alive pool
No servers were found that could be used to get work from.
Please check the details from the list below of the servers you have input
Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers
Pool: 0 URL: http://172.0.0.1:5000 User: USER Password: PASS
Press any key to exit, or cgminer will wait indefinitely for an alive pool.
2 minutes later:
Code:
No Stratum, GBT or Solo support in pool 0 http://172.0.0.1:500 unable to use

Why can't cgminer connect to Bitcoin Core? What do I have to change?

Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
October 04, 2024, 05:58:34 PM
Merited by ABCbits (1), paid2 (1)
 #50

Try your local net address instead of what I think you have mistyped.

127.0.0.1 not 172.0.0.1
myminingmine
Newbie
*
Offline Offline

Activity: 2
Merit: 1


View Profile
October 04, 2024, 06:25:03 PM
 #51

Try your local net address instead of what I think you have mistyped.

127.0.0.1 not 172.0.0.1
Thank you sooooooooooo very much for this! I spent days trying and trying and couldn't find what I missed. It works now.
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
October 04, 2024, 07:57:28 PM
 #52

You're welcome. I've spent days chasing typo's before it can get real frustrating.

Good you got it working.
Nexus9090
Member
**
Offline Offline

Activity: 278
Merit: 95

So many numbers and so little time


View Profile
October 22, 2024, 02:23:34 PM
 #53

-SNIP-

connect to your Bitcoin Core directly using RPC url, user and password (which use GBT protocol) or your own mining pool (which use stratum protocol).

-SNIP-

since GBT protocol is very outdated.

Hi ABCbits,

Sorry jumping on your thread updates here.

Is GBT outdated? I didn't think it was. Perhaps I've misunderstood something all this time but isn't Stratum just a bridge between Bitcoin core GBT and pool services?

Thanks

G.
ABCbits
Legendary
*
Offline Offline

Activity: 3080
Merit: 8175


Crypto Swap Exchange


View Profile
October 23, 2024, 09:47:11 AM
 #54

Is GBT outdated? I didn't think it was.

At least, i don't remember any change or update since it's created on 2012. Meanwhile Stratum V2 exist, although AFAIK the adaption is very slow.

Perhaps I've misunderstood something all this time but isn't Stratum just a bridge between Bitcoin core GBT and pool services?

There's possibility some mining pool may use Bitcoin Core's GBT to create block they'll mine. But Stratum doesn't know or care how it's created.

Quote
Earlier i forget to mention you could connect S9 directly to Bitcoin Core since GBT protocol is very outdated. You may want to try that since you've failed to run public-pool.
I was able to run public pool after i match node and npm version used in docker container, but got "Error getmininginfo 404 - undefined
" error. Probably it's some issue with my configs.

At a glance, your config seems to be right. Have you tried checking debug.log file created by Bitcoin Core? It may give some hints why public-pool unable connect to Bitcoin Core.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: « 1 2 [3]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!