Bitcoin Forum
May 26, 2024, 03:02:30 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Solved+Fix] Issue with mined coins of my altcoin  (Read 284 times)
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
May 23, 2018, 01:18:47 PM
Last edit: May 24, 2018, 02:09:09 PM by supermoney
 #1

I'm facing a problem with my own altcoin when mining new blocks, I do not receive any mined coin to my coinbase address and of course Bitcoin Core keeps displaying me 0 BTC balance.

Setup:
Forked Bitcoin Core v0.16.0 (stable version), generated genesis block, reduced COINBASE_MATURITY from 100 to 1, changed PUBKEY_ADDRESS to 65 ('T') and SCRIPT_ADDRESS to 66 (alternative 'T', PS: I'm aware it looks confusing/weird especially in such test cases).

CPU Miner:
Code:
-O test:1234 -o http://127.0.0.1:15621/ --coinbase-addr=ToNdTui9QonxKutQA9W3rVTocwXYbUndf9 -a sha256d -D --no-longpoll --no-getwork --no-stratum

The block explorer I setup (bitcoin-abe) shows the mined coins are being forwarded to some unknown address TQ32UoQrhdL5WUkK8jAjNNC1zSGbt7zQXw not owned by me.

Block #1:


[click here for full screen image]



Coinbase Transaction:


[click here for full screen image]



ToNdTui9QonxKutQA9W3rVTocwXYbUndf9:


[click here for full screen image]



TQ32UoQrhdL5WUkK8jAjNNC1zSGbt7zQXw:


[click here for full screen image]
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
May 23, 2018, 02:28:03 PM
Last edit: May 24, 2018, 02:03:57 PM by supermoney
 #2

It looks like ToNdTui9QonxKutQA9W3rVTocwXYbUndf9 is script address (P2SH) and TQ32UoQrhdL5WUkK8jAjNNC1zSGbt7zQXw is pubkey address (P2PKH).
What I don't understand is why cpuminer is sending the mined coins to that pubkey address and not to the script address I entered in coinbase-addr parameter?
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
May 24, 2018, 01:55:24 PM
 #3

[SOLVED+FIX]

I've managed to fix the issue by enabling CPU miner to read the PS2H prefix by editing util.c of CPU miner:

https://github.com/pooler/cpuminer/blob/master/util.c#L674

Change that value according to your SCRIPT_ADDRESS in chainparams.cpp of your coin's source code:

https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L141

Re-compile the CPU miner and run it. This is gonna be the success result:

Pages: [1]
  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!