# Anchoring L2s on BTC

#### What It Means

Anchoring Layer 2 (L2) solutions on Bitcoin (BTC) involves using the Bitcoin blockchain to secure and validate transactions that occur on secondary layers (L2s). These secondary layers can process transactions more efficiently and at a lower cost while leveraging Bitcoin's robust security. Anchoring ensures that the integrity and authenticity of L2 transactions are preserved by periodically committing their data to the Bitcoin blockchain.

What are types of L2 rollups that can be anchored?

Rollups: Solutions that batch multiple transactions into a single on-chain transaction. They are categorized into two types:

* **Optimistic Rollups:** Optimistic Rollups are a type of L2 solution that batch transactions and post state roots to Layer1s. The primary advantage of Optimistic Rollups is their ability to handle a large number of transactions off-chain, reducing the load on the main chain and improving scalability. That is, we assume transactions are valid by default and rely on fraud proofs to challenge invalid transactions.
* **Zero-Knowledge (ZK) Rollups:** zk-Rollups (zero-knowledge Rollups) are another type of L2 solution that batch transactions and validate them using zero-knowledge proofs. That is, use cryptographic proofs to verify the validity of transactions, ensuring correctness without needing to rely on fraud proofs. The key advantages of zk-Rollups are enhanced security and efficiency.

#### How to Anchor

To anchor L2s on Bitcoin, follow these general steps:

**For Optimistic Rollups**

1. Develop the logic for batching transactions: Create mechanisms to group multiple transactions into a single batch. This reduces the number of transactions that need to be posted to Satschain, optimizing resource usage.
2. Post state roots: After batching transactions, post the resulting state root to Satschain. The state root is a cryptographic hash representing the new state of the blockchain after the transactions have been executed.
3. Implement fraud proofs: Design and implement a system for generating and verifying fraud proofs. Fraud proofs are essential for maintaining the integrity of the rollup by allowing anyone to challenge and prove invalid transactions. When a fraudulent transaction is detected, the rollup can revert to the previous valid state, ensuring the correctness of the blockchain.

**For ZK Rollups**

1. Develop zero-knowledge proof mechanisms: Create cryptographic proofs that validate the correctness of batched transactions without revealing the underlying data. Zero-knowledge proofs ensure that the transactions are correct while maintaining privacy.
2. Batch transactions: Group multiple transactions into a single batch and generate a zero-knowledge proof to validate the batch.
3. Post proofs to Satschain: Submit the zero-knowledge proofs to Satschain to verify the validity of the transactions. The proofs ensure that the state transitions are correct without needing to reveal the details of each transaction.
