---
title: "Block Locator — definition | Nuri Glossary"
description: "A sparse list of known block hashes a node sends so its peer can find the fork point and continue syncing."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/block-locator"
---

# Block Locator

A sparse list of known block hashes a node sends so its peer can find the fork point and continue syncing.

## Basically

A block locator is a short, spread-out list of block hashes. Bitcoin nodes use it to bring their copy of the blockchain up to date efficiently.

## Key Takeaways

- A block locator is a compact list of block hashes that your Bitcoin node sends to a peer so they can find the most recent block both nodes share, known as the fork point.
- The list uses exponential spacing: the first 10 hashes are consecutive, then the step size doubles for each subsequent entry (2nd, 4th, 8th, 16th block back), always ending with the genesis block, which keeps the locator to roughly 30 to 40 hashes regardless of chain height.
- Block locators are carried inside the getheaders and getblocks P2P messages, making them the starting point for headers-first sync and chain synchronisation between nodes.

## What Is a Block Locator?

A block locator is a data structure in Bitcoin's peer-to-peer protocol that helps two nodes quickly find where their copies of the blockchain diverge. A node cannot simply ask a peer to "send me everything after block X" because it does not know which blocks the peer has. The nodes may share the same chain, have diverged after a chain reorganisation, or be at different heights.
A node builds a block locator instead of sending its entire chain, which would be enormous. The short, carefully chosen list of block hashes lets the peer find the most recent ancestor they share and respond with the headers or blocks the requesting node is missing.
Bitcoin Core represents the block locator with the CBlockLocator class. The class contains a protocol version number and a vector of block hashes ordered from newest to oldest. The structure is defined in the chain header files and used throughout the networking code whenever a node requests chain data from a peer.

## How It Works

The block locator relies on the fact that most chain divergences are short. Two well-connected nodes typically agree on recent history and differ by only a few blocks at the tip, while long-range forks are extremely rare. The locator covers recent blocks densely, where forks are likely, and older blocks sparsely, where forks are unlikely.

## Building the Locator

Bitcoin Core builds a block locator using the algorithm below. The algorithm selects block hashes with increasingly wide gaps as it moves back through the chain.
The result is an ordered list like the one below for a node at block height 870,000. The list moves from newer blocks to older blocks.

## Logarithmic Efficiency

The doubling step size after the first 10 entries makes the number of hashes grow logarithmically with chain height. A chain of height h needs approximately 10 + log 2 (h) entries, so a chain height of 870,000 gives roughly 10 + 20 = 30 hashes. A locator would still contain fewer than 50 hashes even if Bitcoin ran for centuries and reached a chain height of billions.
Each hash is 32 bytes, so the entire locator fits within roughly 1 to 1.5 KB of data. The message is trivially small and can pinpoint any divergence point in a chain containing hundreds of thousands of blocks.

## Finding the Fork Point

A peer processes a received block locator inside a getheaders or getblocks message as follows. The peer checks the hashes to find the most recent block it shares with the requesting node.
The peer responds starting from block 1 if none of the locator hashes match, an unlikely case where the chains share nothing except genesis. The genesis block hash at the end of every locator guarantees that at least one match is always found.

## Locator Precision

Exponential spacing means the locator might not identify the exact fork point on the first round trip, as when two chains diverged 500 blocks back and the nearest locator hash is 512 blocks back because of the exponential step. The peer would respond with headers starting from that point, and the requesting node could send a more precise locator if needed. In practice, the getheaders response of up to 2,000 headers per message covers any gap introduced by the sparse tail of the locator.

## Use in P2P Messages

Block locators appear in two key P2P protocol messages: getheaders and getblocks. Each message uses the locator to request chain data from a peer.

## getheaders

The getheaders message is the primary mechanism for headers-first synchronisation. A node sends its block locator with a stop hash, or a zero hash to request the maximum batch. The peer responds with a headers message containing up to 2,000 block headers starting from the fork point.
The node repeats getheaders requests and updates the locator each time with the latest received header until the peer has no more headers to send. The iterative process downloads the entire header chain before any full blocks are fetched, a key part of initial block download.

## getblocks

The older getblocks message uses the same locator format but triggers a different response: the peer replies with an inv (inventory) message listing block hashes rather than full headers. The message was the original synchronisation mechanism before headers-first sync was introduced. Modern nodes prefer getheaders because downloading headers first lets a node validate the chain's proof-of-work before committing to full block downloads.

## Why It Matters

Nodes would face a difficult choice during synchronisation without block locators: send their entire chain of hashes, which is wasteful, or guess a common block and risk being wrong, which is fragile. The locator solves this by compressing the chain into a logarithmic-sized summary. The summary handles both common recent forks of a few blocks and rare deep reorganisations efficiently.
The mechanism is especially critical during initial block download, when a new node must synchronise hundreds of thousands of blocks from peers. The locator ensures the node can find where to start downloading efficiently, even when connecting to peers on slightly different chain tips. You can read the Bitcoin P2P network topology research article for a deeper look at how Bitcoin nodes discover and communicate with each other.
Layer-2 protocols like Lightning and Spark rely on the underlying Bitcoin node's ability to stay synchronised with the network. The block locator is a small but essential part of the infrastructure that keeps Bitcoin nodes in consensus about the current state of the chain.

## Code Example

The following pseudocode illustrates how Bitcoin Core constructs a block locator. The actual implementation lives in the chain module and uses skip pointers for performance, but the core logic is straightforward.
The peer's processing logic follows below. The peer uses the locator hashes to find where its chain matches the requester's chain.

## No Protocol-Level Size Limit

Bitcoin's original protocol specification does not impose an explicit maximum on the number of hashes in a block locator. In practice, Bitcoin Core's exponential spacing algorithm produces at most about 42 hashes, given a 32-bit block height limit and a doubling exponent after 10 entries, but a malicious node could theoretically send thousands of hashes and consume processing time on the receiving node. Proposals on the Bitcoin development mailing list have suggested capping locator size at 64 entries to formalise this practical limit.

## Eclipse Attack Considerations

An attacker who controls all of a node's peer connections in an eclipse attack could respond to locator requests with a fabricated chain. The node would sync headers from the attacker and potentially follow a malicious fork. Bitcoin Core validates chain work during headers-first sync and only follows the chain with the most cumulative proof-of-work, making it expensive for an attacker to produce a convincing fake chain.

## Locator Accuracy vs. Chain Depth

Exponential spacing trades precision for compactness, so forks deeper than about 10 blocks will not be pinpointed exactly on the first attempt. The requesting node may receive some redundant headers it already has, but this overhead is minimal: the first round trip narrows the gap to within a factor of two, and subsequent exchanges can refine further. A single locator round trip is sufficient for the vast majority of real-world synchronisation scenarios.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. You should always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
