blockchain/api-v1-client-java

Index vs. Hash

mik3hall opened this issue · 2 comments

It appears from the code that indexes and hash's are the same thing. I just wanted to verify this is correct?

public Block getBlock(long blockIndex) throws APIException, IOException
{
    return getBlock(String.valueOf(blockIndex));
}

/**
 * Gets a single block based on a block hash.
 * @param blockHash Block hash
 * @return An instance of the {@link Block} class
 * @throws APIException If the server returns an error
 * @throws IOException
 */
public Block getBlock(String blockHash) throws APIException, IOException

They are different, but the endpoint can recognize both and return the correct block.

If you look at the JSON output from /rawblock, the index is 'block_index' and the hash is 'hash. E.g.:

https://blockchain.info/rawblock/00000000000000000d11e251fef7852f3af846b4f06ba1b42d232894a4244ed6

Please let me know if you have any other questions regarding this. Closing for now.

On Oct 7, 2015, at 6:13 PM, Mark Pfluger notifications@github.com wrote:

They are different, but the endpoint can recognize both and return the correct block.

If you look at the JSON output from /rawblock, the index is 'block_index' and the hash is 'hash. E.g.:

https://blockchain.info/rawblock/00000000000000000d11e251fef7852f3af846b4f06ba1b42d232894a4244ed6 https://blockchain.info/rawblock/00000000000000000d11e251fef7852f3af846b4f06ba1b42d232894a4244ed6
Please let me know if you have any other questions regarding this. Closing for now.

Good enough.

Thanks for the reply.

Michael Hall