<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/Chain",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel5ChainC"
  },
  "title" : "Chain"
}
-->

# Chain

A view of the active blockchain — the unbroken sequence of blocks from
genesis to the chainstate’s current tip.

```
final class Chain
```

## Overview

Obtained via [`activeChain`](/documentation/BitcoinKernel/ChainstateManager/activeChain). Exposes height-indexed
lookups ([`entry(atHeight:)`](/documentation/BitcoinKernel/Chain/entry(atHeight:))) and active-chain membership testing
([`contains(_:)`](/documentation/BitcoinKernel/Chain/contains(_:))) — useful for distinguishing a block that’s on the
current chain from one on a side chain, after a reorg.

A **view type**: its lifetime is tied to the [`ChainstateManager`](/documentation/BitcoinKernel/ChainstateManager) that
produced it. Retains the manager to keep the C pointer valid; `deinit`
performs no kernel destruction.