How can I remove the charity features in my Devcoin clone?


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:

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

Spencer Dupre

Posted 2014-11-05T16:36:56.123

Reputation: 19

1Have you tried stepping though your code with gdb? Have you tried adding print statements to see where it segfaults? – Nick ODell – 2014-11-05T17:35:08.987

See my edit for the backtrace. I haven't added print statements because I'm not really sure where to add them. – Spencer Dupre – 2014-11-05T19:50:48.320

2This question appears to be off-topic because it is about a bug in code we can't see. – Nate Eldredge – 2014-11-05T19:52:37.280

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 – 2014-11-05T19:53:40.097

Ok, that makes sense. I thought maybe someone had encountered a similar problem. – Spencer Dupre – 2014-11-05T20:14:41.870

It's not a problem, per se. The whole idea of devcoin is the small percentage is supporting the developers, which was agreed upon when you cloned the coin. This is more akin to cracking software which I can't really see being something SE would get behind. Correct me on details if I'm wrong though – Wizard Of Ozzie – 2014-11-08T06:25:20.110



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.

Marat Arguinbaev

Posted 2014-11-05T16:36:56.123

Reputation: 86