0

I have managed to build an altcoin (from litecoin source) but my coin requires that I make changes to the way rewards are made. I have been looking at the source code to try to find where block reward is handled and what method does all the work. I did find this (In what line of what file does the block reward depend on?) however this looks to be old as i don't see a main.cpp file in the litecoin source.

does anyone know the modern files/methods that handle this. I already managed to follow the steps for creating my genesis block and everything looks to be working. I'm now in the phase of making changes. I would like to find the method that handles creating a block with a block reward. I will be changing how the block reward is done.

while I see chainparams.cpp has an ability to change the reward amount. I'm looking for a way to build a new type of reward system so i will need to look at how a coin is made from nothing. My coin will not be minting coins on block creation so i need to change how that method works.

1 Answer 1

0

The function is called GetBlockSubsidy now and it can be found in validation.cpp.

4
  • it looks like this method returns the amount how does this amount get accepted into a block. As this would be a transaction with no inputs and only the output of the reward. Aug 3, 2019 at 15:30
  • does IsCoinBase() have to do with that? Aug 3, 2019 at 15:45
  • Coinbase transactions have a special txid and vout combination that marks them as being coinbase transactions, which is what IsCoinbase() returns. If a transaction is a coinbase transaction, all input checks are just skipped. You can see that in ConnectBlock. The block reward is then checked after the inputs are checked here: github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1940
    – Andrew Chow
    Aug 3, 2019 at 15:50
  • I see thank you this gets me on the right path. This looks to have solved two questions i had with removing the reward from the block and how to change how the reward is given out. Thank you. Aug 3, 2019 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.