# solana-labs/example-helloworld architecture

> Architecture diagram of the GitHub repository solana-labs/example-helloworld, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/solana-labs/example-helloworld
- Repository: https://github.com/solana-labs/example-helloworld

## Overview

This Solana hello-world example demonstrates a client greeting an on-chain account and reading its greeting count. The client loads cluster and payer settings, prepares and verifies the program/account, submits a greeting transaction, then fetches and decodes the counter. The on-chain program validates account ownership and increments serialized state; both Rust and C implementations are present. The README points to external documentation and does not describe further capabilities. Edges reflect sampled source calls and explicit client behavior; no additional wiring is inferred.

Main entry points: [`src/client/hello_world.ts`](https://github.com/solana-labs/example-helloworld/blob/master/src/client/hello_world.ts) (Greeting workflow), [`src/client/main.ts`](https://github.com/solana-labs/example-helloworld/blob/master/src/client/main.ts) (Client entrypoint), [`src/client/utils.ts`](https://github.com/solana-labs/example-helloworld/blob/master/src/client/utils.ts) (RPC and payer config), [`src/program-rust/src/lib.rs`](https://github.com/solana-labs/example-helloworld/blob/master/src/program-rust/src/lib.rs) (Rust greeting program)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client workflow"]
  node_entry["Client entrypoint<br/>[main.ts]"]
  node_workflow["Greeting workflow<br/>[hello_world.ts]"]
  node_config["RPC and payer config<br/>[utils.ts]"]
end

subgraph group_programs["On-chain programs"]
  node_rust["Rust greeting program<br/>[lib.rs]"]
  node_c["C greeting program<br/>[helloworld.c]"]
end

node_user(("Example operator"))
node_cluster["Solana cluster"]

node_user -->|"runs"| node_entry
node_entry -->|"invokes workflow"| node_workflow
node_workflow -->|"loads settings"| node_config
node_workflow -->|"queries and submits"| node_cluster
node_cluster -->|"returns account state"| node_workflow
node_cluster -.->|"dispatches instruction"| node_rust
node_cluster -.->|"dispatches instruction"| node_c

click node_entry "https://github.com/solana-labs/example-helloworld/blob/master/src/client/main.ts"
click node_workflow "https://github.com/solana-labs/example-helloworld/blob/master/src/client/hello_world.ts"
click node_config "https://github.com/solana-labs/example-helloworld/blob/master/src/client/utils.ts"
click node_rust "https://github.com/solana-labs/example-helloworld/blob/master/src/program-rust/src/lib.rs"
click node_c "https://github.com/solana-labs/example-helloworld/blob/master/src/program-c/src/helloworld/helloworld.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_workflow,node_config toneBlue
class node_rust,node_c toneAmber
class node_user,node_cluster toneIndigo
```

## Components

### Client workflow

- [Client entrypoint](https://github.com/solana-labs/example-helloworld/blob/master/src/client/main.ts): `src/client/main.ts`
- [Greeting workflow](https://github.com/solana-labs/example-helloworld/blob/master/src/client/hello_world.ts): `src/client/hello_world.ts`
- [RPC and payer config](https://github.com/solana-labs/example-helloworld/blob/master/src/client/utils.ts): `src/client/utils.ts`

### On-chain programs

- [Rust greeting program](https://github.com/solana-labs/example-helloworld/blob/master/src/program-rust/src/lib.rs): `src/program-rust/src/lib.rs`
- [C greeting program](https://github.com/solana-labs/example-helloworld/blob/master/src/program-c/src/helloworld/helloworld.c): `src/program-c/src/helloworld/helloworld.c`

### Other components

- **Example operator**
- **Solana cluster**

## Connections

- Example operator → Client entrypoint: runs (evidence: `src/client/main.ts`)
- Client entrypoint → Greeting workflow: invokes workflow (evidence: `src/client/main.ts`)
- Greeting workflow → RPC and payer config: loads settings (evidence: `src/client/hello_world.ts`)
- Greeting workflow → Solana cluster: queries and submits (evidence: `src/client/hello_world.ts`)
- Solana cluster → Greeting workflow: returns account state (evidence: `src/client/hello_world.ts`)
- Solana cluster → Rust greeting program: dispatches instruction
- Solana cluster → C greeting program: dispatches instruction
