Pages:
Author

Topic: [Guide] Solo mine testnet bitcoins with cgminer, Bitcoin Core, and a Compac F (Read 1898 times)

member
Activity: 259
Merit: 85
So many numbers and so little time
All getting a bit off-topic here...  Wink

Perhaps best to export these S9 questions to a separate thread?
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
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.
member
Activity: 259
Merit: 85
So many numbers and so little time
-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.
member
Activity: 259
Merit: 85
So many numbers and so little time
You're welcome. I've spent days chasing typo's before it can get real frustrating.

Good you got it working.
newbie
Activity: 2
Merit: 1
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.
member
Activity: 259
Merit: 85
So many numbers and so little time
Try your local net address instead of what I think you have mistyped.

127.0.0.1 not 172.0.0.1
newbie
Activity: 2
Merit: 1
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?

member
Activity: 259
Merit: 85
So many numbers and so little time
~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.


hero member
Activity: 1008
Merit: 960
~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.
copper member
Activity: 906
Merit: 2258
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.
member
Activity: 259
Merit: 85
So many numbers and so little time
-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!
member
Activity: 144
Merit: 25
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!
member
Activity: 259
Merit: 85
So many numbers and so little time
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.
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
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.
member
Activity: 259
Merit: 85
So many numbers and so little time
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.

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
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

--snip--

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

Aside from low hashrate, you probably better use solo mining pool (such as ckpool or kano) which supposed to offer better block propagation speed.
member
Activity: 259
Merit: 85
So many numbers and so little time
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
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
Quote
How is that possible?
It is simple: if you have any mining power, then mathematically, you can always hit a block. Your blocks are as good as produced by any huge miner. So, instead of hitting some block every 10 minutes, you can hit it every day, every week, or even every month. But it also means, once per year you can hit three blocks in a row, or something like that. But then, you should not fall into gambler's fallacy, and think that you will hit the next block in the same day, if you were extremely lucky for a while.
Actually, I got maybe 6 or 7 'regular difficulty' (67.108.864 - only 30% lower than what it should probably be) blocks in just a couple of days now. I have to check the numbers, but it seems very unlikely to be this lucky this often.

Quote
Or rather, to make it realistic: a pool of CPU miners could win.
At difficulty 1, getting the data from your pool may already take more time than than an ASIC miner needs to find the next block.
I believe so, too. Even a CompacF takes just a fraction of a second.
Actually, one reason that might explain how I'm able to get almost every single 1-difficulty block is that 'regular' miners connect to a pool, meanwhile with nullama's method, we connect to our own full nodes. This should surely result in a smaller delay.

I'll run some numbers as soon as I can; likelihood of mining a 67M block (normal distribution), as well as ratio of 1-diff blocks I was able to scoop up vs. the total number in a given period of time.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Quote
no advantage in internet speed will be enough to offset that
Well, your gains will be always proportional to your power, in the long-term perspective. Which means, CPU-based miners will lose that battle very, very often, but once per N blocks, they could win.
There's no point in trying, if it's once in a million (or maybe billion). That means it will probably never happen, and that's what makes CPU mining futile.

Quote
Or rather, to make it realistic: a pool of CPU miners could win.
At difficulty 1, getting the data from your pool may already take more time than an ASIC miner needs to find the next block.
copper member
Activity: 906
Merit: 2258
Quote
no advantage in internet speed will be enough to offset that
Well, your gains will be always proportional to your power, in the long-term perspective. Which means, CPU-based miners will lose that battle very, very often, but once per N blocks, they could win. Or rather, to make it realistic: a pool of CPU miners could win.

Also, for that reason I left mining testnet3, and tried merged-mining with mainnet difficulty, but in a model, where each miner has its own difficulty, and is always rewarded every 10 minutes. Because one of the problems with testnet3 is that so much power is "wasted" into mining worthless coins. In that case, merged-mining fits better, because you can get coins that are almost worthless, but not quite. And you can easily test that kind of things inside LN, where normally you would have to pay, but if you are a miner, you can use your computing power as your currency. Also, because normally nodes don't want to pay you, what you can focus on is cheaper transactions: a node can give you some discount, or process some transactions for free, if you show your shares.

Quote
How is that possible?
It is simple: if you have any mining power, then mathematically, you can always hit a block. Your blocks are as good as produced by any huge miner. So, instead of hitting some block every 10 minutes, you can hit it every day, every week, or even every month. But it also means, once per year you can hit three blocks in a row, or something like that. But then, you should not fall into gambler's fallacy, and think that you will hit the next block in the same day, if you were extremely lucky for a while.

Quote
I need to double-check my calculations...
It is not something you can fix. Your calculations are correct. But the very low probability, close to zero, does not mean that something will not happen. Even if you reach zero in your calculations, you could still encounter such situation in the real world.
Pages:
Jump to: