# Bitcoin Blockchain Verification

When Bitcoin Blockchain Verification is enabled for a template, every generated PDF will have a timestamp proof recorded in the Bitcoin blockchain. This proof cryptographically verifies the integrity and existence of the PDF at the time of verification.

### Chainpoint Proofs

When we generate a PDF, we calculate the SHA256 hash of the file contents. This hash is used to
create a Chainpoint Proof. Chainpoint uses
Merkle trees to calculate a single root hash that verifies a large number of records.
The root hash is then included in a single Bitcoin transaction, via the `OP_RETURN`

opcode.
(This technique is used to save money, because Bitcoin transactions can be expensive.)

Here is a real Chainpoint Proof that was generated for one of our PDFs:

```
{
"@context": "https://w3id.org/chainpoint/v2",
"type": "ChainpointSHA256v2",
"targetHash": "de91499a024646afe08da1422e836ea3669cd848bdf8c40680df3db475e951fa",
"merkleRoot": "fc0c4b0b328b9723d954c12e87d7f4d3e89988203cc8fb0c9651b94f527f9cc3",
"proof": [
{
"right": "a183ffd912ff38dfb35d3ea49b421a452f6ef0cab58f7d6eeca25b71ccf8ace9"
},
{
"right": "af3acf22ecfa5668064b2385a85d3638b2ccc4da4ab21b162afa02f1f1d2b47e"
},
{
"left": "e8acaf0f4e176e1fea5e3f8b11887bde407425a98c71fd7152bfdebffd260fef"
},
{
"right": "d21010d552ac53ce7b0009ba4264e0a0adf15ec9bda5c214f13d194ea2688f55"
}
],
"anchors": [
{
"type": "BTCOpReturn",
"sourceId": "4dc1ef829128355fdbbf3afbf0de854778e0e027481e9a5ff53a64d9ab39a78c"
}
]
}
```

`targetHash`

is the SHA256 hash of our PDF file`merkleRoot`

is the Merkle Tree root hash. This is generated by combining the`targetHash`

with all of the hashes in the`proof`

.`sourceId`

(under`anchors`

) is the Bitcoin transaction ID

A Chainpoint Proof is self-contained, and verification doesn't require any third-party services. However, you can use an online validator for convenience. Visit https://tierion.com/validate, and paste in the proof. You should see a success message that says "Receipt is valid."

### Bitcoin Transactions

View the Bitcoin transaction on Blockchain.com.

You should see the following data under "Output Scripts":

```
RETURN PUSHDATA(32)[fc0c4b0b328b9723d954c12e87d7f4d3e89988203cc8fb0c9651b94f527f9cc3]
```

This hash matches the `merkleRoot`

in our proof. This proves that our SHA256 hash was known at the time
of this Bitcoin transaction. It is virtually impossible
to produce a file with the same SHA256 hash, so this verifies the integrity and existence of our PDF.

### Limitations

#### The proof only verifies that the PDF existed

You must save a copy of the PDF, because we don't store the *contents* of the PDF on the blockchain.
The proof becomes useless if you lose the original PDF file, or if the file is changed in any way.
The proof can not be used to verify a scan or photograph of the original PDF.

#### We cannot verify the *authenticity* of a PDF

We can only prove that the PDF existed at a certain point in time. We cannot prove that it contains true and accurate information. For example, it is possible to verify a PDF that contains a forged signature.