Which is the smallest hash that has ever been hashed?

5

1

Let's assume, the hash 00000000000000000024c0bdbec66a889778c00bc69be0a96cbbd98b75c3ce09 of block #499644 is smaller than 0000000000000000002d429f39afec70c938e888c3417d690bbc85e83529991c of block #499645.

They both have 18 Zeros, then 2=2, but then 4<d.

Which is the smallest hash that has ever been hashed during cryptomining? How many zeros? Which block?

ndsvw

Posted 2017-12-16T19:52:58.207

Reputation: 1 997

Answers

3

Pieter Wuille

Posted 2017-12-16T19:52:58.207

Reputation: 64 874

I'd be interested to know how you generated this list, and why you decided to post the lowest 12. – Adam Millerchip – 2017-12-17T04:09:52.173

3

I run http://bitcoin.sipa.be and the website data is generated from a text file with a list of all blocks with hash and height. I sorted the file based on hash and posted the top 12, to give an idea of how common the top number of zeroes is.

– Pieter Wuille – 2017-12-17T05:59:16.960

4

I don't think there is a site that will show you this information, but it is fairly trivial to find out.

Here's an old Bitcointalk thread that discusses this: https://bitcointalk.org/index.php?topic=29675.0

Here's a python script that will calculate it for you. You will need a bitcoind for it to connect to:

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import binascii
import struct

def uint256_to_str(u):
    rs = b""
    for i in range(8):
        rs += struct.pack("<I", u & 0xFFFFFFFF)
        u >>= 32
    return binascii.hexlify(rs)

def uint256_from_str(s):
    s = binascii.unhexlify(s)
    r = 0
    t = struct.unpack("<IIIIIIII", s[:32])
    for i in range(8):
        r += t[i] << (i * 32)
    return r

def byteswap(a):
    return "".join(reversed([a[i:i+2] for i in range(0, len(a), 2)]))

# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user = "user"
rpc_password = "password"
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%(rpc_user, rpc_password))

best_hash = uint256_from_str("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
best_height = 0
counter = 0

while True:
    try:
        commands = [ [ "getblockhash", height] for height in range(counter, counter + 10000) ]
        block_hashes = rpc_connection.batch_(commands)

        for block_hash in block_hashes:
            block_uint256 =  uint256_from_str(byteswap(block_hash))
            if block_uint256 < best_hash:
                best_hash = block_uint256
                best_height = counter
            counter += 1

        print("Processed " + str(counter) + " blocks")
    except Exception as e:
        print(e)
        break;

print("Lowest Block Hash: " + byteswap(uint256_to_str(best_hash).decode()) + " at block height " + str(best_height))

This script gave me the following output:

Lowest Block Hash: 00000000000000000000011246f099d94f91628d71c9d75ad2f9a06e2beb7e92 at block height 458091

Andrew Chow

Posted 2017-12-16T19:52:58.207

Reputation: 50 267

3

I improved on this to print the lowest 50 block hashes as well as their heights and the dates they were generated:

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import datetime

# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user = "user"
rpc_password = "password"
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332" %
                                  (rpc_user, rpc_password))

block_cnt = rpc_connection.getblockcount()
block_hashes = []

for n in range(0, block_cnt, 1000):
    commands = [["getblockhash", h] for h in range(n, min(n+1000, block_cnt))]
    block_hashes += rpc_connection.batch_(commands)

block_hashes.sort()

commands = [["getblock", block_hash] for block_hash in block_hashes[0:50]]
blocks = rpc_connection.batch_(commands)

for block in blocks:
    time = datetime.datetime.fromtimestamp(block['time']).strftime('%Y-%m-%d')
    print(block['hash'], block['height'], time)

A new record was just set yesterday!

0000000000000000000000bb5b432a764ad6c7acf677dcd99161abfdf68e698e 500174 2017-12-19

Clayton Smith

Posted 2017-12-16T19:52:58.207

Reputation: 31