Is there is reason why Bitcoin uses signed instead of unsigned integers for amounts? I can't imagine a scenario where negative amounts could come up. Was it simply something Satoshi implemented for some future use this way and now we are stuck with it?

  • 3
    As an aside, in C++ it is considered bad practice to use unsigned variable just because the underlying thing they represent can only be a positive value. There are a lot of traps in the language when you mixed signed and unsigned quantities thanks to the way implicit conversions work. This might have had some influence as well, since the original implementation was in C++.
    – Chuu
    Nov 29, 2021 at 21:03

1 Answer 1


CAmount is used for multiple purposes in Bitcoin Core, not just in transaction validation logic. It is also used to represent the net effect transactions have on wallet balance, for example, and that net effect is negative as often as it is positive.

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.