We are working on a small project and imported all block information to mongoDB. Right now we're aiming to calculate the coin supply regarding to the block number.
My plan is to loop through all transactions per block and parse vout and vin. However, I'm not sure how to distinguish mined coins and previously existing coins transferred users. Plus, how to account for transaction fees?
Can I track only "valueOut" and that's all?
{
"txid":"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
"version":1,
"locktime":0,
"vin":[
{
"coinbase":"04ffff001d0104",
"sequence":4294967295,
"n":0
}
],
"vout":[
{
"value":"50.00000000",
"n":0,
"scriptPubKey":{
"hex":"410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
"asm":"0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
"addresses":[
"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"
],
"type":"pubkeyhash"
},
"spentTxId":null,
"spentIndex":null,
"spentHeight":null
}
],
"blockhash":"00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
"blockheight":1,
"confirmations":601155,
"time":1231469665,
"blocktime":1231469665,
"isCoinBase":true,
"valueOut":50,
"size":134
}
Any help would be appreciated!