diff --git a/hive/db/schema.py b/hive/db/schema.py
index 2e711e8d51ed5fe3916b10d297f80875a305ed2a..6b95de502898c9675f9642073481bc3a9ecca6cb 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -12,11 +12,13 @@ metadata = sa.MetaData()
 hive_blocks = sa.Table(
     'hive_blocks', metadata,
     sa.Column('num', sa.Integer, primary_key=True, autoincrement=False),
-    sa.Column('prev', sa.Integer),
+    sa.Column('hash', CHAR(40, ascii=True), nullable=False),
+    sa.Column('prev', CHAR(40, ascii=True)),
     sa.Column('txs', SMALLINT(unsigned=True), server_default='0', nullable=False),
     sa.Column('created_at', sa.DateTime, nullable=False),
-    sa.UniqueConstraint('prev', name='hive_blocks_ux1'),
-    sa.ForeignKeyConstraint(['prev'], ['hive_blocks.num'], name='hive_blocks_fk1'),
+    sa.UniqueConstraint('hash', name='hive_blocks_ux1'),
+    sa.UniqueConstraint('prev', name='hive_blocks_ux2'),
+    sa.ForeignKeyConstraint(['prev'], ['hive_blocks.hash'], name='hive_blocks_fk1'),
     mysql_engine='InnoDB',
     mysql_default_charset='utf8mb4'
 )
@@ -203,7 +205,7 @@ def setup(connection_url=_url):
 
     conn = engine.connect()
     # Insert hive_blocks data
-    insert = hive_blocks.insert().values(num=0, prev=None, created_at='1970-01-01T00:00:00')
+    insert = hive_blocks.insert().values(num=0, hash='0000000000000000000000000000000000000000', prev=None, created_at='1970-01-01T00:00:00')
     conn.execute(insert)
 
     # Insert hive_accounts data
diff --git a/hive/indexer/core.py b/hive/indexer/core.py
index 0ae9582efbefd54113f33d751f69e2cdced3b007..18959dbdbeadd7a67003388cebbe8e60b0845cb0 100755
--- a/hive/indexer/core.py
+++ b/hive/indexer/core.py
@@ -311,14 +311,13 @@ def is_community(name: str) -> bool:
 # -----------
 def process_block(block):
     date = parse_time(block['timestamp'])
-    block_num = int(block['previous'][:8], base=16) + 1
+    block_id = block['block_id']
+    prev = block['previous']
+    block_num = int(block_id[:8], base=16)
     txs = block['transactions']
 
-    # NOTE: currently `prev` tracks the previous block number and this is enforced with a FK constraint.
-    # soon we will have access to prev block hash and current hash in the API return value, we should use this instead.
-    # the FK constraint will then fail if we somehow end up on the wrong side in a fork reorg.
-    query("INSERT INTO hive_blocks (num, prev, txs, created_at) "
-          "VALUES ('%d', '%d', '%d', '%s')" % (block_num, block_num - 1, len(txs), date))
+    query("INSERT INTO hive_blocks (num, hash, prev, txs, created_at) "
+          "VALUES (%d, '%s', '%s', %d, '%s')" % (block_num, block_id, prev, len(txs), date))
 
     accounts = set()
     comments = []