Initializer
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
KernelError.blockCreationFailed when the bytes fail to decode (wrong magic, truncated, invalid varint, malformed transactions).