<p>I'm trying to calculate candidate blocks without using getBlockTemplate. 
Im using the data returned by bitcoind RPC, but I can't find a reliable way to get the required signatures per transaction in the mempool.</p>

<p>The only way I see to get reqSigs (required signature) of a transaction output is via getRawTransaction.</p>

<p>So:</p>

<p>-If I get all the mempool transactions via getrawmempool.</p>

<p>-then query using getRawTransaction all the transactions outputs that are signed and sum all of it's reqSigs.</p>

<p>Do I have the number of required signatures per transaction?</p>

<p>It seems that this number could not be available until the redeem script is known. But this information is only available for the tx output using getRawTransaction, not in the tx input...</p>

<p>am I missing something?</p>

CC BY-SA 4.0
2020-01-31T14:29:59.030Z
Do not use reqSigs, it is not the same as the sigops count. There won't be a reqSigs for scripts that don't match any known templates, even though they may be valid in the mempool. The correct information is in getblocktemplate, and only there.
Pieter Wuille
CC BY-SA 4.0
2020-01-31T15:53:31.953Z
It's a pity. There is no (easy) way of knowing how good is performing getBlockTemplate against other algoritms. Anyway, I know the difference will be (normally) very small.
dev7ba
CC BY-SA 4.0
2020-01-31T16:05:34.480Z
You can take the output of getblocktemplate, and build a new blocm template with it. All the information you need should be there. If you come up with an improved algorithm that way, feel free to suggest including it in Bitcoin Core.
Pieter Wuille
CC BY-SA 4.0
2020-02-03T12:50:02.630Z
Ok, I've seen that getblocktemplate returns sigops. But only for the transactions in the candidate block returned. For the other transactions in the mempool that has not been selected I don't know how to get sigops. I've tryied using "sizelimit" and "sigoplimit" template twiking parameters that appears in bip 22. But It seems it works only for reducing the block size. Is there other way using bitcoind RPC?.
dev7ba
<json-rpc><mempool>
How to calculate a candidate block for mining using bitcoind RPC (without getBlockTemplate) and having into acount MAX_BLOCK_SIGOPS
dev7ba
# How to calculate a candidate block for mining using bitcoind RPC (without getBlockTemplate) and having into acount MAX_BLOCK_SIGOPS

(Asked by: username_0 on 2020-01-31)

I'm trying to calculate candidate blocks without using getBlockTemplate.
Im using the data returned by bitcoind RPC, but I can't find a reliable way to get the required signatures per transaction in the mempool.

The only way I see to get reqSigs (required signature) of a transaction output is via getRawTransaction.

So:

-If I get all the mempool transactions via getrawmempool.

-then query using getRawTransaction all the transactions outputs that are signed and sum all of it's reqSigs.

Do I have the number of required signatures per transaction?

It seems that this number could not be available until the redeem script is known. But this information is only available for the tx output using getRawTransaction, not in the tx input...

am I missing something?

**Tags:** json-rpc, mempool

> **Comments:**
> **username_1**: Do not use reqSigs, it is not the same as the sigops count. There won't be a reqSigs for scripts that don't match any known templates, even though they may be valid in the mempool. The correct information is in getblocktemplate, and only there.  
> **username_0**: It's a pity. There is no (easy) way of knowing how good is performing getBlockTemplate against other algoritms. Anyway, I know the difference will be (normally) very small.  
> **username_1**: You can take the output of getblocktemplate, and build a new blocm template with it. All the information you need should be there. If you come up with an improved algorithm that way, feel free to suggest including it in Bitcoin Core.  
> **username_0**: Ok, I've seen that getblocktemplate returns sigops. But only for the transactions in the candidate block returned. For the other transactions in the mempool that has not been selected I don't know how to get sigops. I've tryied using "sizelimit" and "sigoplimit" template twiking parameters that appears in bip 22. But It seems it works only for reducing the block size. Is there other way using bitcoind RPC?.  

---

## 0 answers

