<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/Block/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel5BlockCyAC10Foundation4DataVKcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Parses a block from its consensus-serialized bytes.

```
init(_ data: Data) throws
```

## Parameters

`data`

Consensus-serialized block bytes.

## Discussion

The input is the same byte layout used on the Bitcoin P2P wire and
in `blk*.dat` files: header + varint(tx count) + transactions.
Parsing is structural only — the kernel checks the block is
well-formed, not that it passes consensus rules or proof-of-work.

> Throws: ``doc://BitcoinKernel/documentation/BitcoinKernel/KernelError/blockCreationFailed`` when the bytes fail
> to decode (wrong magic, truncated, invalid varint, malformed
> transactions).