Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,167 changes: 1,137 additions & 30 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"indexer_service",
"indexer_service/protocol",
"indexer_service/rpc",
"explorer_service",
"programs/token/core",
"programs/token",
"program_methods",
Expand Down Expand Up @@ -123,3 +124,10 @@ actix-web = { version = "=4.1.0", default-features = false, features = [
] }
clap = { version = "4.5.42", features = ["derive", "env"] }
reqwest = { version = "0.12", features = ["json", "rustls-tls", "stream"] }

# Profile for leptos WASM release builds
[profile.wasm-release]
inherits = "release"
opt-level = 'z'
lto = true
codegen-units = 1
Binary file modified artifacts/program_methods/amm.bin
Binary file not shown.
Binary file modified artifacts/program_methods/authenticated_transfer.bin
Binary file not shown.
Binary file modified artifacts/program_methods/pinata.bin
Binary file not shown.
Binary file modified artifacts/program_methods/pinata_token.bin
Binary file not shown.
Binary file modified artifacts/program_methods/privacy_preserving_circuit.bin
Binary file not shown.
Binary file modified artifacts/program_methods/token.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/burner.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/chain_caller.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/changer_claimer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/claimer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/data_changer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/extra_output.bin
Binary file not shown.
Binary file not shown.
Binary file modified artifacts/test_program_methods/minter.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/missing_output.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/modified_transfer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/nonce_changer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/noop.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/program_owner_changer.bin
Binary file not shown.
Binary file modified artifacts/test_program_methods/simple_balance_transfer.bin
Binary file not shown.
11 changes: 11 additions & 0 deletions explorer_service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Leptos build outputs
/target
/pkg
/site

# WASM artifacts
*.wasm

# Environment
.env
.env.local
73 changes: 73 additions & 0 deletions explorer_service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[package]
name = "explorer_service"
version = "0.1.0"
edition = "2024"
license.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
indexer_service_protocol.workspace = true

# Leptos framework
leptos = "0.8.15"
leptos_meta = "0.8.5"
leptos_router = "0.8.11"

# Serialization
serde.workspace = true

# Logging
log.workspace = true
console_error_panic_hook = "0.1"
console_log = "1.0"

# Date/Time
chrono.workspace = true

# Hex encoding/decoding
hex.workspace = true

# URL encoding
urlencoding = "2.1"

# WASM-specific
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = [
"Window",
"Document",
"Location",
"HtmlInputElement",
] }

# Server-side dependencies (optional, enabled by features)
indexer_service_rpc = { workspace = true, features = [
"client",
], optional = true }
jsonrpsee = { workspace = true, features = ["http-client"], optional = true }
tokio = { workspace = true, optional = true }
axum = { version = "0.8.8", optional = true }
leptos_axum = { version = "0.8.7", optional = true }
clap = { workspace = true, features = ["derive"], optional = true }
url = { workspace = true, optional = true }
env_logger = { workspace = true, optional = true }

[features]
hydrate = ["leptos/hydrate"]
ssr = [
"leptos/ssr",
"dep:indexer_service_rpc",
"dep:jsonrpsee",
"dep:tokio",
"dep:axum",
"dep:leptos_axum",
"dep:clap",
"dep:url",
"dep:env_logger",
]

[package.metadata.leptos]
bin-features = ["ssr"]
lib-features = ["hydrate"]
assets-dir = "public"
52 changes: 52 additions & 0 deletions explorer_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM rust:1.91.1-trixie AS builder

# Install cargo-binstall, which makes it easier to install other
# cargo extensions like cargo-leptos
RUN wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
RUN tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
RUN cp cargo-binstall /usr/local/cargo/bin

# Install required tools
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends clang

# Install cargo-leptos
RUN cargo binstall cargo-leptos -y

# Add the WASM target
RUN rustup target add wasm32-unknown-unknown

# Make an /explorer_service dir, which everything will eventually live in
RUN mkdir -p /explorer_service
WORKDIR /explorer_service
COPY . .

# Build the app
RUN cargo leptos build --release -vv

FROM debian:trixie-slim AS runtime
WORKDIR /explorer_service
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl ca-certificates \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Copy the server binary to the /explorer_service directory
COPY --from=builder /explorer_service/target/release/explorer_service /explorer_service/

# /target/site contains our JS/WASM/CSS, etc.
COPY --from=builder /explorer_service/target/site /explorer_service/site

# Copy Cargo.toml as it’s needed at runtime
COPY --from=builder /explorer_service/Cargo.toml /explorer_service/

# Set any required env variables
ENV RUST_LOG="info"
ENV LEPTOS_SITE_ADDR="0.0.0.0:8080"
ENV LEPTOS_SITE_ROOT="site"
ENV INDEXER_RPC_URL="http://localhost:8779"
EXPOSE 8080

# Run the server
CMD ["/explorer_service/explorer_service"]
71 changes: 71 additions & 0 deletions explorer_service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# LEE Blockchain Explorer

A web-based UI for exploring the blockchain state, built with Rust and Leptos framework.

## Features

- **Main Page**: Search for blocks, transactions, or accounts by hash/ID. View recent blocks.
- **Block Page**: View detailed block information and all transactions within a block.
- **Transaction Page**: View transaction details including type, accounts involved, and proofs.
- **Account Page**: View account state and transaction history.

## Architecture

- **Framework**: Leptos 0.8 with SSR (Server-Side Rendering) and hydration
- **Data Source**: Indexer Service JSON-RPC API
- **Components**: Reusable BlockPreview, TransactionPreview, and AccountPreview components
- **Styling**: Custom CSS with responsive design

## Development

### Prerequisites

- Rust (stable or nightly)
- `cargo-leptos` tool: `cargo install cargo-leptos`
- Running indexer service at `http://localhost:8080/rpc` (or configure via `INDEXER_RPC_URL`)

### Build and Run

```bash
# Development mode (with hot-reload)
cargo leptos watch

# Production build
cargo leptos build --release

# Run production build
cargo leptos serve --release
```

The explorer will be available at `http://localhost:3000` by default.

### Configuration

Set the `INDEXER_RPC_URL` environment variable to point to your indexer service:

```bash
export INDEXER_RPC_URL=http://localhost:8080/rpc
cargo leptos watch
```

## Features

### Search

The search bar supports:
- Block IDs (numeric)
- Block hashes (64-character hex)
- Transaction hashes (64-character hex)
- Account IDs (64-character hex)

### Real-time Updates

The main page loads recent blocks and can be extended to subscribe to new blocks via WebSocket.

### Responsive Design

The UI is mobile-friendly and adapts to different screen sizes.

## License

See LICENSE file in the repository root.
11 changes: 11 additions & 0 deletions explorer_service/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
explorer_service:
image: lssa/explorer_service
build:
context: ..
dockerfile: explorer_service/Dockerfile
container_name: explorer_service
environment:
INDEXER_RPC_URL: ${INDEXER_RPC_URL:-http://localhost:8779}
ports:
- "8080:8080"
Loading