> For the complete documentation index, see [llms.txt](https://qanplatform-1.gitbook.io/qanplatform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qanplatform-1.gitbook.io/qanplatform/blocks.md).

# Blocks

A block records some or all of the most recent transactions that have not yet entered any prior blocks. Thus, a block is like a page of a ledger or record book.

## Computation

What does a block contain:

* hash – Hash of the current block – 32 byte
* PoW - Proof of Work - 32 byte
* Prev\_hash - Previous Block hash - 32 byte
* txes - the contained transactions - N \* 32 byte (N is the count of txes)
* Timestamp - the timestamp of the block - 64bit unsigned integer
* Sig - the signature of the block - 16384 byte&#x20;

You can create a new Block by passing in the prev\_hash to the constructor. This will create a Block with empty hash, pow, txes and sig fields, the timestamp is set to the current timestamp.

* add\_tx(hash) - adds the transaction hash to the block
* block\_to\_blob() - serializes the block, returns a Vec‹u8›
* block\_from\_vec(Vec) - Deserialize the block, and returns it
* hash() - Returns the computed hash for the block
* close\_block(keypair, pow) – closes the block, signs it, and returns the hash for the block

The hash is an SHA3-256 cryptographic hash, which is calculated when close\_block is called.
