0

According to blockchain.info, 4,198 confirmations have been received on the following Bitcoin transaction at the time of this writing. Give then following Bitcoin transaction as JSON (ref: transaction on blockhain.info as JSON) how can I determine the number of confirmations?

enter image description here

Transaction as JSON

{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "witness":"",
         "prev_out":{
            "spent":true,
            "spending_outpoints":[
               {
                  "tx_index":0,
                  "n":0
               }
            ],
            "tx_index":0,
            "type":0,
            "addr":"1BiYTVfoAWpEf5vTCVyWgWzsbdTbi3X4Lb",
            "value":4371338,
            "n":1,
            "script":"76a914758c92328cb8f0d5a9e2bc6a1b27b6fdf83fa86588ac"
         },
         "script":"483045022100f6d8e0e386079721dc286d25c88c5cddd8733ee3d93247f3ff0127e8aa7dcb9a02206ce2b7e524e4796e93688442dcc95bb7c8e2bcf3a46ac660633fac3e0becfd5e012102a9dba5ef4653f48190bf6b12130f001fe14cda8b8e2e06bf2e96b9cf3c442503"
      }
   ],
   "weight":760,
   "block_height":615893,
   "relayed_by":"0.0.0.0",
   "out":[
      {
         "spent":true,
         "spending_outpoints":[
            {
               "tx_index":0,
               "n":0
            }
         ],
         "tx_index":0,
         "type":0,
         "addr":"3BMEXDcDGPjGGR6MHiFiHRPfz6LeGeYYM3",
         "value":4366812,
         "n":0,
         "script":"a91469f3746a2b4246695de6ae4fd0d2c27221b1cd9d87"
      }
   ],
   "lock_time":0,
   "size":190,
   "block_index":0,
   "time":1580790109,
   "tx_index":0,
   "vin_sz":1,
   "hash":"406fe52a8cb99cfdc3ed6cc3e2ef461608e369943a9c1f4132421d3de425e66c",
   "vout_sz":1
}

1 Answer 1

2

Confirmations are nothing but just the number of blocks added after the block the transaction was added in. So accordingly, during the time of writing, the current block is 620093 and your transaction was added in block 615893

So if you subtract these two , current block - tx added block(620093 - 615893 = 4200), you will get the total number of confiramtions, which is near to your block confirmations (4198)

Hope this was helpful. Have a great day!

3
  • Thanks, great info! Any idea how I can get the current block height?
    – MikeyE
    Commented Mar 4, 2020 at 7:29
  • I should have looked at the same site I reference earlier. After a quick search I found this URL, which returns the block height among other things as JSON. blockchain.info/latestblock
    – MikeyE
    Commented Mar 4, 2020 at 7:35
  • Yes, that's a great way to get the block height. Now you just to extract both of them and subtract them to get total confirmations
    – Hackeerrrr
    Commented Mar 4, 2020 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.