# DKG and FROST

To optimize the cost of Bitcoin withdrawal transactions, where fees depend on the transaction size, TON Teleport BTC employs aggregated signature technology. This approach replaces the standard multi-signature requirement, which needs many separate signatures, with a single aggregated signature that incorporates all TON validators’ signatures. This significantly reduces the transaction size in the Bitcoin blockchain, making it comparable in size to a regular BTC transfer transaction. Aggregated signatures have been made possible by the Bitcoin upgrade known as Taproot and the support for Schnorr signatures.

The DKG process begins when validators enter a new validation epoch. Validators initiate a three-step DKG process to generate a joint public key and individual secret shares:

<figure><img src="https://2322428612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDZHm4kD4WG4CcwPh2dZ%2Fuploads%2FouSJ9MgvCjcV6nQdxcJi%2FImage-4.png?alt=media&#x26;token=78cfb06c-f9b0-4b62-8c97-07085293b0c2" alt=""><figcaption><p><em><strong>Diagram 3 - DKG</strong></em></p></figcaption></figure>

1. **Creation and distribution of packages:** Each validator generates their secret and public packages, sending the public package to a specific smart contract in TON. The secret package is kept locally.
2. **Receiving and utilizing public packages:** Validators collect all public packages from the smart contract, using them together with their secret packages to create a second set of data. This data is also published for other validators.
3. **Key finalization:** Each validator collects final public packages intended for them, forming the ultimate secret and public keys that will be used for transaction signing.

This process does not require mutual trust among validators and is not managed by a centralized operator, supporting the trustless principles of the system.

The FROST, used for transaction signing, also includes three steps:

<figure><img src="https://2322428612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDZHm4kD4WG4CcwPh2dZ%2Fuploads%2FvlnFgnP25fqOxL8cDhyj%2FImage-5.png?alt=media&#x26;token=973762ed-4673-49fa-a570-f5967829a2d3" alt=""><figcaption><p><em><strong>Diagram 4 - FROST</strong></em></p></figcaption></figure>

1. **Commit:** Validators send their commitments to a special smart contract, confirming their readiness to participate in the transaction signing.
2. **Sign:** Validators receive all commitments, use them with their secret keys to create signature shares, and send them back to the contract.
3. **Signature aggregation:** Any validator collects all signature shares, aggregates them, and sends them back to the contract, which finalizes the Bitcoin transaction.

This procedure not only optimizes the size and cost of transactions but also enhances the transparency and security of the peg-out process, allowing users to track the status of the signature in real-time.
