🧠 Inspiration

Web3 could be a difficult concept for new learners and students, and get overwhelmed when they scan a transaction or a smart contract. Sui-Lens provides a playground for new web3 pioneers and explorers an option to view the structure, overview and normalized modules of .move smart contract on SUI blockchain but also give an option to analyze the smart contract with our AI, Gemini.

More importantly, it gives an option for them to generate .move smart contract using their natural language of their input.

Furthermore, Developers exploring Sui smart contracts often need to juggle multiple tools — chain explorers, CLI utilities, and manual decoding of Move modules. We wanted to simplify that. Sui-Lens unifies these fragmented experiences into one intuitive visual explorer that makes understanding on-chain logic effortless, searchable, and AI-assisted.

⚙️ What it does

Sui-Lens indexes smart contracts deployed on the Sui blockchain and provides:

🧩 Module & Function Explorer – browse Move modules, structs, and exposed functions

🤖 AI-powered explanations – Gemini analyzes contract logic in plain English

⭐ Favorites & Analytics – save contracts to Snowflake and view usage insights

🪟 Multi-tab viewer – Overview / Functions / Structs / Source / Gemini AI

🛠️ How we built it

Frontend: Next.js 15 + TypeScript + Tailwind CSS

Blockchain integration: Mysten Dapp Kit (Sui RPC) to fetch normalized Move modules

AI engine: Gemini 1.5 Pro API for natural-language analysis of smart-contract code

Data layer: Snowflake SDK to persist favorite contracts and analytics

State management: React Query for live caching and background refetching

APIs: Serverless Next.js App Router endpoints (/api/favorites/*) for secure data access

🧊 Use of Snowflake API

We used the Snowflake Python SDK and Snowflake REST API to store metadata for Sui contracts, including package IDs, function counts, struct counts, and normalized module JSON. Each contract indexed by Sui-Lens is logged as a row in our Snowflake table (OPENSUI_CONTRACTS) for quick querying and analytics. Snowflake enables:

Persistent storage of contract metadata and user “favorites”

Aggregation queries to track most-viewed contracts

Real-time analytics dashboards for developers

This integration transforms Sui-Lens into a data-driven explorer — not just visual but analytical.

🤖 Use of Gemini

We integrated Gemini 1.5 Pro for understanding and generating Move smart contracts. Gemini analyzes normalized module JSON to produce plain-English explanations of functions, structs, and capabilities. Key uses:

🧠 Smart Contract Summaries: Converts complex on-chain logic into readable explanations

✍️ Natural Language → Move Code: Users can describe a contract idea (e.g., “a token that burns 1% per transfer”) and Gemini generates boilerplate Move code for it

🪄 AI Tab: In the frontend, the Gemini tab displays inline reasoning and summaries

This made the explorer both educational and generative — perfect for new Web3 learners.

☁️ Use of DigitalOcean

We deployed the FastAPI microservice and Next.js frontend on DigitalOcean App Platform.

The backend (sui-api) runs on a Python runtime with gunicorn, serving Sui RPC and Snowflake APIs.

This microservice is to empower other developers to develop anything with SUI, they can easily programatically pull transactions using the API.

https://sui-api-p78sy.ondigitalocean.app

Utilizing the API Endpoints to pull transactions

7) Endpoints & behavior Health

GET /api/sui/health

Returns { ok: true, rpc: , cache: }

Use this for uptime checks.

Packages since a checkpoint

GET /api/sui/packages/since/?count=50

If start is negative (e.g. -1) it resolves latest checkpoint.

Scans backward up to count checkpoints (cap 500) and extracts published package IDs.

Returns:

{ "start": 123456, "scanned": 50, "packages": ["0x...", "0x..."], // de-duped "items": [ { "checkpoint": 123450, "digest": "AqQ...==", "timestampMs": "1739923...", "packageId": "0x..." } ], "nextStart": 123406 }

Internals:

Calls sui_getCheckpoint → gets tx digests.

Tries batch fetch suix_getTransactionBlocks; falls back to per-tx sui_getTransactionBlock.

Robust extract_published_package_ids scans effects, objectChanges, and events.

Recent published packages (cursor-based)

GET /api/sui/packages/recent?limit=50&cursor=

Uses suix_queryTransactionBlocks (with multiple fallback shapes) to pull recent blocks (prefers Publish kind).

Optional cache key (recent::).

Returns:

{ "packages": ["0x...", "0x..."], // de-duped "items": [ { "digest": "AqQ...==", "timestampMs": "1739...", "packageId": "0x..." } ], "nextCursor": "v1:...:cursor..." }

Normalized modules for a package

GET /api/sui/packages//modules

Calls sui_getNormalizedMoveModulesByPackage.

Cached under mods:.

Single module

GET /api/sui/packages//module/

Calls sui_getNormalizedMoveModule.

Cached under mod::.

Object by ID

GET /api/sui/objects/

Calls sui_getObject with: showType, showOwner, showContent, showDisplay=False.

Generic passthrough

POST /api/sui/rpc

{ "method": "sui_getObject", "params": ["0xOBJECT", {"showType": true}] }

🔌 API Endpoints (Flask Sui proxy)

  • GET /api/sui/health
  • GET /api/sui/packages/recent?limit=&cursor=
  • GET /api/sui/packages/since/<start>?count=
  • GET /api/sui/packages/<package_id>/modules
  • GET /api/sui/packages/<package_id>/module/<module_name>
  • GET /api/sui/objects/<object_id>
  • POST /api/sui/rpc { "method": "...", "params": [...] }

See /api/sui/routes.py for implementation details and caching.

Handy for experiments or new RPCs without changing server code.

Frontend (sui-lens) runs on a Next.js 15 container.

The platform provides HTTPS routing, build automation on each GitHub push, and seamless scaling.

DigitalOcean’s simple App Spec (app.yaml) made multi-service deployment frictionless and ideal for hackathon development.

🚧 Challenges we ran into

Resolving SDK version conflicts between @mysten/sui and @mysten/sui.js

Configuring Snowflake JWT key-pair authentication in Next.js edge runtime

Avoiding HTML 404 fallbacks when proxying Snowflake queries

Safely destroying Snowflake connections while satisfying TypeScript type constraints

🏆 Accomplishments that we're proud of

Built a real-time contract explorer that automatically indexes Sui testnet deployments

Integrated Gemini AI explanations directly into a tabbed interface

Connected Snowflake analytics for decentralized-data insights

Designed a clean, modular UI inspired by modern IDE layouts

📚 What we learned

Deep understanding of Sui’s Move module normalization API

How to store and query blockchain metadata efficiently in Snowflake

Leveraging Google Gemini for structured code summarization

Building composable serverless APIs in the Next.js App Router

🚀 What’s next for Sui-Lens

Expand indexing to Mainnet and community-deployed contracts

Add live usage analytics and contract risk scoring

Build a Gemini-powered contract auditor for vulnerability detection

Open-source Sui-Lens as a public developer tool with APIs for builders

Built With

  • gemini
  • next-js
  • slush
  • snowflake
  • sui
  • sui-wallet
Share this project:

Updates