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

# Onchain vs Offchain

Hello.Fun separates financial execution from the infrastructure used to display and organize information.

The core launch and market mechanics operate onchain.

The supporting backend reads blockchain activity and makes that information easier to use through the Hello.Fun interface.

### The Core Difference

A simple way to understand the architecture is:

**Onchain executes.**

**Offchain reads, organizes and serves data.**

```mermaid
flowchart LR
    A["User"] --> B["Hello.Fun Interface"]
    B --> C["User Wallet"]
    C --> D["Onchain Contracts"]

    D --> E["Blockchain Events"]
    E --> F["Offchain Infrastructure"]
    F --> B
```

The two sides work together, but they have different responsibilities.

### What Happens Onchain

The core Hello.Fun market lifecycle operates through smart contracts on Robinhood Chain.

Onchain functions include:

1. Creating launch contracts
2. Creating the token supply
3. Running the bonding curve
4. Processing buys and sells
5. Holding launch reserves
6. Tracking graduation state
7. Graduating a launch
8. Creating the Uniswap v4 market
9. Establishing liquidity
10. Permanently locking the liquidity position
11. Accounting for protocol and creator fees
12. Processing fee claims

```mermaid
flowchart TD
    A["Launch"] --> B["Bonding Curve"]
    B --> C["Trading"]
    C --> D["Graduation"]
    D --> E["Uniswap v4"]
    E --> F["Permanent Liquidity"]
```

These mechanics do not depend on the Hello.Fun backend holding or moving user funds.

### What Happens Offchain

Hello.Fun uses supporting infrastructure to make blockchain information accessible through the platform.

Offchain responsibilities include:

1. Indexing blockchain events
2. Storing indexed market information
3. Serving market data to the frontend
4. Handling token metadata submissions
5. Providing realtime interface updates

```mermaid
flowchart LR
    A["Blockchain Activity"] --> B["Indexer"]
    B --> C["Database"]
    C --> D["API"]
    D --> E["Hello.Fun Interface"]
```

This infrastructure helps users understand what is happening onchain.

It does not replace the smart contracts that execute the market.

### User Funds

Hello.Fun's backend does not take custody of user funds.

When a user performs a state changing action, the transaction is signed through the user's wallet.

```mermaid
sequenceDiagram
    participant U as User
    participant H as Hello.Fun
    participant W as Wallet
    participant C as Contracts

    U->>H: Select action
    H->>W: Prepare transaction
    W->>U: Request approval
    U->>W: Sign transaction
    W->>C: Submit onchain
    C-->>W: Transaction result
```

The backend does not contain a private key that can trade or launch tokens for users.

### Launching a Token

Creating a token demonstrates how the two sides work together.

Before launch, the interface helps the creator prepare the token information.

The metadata service handles the submitted metadata.

The actual token and bonding curve are then created onchain through the user's signed transaction.

```mermaid
flowchart TD
    A["Creator Enters Token Details"] --> B["Metadata Prepared"]
    B --> C["Launch Transaction Prepared"]
    C --> D["Creator Signs"]
    D --> E["Smart Contracts Execute"]
    E --> F["Token and Bonding Curve Created"]
```

The launch itself is an onchain action.

### Trading

Trading also occurs onchain.

Before graduation, trades execute through the launch's bonding curve.

After graduation, trades execute through the graduated Uniswap v4 market.

```mermaid
flowchart TD
    A["User Trade"] --> B{"Market Stage"}
    B -->|"Before Graduation"| C["Bonding Curve"]
    B -->|"After Graduation"| D["Uniswap v4"]
    C --> E["Onchain Settlement"]
    D --> E
```

The Hello.Fun interface helps users request quotes and prepare transactions, but settlement occurs through the blockchain.

### Graduation

Graduation is an onchain transition.

The launch reserves are moved through the graduation process and used to establish the Uniswap v4 market.

The resulting liquidity position is transferred into the permanent liquidity locker.

```mermaid
flowchart LR
    A["Bonding Curve"] --> B["Graduation"]
    B --> C["Uniswap v4 Pool"]
    C --> D["Liquidity Position"]
    D --> E["Permanent Locker"]
```

The backend does not perform this transition by changing a database entry.

The blockchain state determines whether the launch has graduated.

### Market Data

While market activity happens onchain, presenting that activity efficiently requires indexed data.

Hello.Fun indexes blockchain events and organizes them into market information.

```mermaid
flowchart LR
    A["Onchain Events"] --> B["Indexer"]
    B --> C["Market Data"]
    C --> D["Hello.Fun"]
```

This supports information such as:

| Market Information    | Source                         |
| --------------------- | ------------------------------ |
| Price                 | Indexed market state           |
| Market Capitalization | Indexed price and token supply |
| 24 Hour Volume        | Indexed trades                 |
| Liquidity             | Indexed market state           |
| Holders               | Indexed token activity         |
| Transactions          | Indexed events                 |
| Charts                | Indexed historical activity    |
| Pair Information      | Launch and market state        |

The interface uses this data to make onchain activity easier to explore.

### Token Metadata

Metadata is handled differently from financial market state.

Before launch, token information is submitted through the Hello.Fun metadata infrastructure.

The resulting metadata reference is included when the token is created.

```mermaid
flowchart LR
    A["Token Details"] --> B["Metadata Service"]
    B --> C["Metadata Reference"]
    C --> D["Token Creation"]
```

Once written into the launched token, the metadata reference is immutable.

The metadata service therefore supports the launch process, while the token itself records the reference used by that launch.

### Realtime Information

Hello.Fun also uses a realtime service to push updated information to the interface.

```mermaid
flowchart LR
    A["New Onchain Activity"] --> B["Indexer"]
    B --> C["Stored Data"]
    C --> D["Realtime Service"]
    D --> E["User Interface"]
```

This improves how quickly users can see new activity without changing where the underlying transaction occurred.

### Backend Availability and Onchain State

The Hello.Fun backend makes the platform easier to browse and use.

The underlying smart contract state exists independently on Robinhood Chain.

```mermaid
flowchart TD
    A["Robinhood Chain"] --> B["Onchain State"]
    B --> C["Hello.Fun Indexer"]
    C --> D["Hello.Fun Interface"]
```

The interface is a way to access and understand that state.

It is not the source of the onchain state itself.

### Responsibility Summary

| Function                   | Onchain | Offchain |
| -------------------------- | :-----: | :------: |
| Token deployment           |   Yes   |    No    |
| Token supply creation      |   Yes   |    No    |
| Bonding curve trading      |   Yes   |    No    |
| Holding curve reserves     |   Yes   |    No    |
| Graduation                 |   Yes   |    No    |
| Uniswap v4 pool creation   |   Yes   |    No    |
| Liquidity custody          |   Yes   |    No    |
| Fee accounting             |   Yes   |    No    |
| Fee claims                 |   Yes   |    No    |
| Blockchain indexing        |    No   |    Yes   |
| Market data storage        |    No   |    Yes   |
| Metadata submission        |    No   |    Yes   |
| API data delivery          |    No   |    Yes   |
| Realtime interface updates |    No   |    Yes   |

### Why the Separation Matters

The separation keeps financial execution within the smart contract system while allowing Hello.Fun to provide a faster and more understandable interface around that activity.

```mermaid
flowchart TD
    A["User Wallet"] --> B["Onchain Execution"]
    B --> C["Blockchain State"]
    C --> D["Offchain Indexing"]
    D --> E["Readable Market Data"]
    E --> F["Hello.Fun Interface"]
```

**Your wallet authorizes.**

**The contracts execute.**

**The blockchain records.**

**Hello.Fun indexes and displays.**


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hello-fun-1.gitbook.io/hello.fun-docs/onchain-vs-offchain.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
