# Consensus on transactions

When witness transactions arrive, the network must process them and decide which ones are correct.

To reach an agreement on a transaction ID, the network looks through all relevant witness transactions. If the network determines that 55% of the nodes agree with a transaction, it's approved and considered correct.

### Managed storage (keeper)

YAR protocol manages different types of stores (keepers):

* **Transferable Asset Keeper** - stores coins and tokens, including NFT;
* **Non-Transferable Asset Keeper** - stores the dynamic state of a smart contract;
* **Data Keeper** - catalogs asset owners of previous Keepers.

Keepers aren't custodians - all outgoing transactions are processed by the system and initiated only by an asset owner. Nodes cannot withdraw funds.

Stores are designated by the Threshold Signing Scheme (TSS). TSS requires that 55% of nodes approve a transaction to leave the store.

Each connected chain has a primary store for storing incoming funds and multiple secondary stores for sending funds.

Each YAR protocol port is connected to each primary store and some secondary stores.

### Receiving and transferring assets

To send assets to YAR, liquidity providers must first obtain the current address of the main storage in that network. They request this information from several different nodes. This prevents a spoofed address from being sent - a "spoofing attack."

Once the assets are sent, the nodes receive a modified address status code and/or smart contract and enter the money into the main storage address. They create witness transactions and send them to the network, assigning an asset to an owner and simultaneously minting the asset in the YAR chain.

When an asset needs to be sent to the external network, a node invokes a secondary storage selection algorithm. This checks whether a sender owns an asset and has the resources to send an external asset. This is important when working with tokens from networks that require payment in the network's currency for a transaction.

### Storage balance and life support

In preparation for an outgoing transaction, the network looks for secondary storage with sufficient assets.

To ensure that the store has sufficient assets for outgoing transactions, it's automatically replenished periodically. Typically, half of the assets for the pool are stored in the main storage and the other half in the secondary storage.

The main storage is replenished every few days as part of the keep-alive protocol. This can also happen more frequently, such as when the network connection requests an update. Secondary storage is also rebuilt when one of the supporting nodes leaves the network. Cyclic stores ensure that they always have a minimum number of active nodes.


---

# 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.yarchain.org/whitepaper/project-mechanics/consensus-on-transactions.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.
