Error trying to send payments with RPC sendmany

1

Need help fixing this error.

Error trying to send payments with RPC sendmany {"code":-8,"message":"Invalid parameter, duplicated address

I a running a NOMP mining pool that has payment job breaking because there are two same wallet address payments in the same sendmany job. I need to limit amount sent to minimize chance of having the payment in the same transaction for a while until I get rid of this so that the payments go thru. Or, do something so that this is ignored.

cmilian

Posted 2014-12-15T14:20:06.663

Reputation: 11

You are probably posting the same address twice. Please take an RPC capture, so one can see what you are posting on the server. – Mikko Ohtamaa – 2014-12-15T14:27:01.527

I know, this is a NOMP pool and there is a user that has two workers with the same address. How can I fix this? Is there a way to ignore this and submit the payments? – cmilian – 2014-12-15T14:29:03.647

Count outgoing sums of every address together before doing sendmany. – Mikko Ohtamaa – 2014-12-15T14:29:56.937

Is there PM in this site? – cmilian – 2014-12-15T14:33:29.760

Count outgoing sums of every address together before doing sendmany... Not sure how to do this. – cmilian – 2014-12-15T14:36:48.470

Is there a way to limit or control the amount of payments sendmany groups at a time? This may help me in these payouts while duplicate address removed. – cmilian – 2014-12-15T14:54:48.113

@cmilian We don't know what your question is about now. Who or what is issuing these commands? – David Schwartz – 2014-12-15T15:44:50.740

I a running a NOMP mining pool that has payment job breaking because there are two same wallet address payments in the same sendmany job.

I need to limit amount sent to minimize chance of having the payment in the same transaction for a while until I get rid of this so that the payments go thru. – cmilian – 2014-12-15T16:00:11.907

@DavidSchwartz I a running a NOMP mining pool that has payment job breaking because there are two same wallet address payments in the same sendmany job. I need to limit amount sent to minimize chance of having the payment in the same transaction for a while until I get rid of this so that the payments go thru. Or, do something so that this is ignored. rather ignore duplicate wallet addresses. – cmilian – 2014-12-15T16:22:03.580

@cmilian: No, Stack Exchange does not support private messages.

– Nate Eldredge – 2014-12-15T16:53:34.223

2So, whatever code implements the "payment job" (i.e. the code that is calling sendmany in the first place) should detect when multiple outputs to the same address are requested, and combine them into one. For instance, if you have a payment to address 1abc for BTC 0.1, and another to the same address for BTC 0.2, you should call sendmany asking for one payment to 1abd for BTC 0.3. – Nate Eldredge – 2014-12-15T16:56:29.853

I understand, you are correct, that is the issue. trying to paste code to show.

[link] https://onedrive.live.com/redir?resid=CD88B09A5E2E741E%2134171&authkey=%21ACs6xjZnKgsjnBU&ithint=file%2ctxt [link]

how can I do that in this code?

– cmilian – 2014-12-15T17:13:01.440

Please edit your question to include the relevant code there. – Mikko Ohtamaa – 2014-12-16T10:21:40.737

Answers

1

I had this problem on a NOMP pool recently, I will share how we fixed it. For us, the problem was that a user had used the same address twice, but added some whitespace to their username the second time. So NOMP wouldn't recognize it as a duplicate, but the sendmany command would still fail. The solution for us was to do two things.

  1. Eliminate the whitespace from workers' names. This commit shows how to do that.
  2. Combine payouts together when there is more than one worker with the same address. The code for that is shown below.

In paymentProcessor.js, change

var address = worker.address = (worker.address || getProperAddress(w));
worker.sent = addressAmounts[address] = satoshisToCoins(toSend);

to

var address = worker.address = (worker.address || getProperAddress(w)).trim();
if (!worker.sent) {
    worker.sent = 0;
}
worker.sent += satoshisToCoins(toSend);
if (!(address in addressAmounts)) {
    addressAmounts[address] = 0;
}
addressAmounts[address] += satoshisToCoins(toSend);

If you want to know more about what caused this, the problem here is just what was explained in the error: there are duplicate addresses in the JSON object.

For example, I generated a new address of my own (1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy) and ran:

./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01, "1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'

And the error was:

Invalid parameter, duplicated address: 1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy (code -8)

To fix this problem, you either need to (1) add up all the amounts and pay to the address in one go, or (2) do separate RPC sendmany RPC calls, making sure to not have any duplicates.

In my case, (1) would look like:

./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.02}'

And (2) would look like:

./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'
./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'

morsecoder

Posted 2014-12-15T14:20:06.663

Reputation: 13 123