> For the complete documentation index, see [llms.txt](https://tgbtc.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tgbtc.gitbook.io/docs/whitepaper/key-concepts/peg-in-btc-deposit.md).

# Peg-in (BTC Deposit)

Peg-in is a process allowing users to transfer BTC from the Bitcoin blockchain to the TON blockchain. As a result of this transfer, users receive an equivalent amount of tgBTC on the TON blockchain. These tokens can be utilized within the TON network. The diagram visually illustrates the sequential stages of this process, as described below.

<figure><img src="/files/3ar7jP0jRq1TG5nedprM" alt=""><figcaption><p><em><strong>Diagram 1 - Peg-in (tgBTC Deposit)</strong></em></p></figcaption></figure>

Simple user scenario:

1. **Deposit Address Generation:** The process begins with the TON Teleport BTC system generating a unique Bitcoin network address where the user must send their BTC. This address is uniquely linked to the recipient’s address in the TON blockchain, ensuring that funds are credited to the correct account. Additionally, the deposit address is protected by a refund mechanism in case of a failed deposit.
2. **BTC Transfer:** The user sends the specified amount of BTC to the generated address. This transaction is then recorded on the Bitcoin blockchain.
3. **Block Confirmation:** The transaction must be included in a block by Bitcoin miners. The appearance time of the transaction block can vary, typically taking from a few minutes to several hours, depending on network congestion and fee size.
4. **Synchronization and Confirmation in TON Teleport BTC:** TON Teleport BTC continuously syncs with the Bitcoin network’s state. Once the block containing the user’s transaction is recorded, the system waits for the necessary number of confirmations (standardly 6 blocks) to protect against potential reorganization of the Bitcoin network.
5. **Processing in TON Teleport BTC:** After the block is confirmed, the user transmits their transaction data to the TON network. Smart contracts on the TON blockchain verify the transaction for correctness and inclusion in the confirmed block.
6. **Minting of tgBTC:** If the verification is successful, the system mints tgBTC equivalent to the amount of BTC sent. These tokens are credited to the user’s address in the TON network.
7. **Token Usage:** The minted tokens are available for use in various decentralized financial operations within the TON ecosystem.

The Peg-in process in TON Teleport BTC is fully automated and does not require third-party intervention. Users carry no risk of human error, censorship, or fraud. All operations are strictly controlled by smart contracts, ensuring that users can be confident that their transactions will always be processed, and tgBTC will be minted to their accounts without the risk of loss or blockages.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tgbtc.gitbook.io/docs/whitepaper/key-concepts/peg-in-btc-deposit.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
