<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/BlockHeader/bits",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel11BlockHeaderC4bitss6UInt32Vvp"
  },
  "title" : "bits"
}
-->

# bits

The difficulty target in compact (`nBits`) encoding — the
threshold the block’s hash must meet or fall below for the
proof-of-work to be valid.

```
var bits: UInt32 { get }
```

## Discussion

Decodes per Bitcoin Core’s
[`arith_uint256::SetCompact`](https://github.com/bitcoin/bitcoin/blob/master/src/arith_uint256.cpp):
top byte = exponent, low 23 bits = mantissa; the full 256-bit
target is `mantissa << 8*(exponent-3)`.