4

On blockchain's blockchain api documentation, located here

https://blockchain.info/api/blockchain_api

There is an api call that uses a parameter called block_index. What is this value, and how does it differ from block_height? From playing around with changing the block_index value in the following api call:

https://blockchain.info/block-index/$block_index?format=json

It seems like (imo quite arbitrarily, which adds to my confusion) that block_index 14849 corresponds to the genesis block. Finally, on the api page listed at the top the first example output they show gives a block whose index is 818044, yet when I enter the following api call into my browser's address bar:

https://blockchain.info/block-index/818044?format=json

I get "Block Not Found". Is this just a bug in blockchain.info that the example output they provide doesn't actually work, or am I using block_index incorrectly?

1

I think that this value is an internal unique index in bc.i database.

It is not possible to use txid as an index because of 2x2 duplicate transactions in blockchain

https://blockchain.info/tx/d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599 https://blockchain.info/tx/e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468

occurred in the early stage of bitcoin

see BIP-30 https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki

UPD: ok, you are asking about block index, but my answer is for tx index. May be using straight autoincrement int64 value for database is better than int256

0

It is the index of the block in blockchain.info

This would be the latest block for now: https://blockchain.info/block-index/311271?format=json

  • This answer is very poor, as you are repeating my question back to me. Also did you even follow your own link? That API call returns information about block 248899, which is not even close to the latest block as a quick check to the blockchain homepage shows we are beyond block height 300000. Please explain what point you were trying to make. – almel Jul 18 '14 at 5:59
  • My bad, the link is for a block that was back in 28 Jul 2013 14:57:27 GMT. Basically my take is that block height is the block id in the main block chain, but block index is the index number in blockchain.info database, as amaclin mentioned they might be two different transaction ids (or also double spends) that one of them would end up in the main blockchain, so the block-index is always higher than the height (maybe the same in the first few blocks, haven't checked) – Shayan Jul 19 '14 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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