<p>Easy enough with your own Bitcoin node.</p>
<pre class="lang-sh prettyprint-override"><code>for height in {1..500000}; do echo &quot;$height `bitcoin-cli getblockhash $height`&quot;; done
</code></pre>

CC BY-SA 4.0
2021-11-04T03:00:05.700Z
2023-05-06T12:51:39.240Z
2023-05-06T12:51:39.240Z
Claris
<p>Suppose I want to obtain the block hashes for all Bitcoin blocks numbered 1 through 50,000. What would be the best way to obtain this information? I could write a web scraper to pull it off web-based blockchain explorers but that would take forever to run.</p>

<api><block><hash>
How to get list of Bitcoin Block Hashes by Block Number?
EllipticalInitial
# How to get list of Bitcoin Block Hashes by Block Number?

(Asked by: username_0 on 2021-11-04)

Suppose I want to obtain the block hashes for all Bitcoin blocks numbered 1 through 50,000. What would be the best way to obtain this information? I could write a web scraper to pull it off web-based blockchain explorers but that would take forever to run.

**Tags:** api, block, hash


---

## 1 answers

### Answer by username_1 on 2021-11-04. Score: 5

Easy enough with your own Bitcoin node.
for height in {1..500000}; do echo "$height `bitcoin-cli getblockhash $height`"; done


---

