I'm trying to produce a SHA256 altcoin which is merge mined with Bitcoin. I'd like to use some recent code, rather than base in on a 0.8.* or earlier codebase. I've found this source: https://github.com/sidhujag/bitcoin-0.9.2-Merge-Mining-fork

However, it's based on Devcoin, so it sends some of the mining proceeds to other parties. I'm finding it very difficult to extract this feature, while keeping the merged mining. For instance, in the miner.cpp file I've modified the CreateNewBlock function to remove the "Prepare to pay beneficiaries" section, but when I do so the compiled code segfaults.

Thanks to anyone who can help with this.

EDIT: I've run the node with GDB, this is the error and backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd49e4700 (LWP 2385)]
0x000055555562ca50 in CreateNewBlock (scriptPubKeyIn=...)
    at miner.cpp:375
375         pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);

(gdb) backtrace
#0  0x000055555562ca50 in CreateNewBlock (scriptPubKeyIn=...)
    at miner.cpp:375
#1  0x000055555562dc4f in CreateNewBlockWithKey (reservekey=...)
    at miner.cpp:513
#2  0x000055555562de51 in GreedycoinMiner (pwallet=
    0x555556502c70) at miner.cpp:597
#3  0x00007ffff7547a4a in boost::(anonymous namespace)::thread_proxy (param=<optimized out>)
    at libs/thread/src/pthread/thread.cpp:164
#4  0x00007ffff5cc2182 in start_thread (arg=0x7fffd49e4700)
    at pthread_create.c:312
#5  0x00007ffff59ef30d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
  • 1
    Have you tried stepping though your code with gdb? Have you tried adding print statements to see where it segfaults? – Nick ODell Nov 5 '14 at 17:35
  • See my edit for the backtrace. I haven't added print statements because I'm not really sure where to add them. – Spencer Dupre Nov 5 '14 at 19:50
  • 2
    This question appears to be off-topic because it is about a bug in code we can't see. – Nate Eldredge Nov 5 '14 at 19:52
  • I think this question can only be answered by someone with access to your code and a debugger. Debugging with someone usually involves a lot of back-and-forth investigation and discussion, which is not a good fit for this site's Q&A format. – Nate Eldredge Nov 5 '14 at 19:53
  • Ok, that makes sense. I thought maybe someone had encountered a similar problem. – Spencer Dupre Nov 5 '14 at 20:14
int64_t nFees = 0;
int64_t minerValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
int64_t sharePerAddress = 0;
if (coinAddressStrings.size() == 0)
    minerValue -= fallbackReduction;
    sharePerAddress = roundint64((int64_t)share / (int64_t)coinAddressStrings.size());

LogPrintf("coinAddressStrings: %d\n", coinAddressStrings.size());
for (unsigned int i=0; i<coinAddressStrings.size(); i++)

This is the code in miner.cpp. I think what you should try is changing the following line:

sharePerAddress = roundint64((int64_t)share / (int64_t)coinAddressStrings.size());

change it to

sharePerAddress = 0;

That should remove any payment to the beneficiary.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.