# Block Hash

This Bash script is designed to compare the hash of a specific block from the Heimdall blockchain on your local instance with the hash of the same block obtained from an external API.

```bash
#!/bin/bash


latest_block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height')


hash_value_local=$(curl -s "localhost:26657/block?height=$latest_block_height" | jq -r '.result.block_meta.block_id.hash')


hash_value_api=$(curl -s "https://heimdall-api.polygon.technology/blocks/$latest_block_height" | jq -r '.block_meta.block_id.hash')


echo "Hash of the block (Local): $hash_value_local"
echo "Hash of the block (API): $hash_value_api"

if [ "$hash_value_local" = "$hash_value_api" ]; then
    echo "The hashes are equal."
else
    echo "The hashes are different."
fi

```

Requests Installation:

Run the script in an environment with `curl` and `jq` installed.

```bash
sudo apt-get install jq 
```

Script Execution:

Make the script executable using `chmod +x script.sh`

Run the Script:

In the terminal or command prompt, navigate to the directory where the script is located. Execute the script using the following command:

```bash
./script.sh
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stakepool.dev.br/polygon/scripts/block-hash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
