Why block height from is different with online

curl -i -XPOST -H "Content-Type: application/json;charset=utf-8" http://xxfds.ccc/block --data '{ "network_identifier": {"blockchain":"Internet Computer", "network": "00000000001000050101"}, "block_identifier": {} }'

I got the block height form above, but it’s different with the block height in DFINITY Explorer

What’s the problem

There are two different concepts here:

Ledger block
This is a simple abstraction created specifically for the Rosetta API. Here, each “block” consists of a single ledger transaction. All data is persisted in the ledger canister.
Endpoint: https://rosetta-api.internetcomputer.org/block

Blockchain block
This is the number displayed on block explorers. These are blocks of update messages that must reach consensus. These blocks are not persisted.
Endpoint: https://ic-api.internetcomputer.org/api/metrics/block

6 Likes

Great explanation, @wang.

For the IC ledger, it’s best to just forget the concept of blocks. To avoid confusion, the ICA dashboard and dfinityexplorer.org intentionally avoid using block terminology on the transactions pages (even though the transaction index shown is technically the Rosetta block height).

1 Like

What’s the difference between transaction index and blocks (I don’t know how to express it).

Thanks

Hi @jadeydi, I’m not sure what you’re asking. Can you rephrase the question?

I can’t understand These are blocks of update messages that must reach consensus., more explanation of this, and can I get it use Rosetta API.

Thanks

I suggest you read this article about consensus on the Internet Computer:

1 Like

Regarding Rosetta, @wang said it best:

Ledger block
This is a simple abstraction created specifically for the Rosetta API. Here, each “block” consists of a single ledger transaction.

These aren’t Internet Computer blocks that are part of consensus, they’re just conceptual blocks that are used as part of the Rosetta implementation, where every transaction is contained in its own block.

2 Likes