JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
773 stars 545 forks source link

Solo mining invalid coinbase address - does not support Bech32 format (Sugarchain) #307

Closed RytirFik closed 3 years ago

RytirFik commented 3 years ago

Hi, it seams -coinbase-addr does not accept address generated as Bech32 in desktop wallet (Sugarchain Yumekawa v0.16.3.36). Probably the miner does not recognize the format of the address. I have tested Bech32 and without Bech32 format which works. Example1 address in Bech32: cpuminer-sse2.exe -a yespower -o http://127.0.0.1:34229 -u xx -p xx --coinbase-addr=sugar1q0jud5nntpwarlzv343q4kt6asp84ncwexfyth2 -t12 Miner report ** cpuminer-opt 3.16.1 *** A CPU miner with multi algo support and optimized for CPUs with AVX512, SHA and VAES extensions by JayDDee. BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2021-04-06 23:23:56] Yespower parameters: N= 2048, R= 32 CPU: AMD Ryzen 9 5900X 12-Core Processor SW built on Mar 24 2021 with GCC 9.3.0 CPU features: AVX2 VAES SHA SW features: SSE2 Algo features: SSE2 SHA

Starting miner with SSE2...

[2021-04-06 23:23:56] Invalid coinbase address: 'sugar1q0jud5nntpwarlzv343q4kt6asp84ncwexfyth2'

Example2 address without Bech32: cpuminer-sse2.exe -a yespower -o http://127.0.0.1:34229 -u xx -p xx --coinbase-addr=sM4F85E3qcAtenmLbvptmgdwHSJNCSM8rc -t12 Miner report ** cpuminer-opt 3.16.1 *** A CPU miner with multi algo support and optimized for CPUs with AVX512, SHA and VAES extensions by JayDDee. BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2021-04-06 23:26:24] Yespower parameters: N= 2048, R= 32 CPU: AMD Ryzen 9 5900X 12-Core Processor SW built on Mar 24 2021 with GCC 9.3.0 CPU features: AVX2 VAES SHA SW features: SSE2 Algo features: SSE2 SHA

Starting miner with SSE2...

[2021-04-06 23:26:24] CPU affinity [!!!!!!!!!!!!!!!!!!!!!!!!] [2021-04-06 23:26:24] Miner thread priority 0 (nice 19) [2021-04-06 23:26:24] New Block 10225904, Net Diff 0.0085436, Ntime 06d26c60 Miner TTF @ 0.00 h/s NA, Net TTF @ 6966.22 kh/s 0m05s [2021-04-06 23:26:24] 12 of 24 miner threads started using 'yespower' algorithm [2021-04-06 23:26:31] New Block 10225906, Net Diff 0.0085536, Ntime 0dd26c60 Miner TTF @ 138.37 h/s 3d01h, Net TTF @ 7043.25 kh/s 0m05s

JayDDee commented 3 years ago

That is correct Bech32 isn't supported.

I could add it if it's not too much work and you can point me to a working implementation. I would also need someone to test it.

RytirFik commented 3 years ago

Thank you for info. Happy to test and give you feedback.

JayDDee commented 3 years ago

I found a Bech32 decoding implementation in Verthash miner. It's self contained and low risk. The code is only called if B58 decoding has failed.

It will be included in the next release untested as I don't have the ability to test solo mining. Assuming the code works, and no other changes are required to support Bech32 addresses, it should work transparently. Even if it doesn't work it shouldn't break anything

I'm working on some other changes as well so it won't be available for a few days.

JayDDee commented 3 years ago

cpuminer-opt-3.16.2 is released with added support for Bech32. Please test. Please add -D to command line options for testing as I have added a couple of new debug logs.

RytirFik commented 3 years ago

JayDDee, thanks! It looks it works. It took me longer than expected to get block there, therefore I am answering later. FYI part of miner with -D.

** cpuminer-opt 3.16.2 *** A CPU miner with multi algo support and optimized for CPUs with AVX512, SHA and VAES extensions by JayDDee. BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

[2021-04-10 07:58:54] Yespower parameters: N= 2048, R= 32 [2021-04-10 07:58:54] Key= "Satoshi Nakamoto 31/Oct/2008 Proof-of-work is essentially one-CPU-one-vote"

CPU: AMD Ryzen 9 5900X 12-Core Processor SW built on Apr 8 2021 with GCC 9.3.0 CPU features: AVX2 VAES SHA SW features: AVX2 VAES SHA Algo features: SSE2 SHA

Starting miner with SSE2 SHA...

[2021-04-10 07:58:54] Coinbase address uses Bech32 coding [2021-04-10 07:58:54] CPU affinity [!!!!!!!!!!!!!!!!!!!!!!!!] [2021-04-10 07:58:54] Miner thread priority 0 (nice 19) [2021-04-10 07:58:54] Binding thread 0 to cpu 0. [2021-04-10 07:58:54] GBT: SegWit is enabled [2021-04-10 07:58:54] Mining info: diff 0.009046, net_hashrate 8662591.581784, height 10283952 [2021-04-10 07:58:54] GBT new work received in 1.00 ms [2021-04-10 07:58:54] New Block 10283953, Net Diff 0.009046, Ntime a23e7160 Miner TTF @ 0.00 h/s NA, Net TTF @ 8662.59 kh/s 0m04s [2021-04-10 07:58:54] Threads restarted for new work. [2021-04-10 07:58:54] Binding thread 1 to cpu 1. [2021-04-10 07:58:54] Binding thread 2 to cpu 2. [2021-04-10 07:58:54] Binding thread 3 to cpu 3. [2021-04-10 07:58:54] Binding thread 4 to cpu 4. [2021-04-10 07:58:54] Binding thread 5 to cpu 5. [2021-04-10 07:58:55] Binding thread 6 to cpu 6. [2021-04-10 07:58:55] Binding thread 7 to cpu 7. [2021-04-10 07:58:55] Binding thread 8 to cpu 8. [2021-04-10 07:58:55] Binding thread 9 to cpu 9. [2021-04-10 07:58:55] Binding thread 10 to cpu 10. [2021-04-10 07:58:55] Binding thread 11 to cpu 11. [2021-04-10 07:58:55] 13 of 24 miner threads started using 'yespower' algorithm [2021-04-10 07:58:55] Binding thread 12 to cpu 12. [2021-04-10 07:59:02] GBT: SegWit is enabled [2021-04-10 07:59:02] Mining info: diff 0.0090459, net_hashrate 8277986.158082, height 10283953 [2021-04-10 07:59:02] GBT new work received in 1.00 ms [2021-04-10 07:59:02] New Block 10283954, Net Diff 0.0090459, Ntime aa3e7160 Miner TTF @ 467.52 h/s 23h05m, Net TTF @ 8277.99 kh/s 0m04s [2021-04-10 07:59:02] Threads restarted for new work. [2021-04-10 07:59:07] GBT: SegWit is enabled [2021-04-10 07:59:07] Mining info: diff 0.0090527, net_hashrate 8473846.249091, height 10283955 [2021-04-10 07:59:07] GBT new work received in 1.00 ms [2021-04-10 07:59:07] New Block 10283956, Net Diff 0.0090527, Ntime af3e7160 Miner TTF @ 1931.52 h/s 5h35m, Net TTF @ 8473.85 kh/s 0m04s [2021-04-10 07:59:07] Threads restarted for new work. [2021-04-10 07:59:12] GBT: SegWit is enabled [2021-04-10 07:59:25] Mining info: diff 0.0090273, net_hashrate 8520804.989031, height 10283960 [2021-04-10 07:59:25] GBT new work received in 0.00 ms [2021-04-10 07:59:25] Threads restarted for new work.

JayDDee commented 3 years ago

Thanks for testing. The key indicators are: the debug log confirming Bech32 addressing, the debug log confirming segwit was enabled, and most importantly a block was solved with that configuration. I'll take your word that you solved a block.