1

Everyone knows this famous fix for block 74638 which still exists in other files. But there’s something I can’t understand, why check for inputs overflow since it’s not possible to have enough utxo for such case as it’s their hash being tracked and from an attacker point of view this only decrease what he/she/they have in reality (unlike outputs where it decrease the amount to be paid).

So why making invalid something which is already impossible and would has no impacts as an inflation bug ?
Even the go implementation of bitcoin is doing it.

  • 1
    Which of the three checks you're linking to are you asking for? – Pieter Wuille Apr 21 at 17:43
  • @PieterWuille the whole check for inputs. Question edited to reflect this. – user2284570 Apr 21 at 17:53
3
+25

It appears to largely be just a belt-and-suspenders check. As you say, it is unnecessary to do this check. However it doesn't hurt to have this check in there. At worst, it just adds a few nanoseconds to verification time. At best, it will catch some serious bugs.

Given that this is consensus related, it does not hurt to have extra checks that are theoretically unnecessary. They will prevent errors in cases where some edge case occurs. In this case, it was possible for an input with negative value to be spent and thus this check would come into play. That would occur if someone updated their node following the block with the bad transaction, but did not rollback their blockchain. If the owner of the negative output had spent it, this check would have prevented the node from accepting the transaction.

  • The points is every cryptocurrencies are doing it. Even those not using Bitcoin code like Monero. So it seems to be strange that all cryptocurrencies tracking coins instead of balances are ensuring what would be an unnecessary check. Maybe there’s something I missed and an inflation attack from input overflow is possible ? – user2284570 Apr 23 at 20:35
  • Most of those cryptocurrencies just blindly copied and forked the Bitcoin source code. The check is there because they didn't bother to remove it. The check is still in Bitcoin Core because Bitcoin Core hasn't bothered to remove it. I don't think there's really any real reason as to why it's still there other than that it was added and it does no harm. – Andrew Chow Apr 23 at 20:38
  • Yes, for those who started by forking Bitcoin. But for monero (which is an example among others), I can say definitely that’s it’s not Bitcoin code. – user2284570 Apr 23 at 20:57
  • You would have to ask the Monero developers. It is possible that they have it because a break in Monero's cryptography would allow for hidden inflation. It is also possible that during the initial implementation, they were copying code from Bitcoin even if they did not directly fork their source code from Bitcoin. After all, they have a somewhat similar transaction and blockchain model, so there's no need to rewrite everything from scratch. – Andrew Chow Apr 23 at 21:02
  • the same is true for Zcash Joinspits. – user2284570 Apr 23 at 21:19
-2

While it's not valid on the Bitcoin network for inputs to add up to a negative amount, or to more that 21 million, the computer doesn't innately know that - it needs a program to instruct it. Your link is to one point in the bitcoind program where the computer is instructed how to tell the difference between valid, and invalid, transactions.

You can also think of your assertion "it’s not possible to have enough utxo" another way. One reason it is not possible is because of the IF statement you point to: remove the check, and suddenly it IS possible (later code withstanding.)

  • 1
    If "duplicate inputs things are deleted later" then the processing between this point and that later point is wasted because it is known /now/ that they won't pass. What the attacker may or not believe seems irrelevant to your question "What’s the point of checking inputs overflow?". I suggest if my answer isn't what you're after, you further clarify what you're asking. – Alistair Mann Apr 21 at 17:27
  • @user2284570 Both your question and this remark is actually very confusing with incomplete and grammatically incorrect sentences. The remark, to a good attempt at an answer, is very rude as well. I'm very much inclined to vote for closing this whole question if you don't improve it. – Jannes Apr 21 at 17:35
  • @Jannes While it's not valid on the Bitcoin network for inputs to add up to a negative amount the point is why making invalid something invalid and why would an attacker would want this as a 74638 block style attack. So know I suppose you understand the answer is like answering what will be the weather tomorrow to a question asking how the weather was yesterday, that is : an off topic answer. The answer explains why it’s impossible whereas the question is about why making it impossible. Of course, please edit the question to reflect this. – user2284570 Apr 21 at 18:09
  • @AlistairMann the question is about why making invalid something which is already impossible whereas you’re answering how it’s done to do it. – user2284570 Apr 21 at 18:14
  • @AlistairMann the code I’m referring to is only a security fix for an inflation bug and has no purpose for ᴅᴅᴏꜱ logic. Is it clear now ? – user2284570 Apr 21 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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