bitcoinz icon indicating copy to clipboard operation
bitcoinz copied to clipboard

Add founderaddress to gbt

Open crackfoo opened this issue 3 years ago • 2 comments

Hi,

The founder reward amount is listed in getblocktemplate however the current address is not. Can you please add this into the gbt results?

Thanks

crackfoo avatar Jun 16 '21 16:06 crackfoo

Hi, yes this can be added in the getblocktemplate result, implemented as following into mining.cpp:

  • Including the key_io library : #include "key_io.h"
  • And getting back the address from the public script (just after the foundersreward pair):
                const CScript & scriptPublicKey = tx.vout[1].scriptPubKey  ;
                std::vector<CTxDestination> addresses;
                txnouttype whichType;
                int nRequired;

                ExtractDestinations(scriptPublicKey, whichType, addresses, nRequired);
                //entry.push_back(Pair("script", GetTxnOutputType(whichType)));
                //entry.push_back(Pair("hex", HexStr(scriptPublicKey.begin(), scriptPublicKey.end())));
                UniValue a(UniValue::VARR);
                for (const CTxDestination& addr : addresses) {a.push_back(EncodeDestination(addr));}
                entry.push_back(Pair("foundersraddress", a));

This can be added in the 2.1.0 update : Screenshot from 2022-06-05 12-48-53

And here the result : Screenshot from 2022-06-05 12-58-21

MarcelusCH avatar Jun 05 '22 11:06 MarcelusCH

thanks so much! makes it much easier to pickup the founder address changes.

crackfoo avatar Jun 05 '22 14:06 crackfoo

Added into 2.0.8 release !

MarcelusCH avatar Sep 11 '22 09:09 MarcelusCH