CMC lists an incorrect marketcap for quite a few coins.
Anyway.. to clear a few misconceptions,
circulating supply means coins that have recently been sent or addresses known to be active (CMC gives no indication of the time cut-off however). A fairly stupid measuring metric to be honest.
Total marketcap are coins generated 'to date' or in existence at any given point.
If coins were sent to an address; and the owner lost the private key - this does not affect the marketcap total, as said coins still exist and are valid on the blockchain.
The Bitcoin holders 'forked' coins don't matter, if they were reimbursed with BTX due to the snapshot - the BTX they were sent already existed beforehand.
To find the to the minute (and correct) coinmarketcap:
Ensure your baking tray is lightly greased, along with a txindex'd copy of bitcored, mix with python 2.7 and gently stir python-bitcoinrpc library in (pip install python-bitcoinrpc). Don't forget to add your rpcuser/pass otherwise rpc comms will fail.
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import time, os, sys
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
def find_between_r( s, first, last ):
try:
start = s.rindex( first ) + len( first )
end = s.rindex( last, start )
return s[start:end]
except ValueError:
return ""
# user-config section
rpchost = '127.0.0.1'
rpcuser = ''
rpcpass = ''
rpcport = '8556'
rpcpipe = AuthServiceProxy('http://' + rpcuser + ':' + rpcpass + '@' + rpchost + ':' + rpcport)
currentblk = 0
totalcoincap = 0
while True:
currentblk=currentblk+1
#get total blocks
while True:
blocktotal = int(rpcpipe.getblockcount())
if currentblk == blocktotal:
print 'hit end of chain, waiting'
time.sleep(15)
else:
break
#request each block
blockhash = rpcpipe.getblockhash(currentblk)
blockdata = rpcpipe.getblock(blockhash)
blocktx = find_between(str(blockdata),'[',']').replace('u','').replace(' ','').replace('\'','')
blocktxlist = blocktx.split(',')
#parse all tx in block
for tx in blocktxlist:
rawtx = rpcpipe.getrawtransaction(tx)
# generated pow/pos coins have no prevout
if '0000000000000000000000000000000000000000000000000000000000000000' in rawtx:
break
#decode the 'generated/mined' tx data, extract the value
coinbasetx = rpcpipe.decoderawtransaction(rawtx)
valuemined = find_between(str(coinbasetx), 'Decimal(\'', '\'),')
#special case for nonstandard pool where coinbaseout isn't first vout
while float(valuemined)==0:
try:
valuemined = find_between_r(str(coinbasetx), 'Decimal(\'', '\'),')
except:
valuemined = 0
print '* could not find vout for block '+str(currentblk)+'!'
break
totalcoincap = totalcoincap + float(valuemined)
currentblk_fmt = str(currentblk)
while len(str(currentblk_fmt)) < 6:
currentblk_fmt=' '+currentblk_fmt
print 'block '+str(currentblk_fmt)+'|'+blockhash+'|mined '+str(round(float(valuemined),8))+'|coincap '+str(round(float(totalcoincap),8))
We can see as of block 95,338; a total of 16,678,946.0337BTX are in existence.