# The Bitcoin Bridge

Each minute's tick records the newest Bitcoin block and is anchored on Ethereum Classic, and once an hour the roots of that hour's ticks go the other way, into a Bitcoin block through OpenTimestamps. Each chain ends up recording the other.

The bridge runs both ways. Every minute each Etchd tick commits the newest Bitcoin block head in its beacon root and goes on Ethereum Classic. Every hour the hour's tick roots roll up into one root that two OpenTimestamps calendars carry into a Bitcoin block hours later.

## Bitcoin Into Ethereum Classic, Every Minute

Bitcoin is the first of the [beacon chains](https://etchd.app/docs/ticks#beacon). Each tick's `beacon_root` commits to the newest Bitcoin block head the calendar saw, checked by a quorum of public RPCs, and the tick root then goes into an ETC transaction with the rest of the tick.

The raw Bitcoin block header sits in the tick's evidence object, served at `/v1/ticks/<n>/beacon/<chain>`, where you can check that head offline. Any tick naming that block came after it.

## Ethereum Classic Into Bitcoin, Every Hour

Once an hour the calendar's [Bitcoin Bridge](https://github.com/classix-dev/etchd/blob/main/DEPLOY.md#bitcoin-bridge) workflow builds a Merkle tree over the hour's tick roots and stamps the root through two public OpenTimestamps aggregators, `a.pool.opentimestamps.org` and `a.pool.eternitywall.com`. Then it checks their pending attestations at 3, 6, 12 and 24 hours, and every 12 hours after that, for up to 30 days. When one of them reaches a Bitcoin block, the proof we serve for each tick in that hour gains a second branch, about six hops long, that ends in a Bitcoin block header attestation.

Each roll-up lands in the [CAR file](https://etchd.app/docs/data) of the day it completed.

## Upgrading to the Bitcoin Branch

A few hours after the ETC attestation, run `etchd upgrade` again to pick up the Bitcoin branch. Stock `ots verify` then completes through Bitcoin. Stock `ots upgrade` only asks calendars on its whitelist. It does not list ours yet. Pass it by name.

```
ots --whitelist https://a.etc.calendar.etchd.app upgrade report.pdf.ots
ots verify report.pdf.ots
```

The Bitcoin branch survives even a deep reorg that moves the ETC transaction, because a tick root never changes after it is sealed.

## A Tick Between Two Bitcoin Blocks

The beacon places a tick after one Bitcoin block and the roll-up places it before a later one. That later block usually comes hours after the tick, which makes it a much looser bound than the ETC anchor block, but it rests on a second chain with its own miners and its own algorithm.
