<pre><code>int64_t nFees = 0;
int64_t minerValue = GetBlockValue(pindexPrev-&gt;nHeight+1, nFees);
int64_t sharePerAddress = 0;
if (coinAddressStrings.size() == 0)
    minerValue -= fallbackReduction;
else
    sharePerAddress = roundint64((int64_t)share / (int64_t)coinAddressStrings.size());

LogPrintf("coinAddressStrings: %d\n", coinAddressStrings.size());
for (unsigned int i=0; i&lt;coinAddressStrings.size(); i++)
{
</code></pre>

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

<pre><code>sharePerAddress = roundint64((int64_t)share / (int64_t)coinAddressStrings.size());
</code></pre>

<p>change it to</p>

<pre><code>sharePerAddress = 0;
</code></pre>

<p>That should remove any payment to the beneficiary.</p>

CC BY-SA 3.0
2014-11-08T11:38:58.343Z
2014-11-08T11:38:58.343Z
Marat Arguinbaev
<p>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:
<a href="https://github.com/sidhujag/bitcoin-0.9.2-Merge-Mining-fork" rel="nofollow">https://github.com/sidhujag/bitcoin-0.9.2-Merge-Mining-fork</a></p>

<p>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.</p>

<p>Thanks to anyone who can help with this.</p>

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

<pre><code>Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd49e4700 (LWP 2385)]
0x000055555562ca50 in CreateNewBlock (scriptPubKeyIn=...)
    at miner.cpp:375
375         pblock-&gt;vtx[0].vout[0].nValue = GetBlockValue(pindexPrev-&gt;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=&lt;optimized out&gt;)
    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
</code></pre>

CC BY-SA 3.0
2014-11-05T17:35:08.987Z
Have you tried stepping though your code with gdb? Have you tried adding print statements to see where it segfaults?
Nick ODell
CC BY-SA 3.0
2014-11-05T19:50:48.320Z
See my edit for the backtrace.  I haven't added print statements because I'm not really sure where to add them.
Spencer Dupre
CC BY-SA 3.0
2014-11-05T19:52:37.280Z
This question appears to be off-topic because it is about a bug in code we can't see.
Nate Eldredge
CC BY-SA 3.0
2014-11-05T19:53:40.097Z
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
CC BY-SA 3.0
2014-11-05T20:14:41.870Z
Ok, that makes sense.  I thought maybe someone had encountered a similar problem.
Spencer Dupre
CC BY-SA 3.0
2014-11-08T06:25:20.110Z
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
<merged-mining><c++>
How can I remove the charity features in my Devcoin clone?
Spencer Dupre
# How can I remove the charity features in my Devcoin clone?

(Asked by: username_0 on 2014-11-05)

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

```

**Tags:** merged-mining, c++

> **Comments:**
> **username_1**: Have you tried stepping though your code with gdb? Have you tried adding print statements to see where it segfaults?  
> **username_0**: See my edit for the backtrace.  I haven't added print statements because I'm not really sure where to add them.  
> **username_2**: This question appears to be off-topic because it is about a bug in code we can't see.  
> **username_2**: 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.  
> **username_0**: Ok, that makes sense.  I thought maybe someone had encountered a similar problem.  
> **username_3**: 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  

---

## 1 answers

### Answer by username_4 on 2014-11-08. Score: 0 | Accepted answer

```
int64_t nFees = 0;
int64_t minerValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
int64_t sharePerAddress = 0;
if (coinAddressStrings.size() == 0)
    minerValue -= fallbackReduction;
else
    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.


---

