# Bifrost, TSS and Vaults

## Overview

THORChain is a decentralized cross-chain liquidity protocol that enables native asset swaps across different blockchains without wrapped tokens. At its core, THORChain operates as a distributed vault manager using three key technologies:

1. **Bifrost Protocol** - Cross-chain bridge for observing and processing external chain transactions
2. **Vault System** - Two-layer architecture for secure asset custody
3. **Threshold Signature Scheme (TSS)** - Distributed key management for vault control

![How THORChain works](https://836872681-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lkfu6B_aaimdwQoqPhW%2Fuploads%2Fgit-blob-12c086da71487cd53c06519d46ecef018d7e1266%2Fimage%20\(4\).png?alt=media)

## The Bifrost Protocol

Bifrost is THORChain's cross-chain bridge module that enables the protocol to interact with external blockchains. Each THORNode runs a Bifrost service that:

* Observes external blockchain transactions involving THORChain vaults
* Validates transactions through consensus (requires 67% agreement)
* Processes both instant-finality and delayed-finality chains
* Signs outbound transactions using TSS

When nodes observe an inbound transaction, they convert it into a standardized witness transaction format that THORChain can process, regardless of the source chain's architecture.

![Bifrost Protocol Architecture](https://836872681-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lkfu6B_aaimdwQoqPhW%2Fuploads%2Fgit-blob-a68a042b46158086bee30830741768b57e19f458%2Fimage%20\(6\).png?alt=media)

{% hint style="info" %}
For complete technical specifications including transaction structures, chain clients, and integration details, see the [Bifrost Developer Documentation](https://dev.thorchain.org/bifrost/how-bifrost-works.html).
{% endhint %}

## Vault System Architecture

THORChain uses a sophisticated two-layer vault system designed for security and scalability:

### Two-Layer Vault Design

1. Logical Vaults - Represent a bonded set of validator nodes
2. Physical Vaults - Sharded instances of logical vaults for operational efficiency

All vaults use Threshold Signature Scheme (TSS) for distributed control, requiring a supermajority of nodes to sign transactions. This eliminates single points of failure while maintaining operational efficiency.

### Vault Sharding

To support network scaling, THORChain automatically shards vaults based on the `asgardsize` parameter (default: 20 nodes per shard). With 120 active nodes, the system will operate 6 physical vault shards, each controlled by a subset of validators.

### Vault Selection

The protocol dynamically selects which vault receives inbound transactions based on the highest bond-to-asset ratio, ensuring funds are always directed to the most secure vault. This selection rotates automatically as vault compositions change.

![THORChain State Machine](https://836872681-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lkfu6B_aaimdwQoqPhW%2Fuploads%2Fgit-blob-dd5dc4fe320e714dd62852bbdf88b488302298e1%2Fimage%20\(16\).png?alt=media)

{% hint style="info" %}
For detailed vault behaviors, sharding logic, and security mechanisms, see the [Vault Behaviors Documentation](https://dev.thorchain.org/bifrost/vault-behaviors.html).
{% endhint %}

## Vault Lifecycle

Vaults progress through a defined lifecycle:

1. InitVault - Newly created vault, not yet active
2. Active - Processing inbound and outbound transactions
3. Retiring - Migrating funds to new vaults, no new inbound transactions
4. Inactive - Empty vault, eventually pruned from state

## Migration Process

Vault migration ensures continuous operation during validator set changes:

* Occurs automatically during churn cycles when validator sets change
* Prioritizes non-gas assets for migration efficiency
* Executes across multiple rounds to prevent congestion
* Maintains service availability throughout the process

### Security During Migration

When vaults retire, the newest vault immediately becomes active for receiving funds. The retiring vault continues to be monitored until migration completes, after which it becomes inactive.

{% hint style="danger" %}
Never send funds to a retired vault address. Once migration completes and the vault becomes inactive, any funds sent to that address are permanently lost and cannot be recovered.
{% endhint %}

## Threshold Signature Scheme (TSS)

TSS enables distributed control of vault assets without any single party having complete access:

* No Single Point of Failure - No complete private keys exist
* Threshold Security - Requires supermajority participation
* Chain Agnostic - Works across all supported blockchains
* Efficient Operations - Enables fast transaction signing

![TSS Signing Process](https://836872681-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lkfu6B_aaimdwQoqPhW%2Fuploads%2Fgit-blob-81076f1c6554b39afadc865520a95d80739ca669%2Fimage%20\(10\).png?alt=media)


---

# Agent Instructions: 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:

```
GET https://docs.thorchain.org/technical-documentation/technology/bifrost-tss-and-vaults.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
