Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-2010 Satoshi Nakamoto2// Copyright (c) 2009-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6#ifndef BITCOIN_CONSENSUS_AMOUNT_H7#define BITCOIN_CONSENSUS_AMOUNT_H9#include <cstdint>11/** Amount in satoshis (Can be negative) */12typedef int64_t CAmount;14/** The amount of satoshis in one BTC. */15inline constexpr CAmount COIN{100'000'000};17/** No amount larger than this (in satoshi) is valid.18*19* Note that this constant is *not* the total money supply, which in Bitcoin20* currently happens to be less than 21,000,000 BTC for various reasons, but21* rather a sanity check. As this sanity check is used by consensus-critical22* validation code, the exact value of the MAX_MONEY constant is consensus23* critical; in unusual circumstances like a(nother) overflow bug that allowed24* for the creation of coins out of thin air modification could lead to a fork.25* */26inline constexpr CAmount MAX_MONEY{21'000'000 * COIN};27inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }29#endif // BITCOIN_CONSENSUS_AMOUNT_H