> For the complete documentation index, see [llms.txt](https://stoxfi.gitbook.io/stoxfi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stoxfi.gitbook.io/stoxfi-docs/stoxfi-overview.md).

# StoxFi Overview

StoxFi is a confidential settlement layer for tokenized equities. It connects public tokenized stock custody on Robinhood Chain with confidential balances and transfers on Ethereum.

The protocol is built around a simple lifecycle:

**Shield → Transfer Confidentially → Unshield**

A user begins with a standard tokenized stock ERC 20 on Robinhood Chain. The asset is deposited into StoxVault, where it remains locked as collateral. A cross chain instruction then creates the corresponding confidential balance on Ethereum.

Once inside the confidential environment, the position is represented as an encrypted `euint64` balance. Transfers between users operate directly on encrypted values, allowing the amount to remain hidden from public observers.

When the holder wants to exit, the confidential amount is burned. The redemption amount is made publicly decryptable and verified before a return instruction authorizes the release of the corresponding underlying tokens from StoxVault.

Throughout this process, the underlying asset remains on Robinhood Chain. StoxFi uses cross chain messaging to communicate instructions between the public custody layer and the confidential execution layer.

### The StoxFi Lifecycle

#### 1. Shield

A user enters StoxFi by depositing a supported ERC 20 into StoxVault on Robinhood Chain.

StoxVault receives the tokens and verifies the exact amount received. It then converts the underlying amount from its original decimal representation into the 6 decimal format used by the corresponding ConfidentialStock.

The converted amount is checked against the confidential supply limit before the vault sends a mint instruction through Chainlink CCIP.

The underlying tokens remain locked inside StoxVault.

After the instruction is received and validated on Ethereum, the corresponding ConfidentialStock creates the encrypted balance for the designated recipient.

The shield amount is public. It is visible in the original ERC 20 deposit and is included as cleartext in the cross chain message.

Confidentiality begins once the position exists inside the confidential environment and is subsequently transferred using encrypted amounts.

### 2. Transfer Confidentially

Once a confidential position exists, the holder can transfer value to another address without revealing the transferred amount.

The transfer amount is encrypted before it is submitted to ConfidentialStock.

The contract then operates directly on encrypted values. It evaluates whether the sender has sufficient funds and whether the recipient has sufficient capacity without decrypting the requested amount.

If the transfer can be completed, the encrypted value is subtracted from the sender and added to the recipient.

If it cannot be completed, the contract moves an encrypted zero instead of exposing information through a revert.

The resulting balances remain encrypted.

The transfer event records the sender and recipient addresses but does not contain an amount.

As a result, participation remains publicly observable while the financial value transferred between the participants remains confidential.

### 3. Unshield

Unshielding converts a confidential position back into the underlying token on Robinhood Chain.

The process begins with a redemption request.

The requested amount is clamped to the holder's available encrypted balance and burned immediately. This burn occurs before any collateral can be released.

The burned amount is then made publicly decryptable. The FHE infrastructure produces the clear amount together with the signatures required for verification.

The redemption is finalized by submitting the clear amount and its decryption proof to ConfidentialStock.

Once the proof is verified, ConfidentialStock sends a release instruction through Chainlink CCIP.

StoxVault receives the instruction, validates its origin, checks that the message has not already been processed, and caps the release against the collateral recorded for the corresponding asset.

The appropriate quantity of the underlying ERC 20 is then returned to the designated destination.

The unshield amount is public by design.

### Three Core StoxFi Contracts

The protocol is built around three principal contracts.

#### StoxVault

StoxVault operates on Robinhood Chain.

Its responsibilities include:

1. Custody of underlying ERC 20 assets
2. Decimal conversion
3. Tracking locked collateral
4. Dispatching shield instructions
5. Receiving release instructions
6. Authorizing collateral release

StoxVault does not burn the underlying asset during shielding. The asset remains locked until a valid redemption authorizes its release.

#### ConfidentialStock

ConfidentialStock operates on Ethereum.

A separate ConfidentialStock contract represents each supported stock.

Its responsibilities include:

1. Maintaining encrypted `euint64` balances
2. Creating confidential balances following validated shield instructions
3. Executing confidential transfers
4. Managing redemption requests
5. Burning confidential balances
6. Verifying redemption proofs
7. Dispatching release instructions

ConfidentialStock has no administrative mint function. Minting occurs only through a validated cross chain instruction from its bound StoxVault.

#### StoxRegistry

StoxRegistry operates on Ethereum and provides asset discovery.

It does not custody funds and does not control StoxVault or ConfidentialStock.

Its purpose is to provide a directory of supported assets that can be used by the StoxFi application.

### What Moves Between Chains

StoxFi does not move the underlying stock token between Robinhood Chain and Ethereum.

Only instructions cross between the two environments.

During shielding, the message communicates the recipient and the amount that should be represented confidentially.

During unshielding, the message communicates the destination and the amount of collateral that should be released.

The underlying collateral remains inside StoxVault on Robinhood Chain throughout the confidential lifecycle.

### Asset Representation

The public and confidential sides of StoxFi use different balance representations.

| Property              | Public Asset                     | Confidential Representation |
| --------------------- | -------------------------------- | --------------------------- |
| Location              | Robinhood Chain                  | Ethereum                    |
| Token form            | Standard ERC 20                  | ConfidentialStock           |
| Balance type          | Public `uint256`                 | Encrypted `euint64`         |
| Decimals              | 18 in the current implementation | 6                           |
| Balance visibility    | Public                           | Encrypted                   |
| Transfer amount       | Public                           | Encrypted                   |
| Participant addresses | Public                           | Public                      |

For an 18 decimal underlying token, StoxFi converts the public representation into the 6 decimal confidential representation using a conversion rate of `10^12`.

The underlying collateral remains locked while the confidential representation exists.

### Confidentiality Boundary

StoxFi is designed to conceal financial values during the confidential portion of the lifecycle.

A public observer can see the addresses involved in confidential transfers, the asset being used, transaction timing, transaction frequency, shield amounts, and unshield amounts.

The observer cannot determine the confidential balance or the amount transferred between users.

This means the confidentiality boundary begins after shielding and ends during redemption.

StoxFi therefore provides encrypted balances and confidential transfer amounts while preserving public entry and exit points.

### Application Architecture

StoxFi includes a browser based application supporting:

1. Shielding
2. Confidential transfers
3. Unshielding
4. Portfolio interaction

The application is built with Vite, React 18, wagmi, Reown AppKit, and the FHE relayer SDK.

There is no StoxFi backend, API service, database, or StoxFi operated relayer.

The browser application communicates directly with RPC endpoints, the user's wallet, and the external FHE relayer.

Browser local storage can mirror pending operations for user experience purposes, but it is not authoritative state. Pending redemption information can be reconstructed from the state stored onchain.

### Current Implementation

StoxFi has implemented and demonstrated the complete lifecycle across Robinhood Chain testnet and Ethereum Sepolia.

The demonstrated functionality includes shielding collateral, creating encrypted balances, transferring confidential value between addresses, redeeming encrypted balances, verifying decrypted redemption amounts, and releasing the corresponding underlying collateral.

The current deployment uses StoxFi deployed stand in tokens representing NVDA, TSLA, and NFLX. These are demonstration tokens and do not represent real NVIDIA, Tesla, or Netflix equity exposure.

The current implementation demonstrates the complete StoxFi settlement model using test assets and test networks.


---

# 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://stoxfi.gitbook.io/stoxfi-docs/stoxfi-overview.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.
