Simple question but I can’t find the answer again.
Where is the code which rejects transactions when the value of inputs is below the value of outputs (because I think to recall that check works like this) ?

And what’s the exact error message which is sent to the log in that case ?

  • Grepping in all files of the projects and all charsets for \".*Balance and insufficient is no help ! Commented Apr 28, 2019 at 14:41

1 Answer 1


Below is the code that checks that the inputs consumed are greater than the output

const CAmount value_out = tx.GetValueOut();
if (nValueIn < value_out) {
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false,
        strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(value_out)))

You can find it here.

  • And is this really the error message which state the balance is not enough on a third party transaction ? I think to recall the check is also in other functions. Commented Apr 28, 2019 at 14:57
  • This is the transaction checking function which sees that the value in > value out.
    – Ugam Kamat
    Commented Apr 28, 2019 at 15:25
  • This function is then called in validation and mempool files github.com/bitcoin/bitcoin/…
    – Ugam Kamat
    Commented Apr 28, 2019 at 15:31

Your Answer

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

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