user127862: How can I get circulating supply and total supply for cryptocurrencies?
I am not talking about using coinmarketcap's API, I want to get the data myself. Should I get it from the source-code?

user5406: For Bitcoin you can get the total supply via gettxoutsetinfo, which produces the following output:
$ bitcoin-cli gettxoutsetinfo
{
  "height": 705603,
  "bestblock": "0000000000000000000173b87bcaa99c5020eb16b13a856f7015130889c5ff93",
  "transactions": 45865084,
  "txouts": 75262497,
  "bogosize": 5632719734,
  "hash_serialized_2": "ac0ce667248d97678d5eb4fcfb7e2ae667e205775765852e5b595afa73fb2eb0",
  "disk_size": 4613582238,
  "total_amount": 18847318.79243407
}

In the output, total_amount refers to the sum of all existing bitcoins. While other cryptocurrencies are not on-topic here, gettxoutsetinfo should also work for most Bitcoin-derived altcoins.

127862: <p>How can I get circulating supply and total supply for cryptocurrencies?</p>
<p>I am not talking about using coinmarketcap's API, I want to get the data myself. Should I get it from the source-code?</p>
 5406: <p>For Bitcoin you can get the total supply via <a href="https://bitcoincore.org/en/doc/0.21.0/rpc/blockchain/gettxoutsetinfo/" rel="nofollow noreferrer"><code>gettxoutsetinfo</code></a>, which produces the following output:</p>
<pre><code>$ bitcoin-cli gettxoutsetinfo
{
  &quot;height&quot;: 705603,
  &quot;bestblock&quot;: &quot;0000000000000000000173b87bcaa99c5020eb16b13a856f7015130889c5ff93&quot;,
  &quot;transactions&quot;: 45865084,
  &quot;txouts&quot;: 75262497,
  &quot;bogosize&quot;: 5632719734,
  &quot;hash_serialized_2&quot;: &quot;ac0ce667248d97678d5eb4fcfb7e2ae667e205775765852e5b595afa73fb2eb0&quot;,
  &quot;disk_size&quot;: 4613582238,
  &quot;total_amount&quot;: 18847318.79243407
}
</code></pre>
<p>In the output, <code>total_amount</code> refers to the sum of all existing bitcoins. While other cryptocurrencies are not on-topic here, <code>gettxoutsetinfo</code> should also work for most Bitcoin-derived altcoins.</p>
