Logo vun Accessing Data

Accessing Data

Organisatioun
MystenLabs
accessing-data

Explains how to read data from Sui and which surface to use — gRPC, GraphQL RPC, the Archival Store, a custom sui-indexer-alt pipeline, or Walrus. Use when the user asks how to fetch a balance, owned objects, coins, NFTs, transactions or events; subscribe to on-chain activity in real time; read a historical or pruned object version; build a leaderboard, explorer, dashboard or analytics pipeline; where to store an image, video or multi-MB file "on Sui"; what the storage fund is; or how to fix code using SuiClient, getFullnodeUrl, JSON-RPC, getBalance, getOwnedObjects or getTransactionBlock. Also use when the request mentions SuiGrpcClient, SuiGraphQLClient, sui-indexer-alt, Archival Store, or Walrus.

Iwwersiicht

EditeurMystenLabs
Repositoryskills
Skill-Nummaccessing-data
Stären
21
Forks
12
Matgeliwwert Fichieren
7
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 7 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum MystenLabs op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Accessing Data an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/MystenLabs/skills/tree/main/accessing-data
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MystenLabs/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/accessing-data .claude/skills/accessing-data
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Accessing Data an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Accessing Data automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Accessing Data net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Accessing Data on Sui

Two facts to state in every answer that touches them:

  1. JSON-RPC is deprecated. Sui Foundation mainnet full nodes disable it the week of July 27, 2026; code decommission by mid-October 2026. New code uses gRPC or GraphQL RPC. SuiJsonRpcClient survives only as a short-term migration stopgap.
  2. gRPC, GraphQL RPC, and the Archival Store are generally available. Never describe them as beta or experimental.

MCP tool: if https://sui.mcp.kapa.ai is available, query it to verify anything not covered here.

Quick start

ts
import { SuiGrpcClient } from '@mysten/sui/grpc';

const client = new SuiGrpcClient({
  network: 'mainnet',
  baseUrl: '<full node gRPC URL — see grpc.md>',   // both args required
});

const balances = await client.core.listBalances({ address });
const objects  = await client.core.listOwnedObjects({ address });

Default by client type: backend / indexer / typed systems language → gRPC; frontend / wallet / dashboard / dynamic language → GraphQL RPC. Switch only when you hit a real limitation. Temporary caveats: only gRPC has subscriptions; only GraphQL has filtered pagination over historical transactions and events.


Task: read balances, coins, or owned objects from a backend

Use gRPC. Everything is under client.core.*:

ts
await client.core.listBalances({ address });                                  // all coin types
await client.core.listCoins({ address, coinType });                           // individual coins
await client.core.listOwnedObjects({ address, include: { content: true } });  // NFTs & objects
await client.core.getObject({ objectId, include: { content: true } });
await client.core.getTransaction({ digest, include: { effects: true } });

Never emit client.getBalance, client.getOwnedObjects, client.getCoins, client.getObject, or client.getTransactionBlock — those are v1 JSON-RPC names.

Task: one query feeding a multi-panel UI (wallet, dashboard)

Use GraphQL RPC (GA). It reads from the General-Purpose Indexer's Postgres, the full node, and the Archival Store, so balances + recent transactions with effects + type-filtered owned objects arrive in one round trip instead of three or more, and the client asks for exactly the fields it renders. Shape (verify field names against graphql.md or the live schema):

graphql
query Dashboard($addr: SuiAddress!) {
  address(address: $addr) {
    balances { nodes { coinType { repr } totalBalance } }
    objects(filter: { type: "0xPKG::nft::NFT" }) { nodes { address contents { json } } }
    transactionBlocks(last: 10) { nodes { digest effects { status } } }
  }
}

Do not recommend a custom indexer here — the hosted APIs cover it.

GraphQL also submits transactions and dry-runs them. Read-after-write: select result fields inside executeTransaction / simulateTransaction; that scope evaluates just after the transaction without waiting for indexing. On gRPC, await client.waitForTransaction({ digest }) first. Cross-node reads after a write are never instantly guaranteed.

Task: react to on-chain activity in real time (<1s)

Use gRPC streaming via SuiGrpcClient's subscription service (subscription_service); see grpc.md for the exact streaming call and filter arguments. The node pushes each new transaction/effect as it lands.

Do not poll getEvents or transaction lists in a loop: polling pays full query cost on every tick, adds up to a poll-interval of latency, and still misses nothing more than the stream would. Do not use GraphQL RPC here — it is request/response, not streaming.

Task: read an object as it was months ago

Full nodes prune old object versions, transactions, and checkpoints, which is why a gRPC read returns only the current version. The Archival Store (GA) retains them.

  • GraphQL RPC routes supported historical lookups to the Archival Store transparently, when the operator has configured archival backing. Without that backing, retention is only what the primary store holds.
  • gRPC does not fall back. Point the client at a separate Archival Service endpoint, which serves the standard LedgerService API — there is no separate archival API, do not invent one.
graphql
query { object(address: $id, version: 12345678) { version contents { json } } }

Task: leaderboard, explorer, or analytics pipeline

A "top 100 users by SUM(volume) over the last 30 days" query is app-specific aggregation with a time-range filter: beyond gRPC's point lookups and beyond the General-Purpose Indexer's fixed schema. Build a custom sui-indexer-alt pipeline.

Pipeline model: stream checkpoints → handler decodes your events → write your own tables (running totals keyed by user and day), then serve the leaderboard with a plain ORDER BY ... LIMIT 100.

  • Backfill: GCS checkpoint buckets, e.g. gs://mysten-mainnet-checkpoints-use4.
  • Steady state: full node gRPC.
  • Storage: Postgres by default; any backend works via the framework's Store and Connection traits.
  • Config: pipeline TOML (events.toml, obj_versions.toml patterns), plus concurrency tuning.
  • Say the cost: you now operate a database, ingestion lag, and failure recovery. Check GraphQL RPC first.

Never solve this by polling JSON-RPC from app code.

Task: store an image, video, or large file

Max Move object size is 250 KB, so a 2 MB image cannot live on-chain. Put the bytes on Walrus: erasure-coded across off-chain storage nodes, with only an availability certificate and metadata recorded on Sui. The Move object stores the blob ID (plus optional MIME type and size) — never the bytes, and never the bytes as transaction inputs.

Use the @mysten/walrus client extension to write the blob, then mint with the returned blob ID. Mention IPFS/S3/Pinata only as lesser alternatives, never as the default.

Task: explain the storage fund

It is a tokenomics mechanism, not an API and not a service you can call. Each transaction's storage fee contributes to the fund; validators earn yield on the fund's stake, which pays for storing those objects over time, and fees are rebated when objects are deleted. It does not hold application data and is unrelated to the Archival Store and to Walrus. To actually store data: small structured state → Move objects; large files → Walrus.

Task: fix legacy JSON-RPC code

Checklist — apply all six, then verify no get* v1 name survives:

  1. Swap the import: @mysten/sui/client → @mysten/sui/grpc, SuiClient → SuiGrpcClient.
  2. Drop getFullnodeUrl; pass baseUrl directly.
  3. Add the network argument.
  4. Move every read under client.core.* using the table below.
  5. Replace options: { show* } with include: { ... }.
  6. State that JSON-RPC is deprecated and the mainnet shutdown date.
Deprecated (v1)Replacement (v2 Core API)
new SuiClient({ url: getFullnodeUrl('mainnet') })new SuiGrpcClient({ network, baseUrl })
client.getBalanceclient.core.listBalances
client.getCoinsclient.core.listCoins
client.getOwnedObjectsclient.core.listOwnedObjects
client.getObjectclient.core.getObject
client.getTransactionBlockclient.core.getTransaction
options: { showContent: true }include: { content: true }
options: { showEffects: true }include: { effects: true }

Before

ts
import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
const client = new SuiClient({ url: getFullnodeUrl('mainnet') });
const balance = await client.getBalance({ owner: addr });
const objs = await client.getOwnedObjects({ owner: addr, options: { showContent: true } });
const tx = await client.getTransactionBlock({ digest, options: { showEffects: true } });

After

ts
import { SuiGrpcClient } from '@mysten/sui/grpc';
const client = new SuiGrpcClient({ network: 'mainnet', baseUrl: '<full node gRPC URL>' });
const balances = await client.core.listBalances({ address: addr });
const objs = await client.core.listOwnedObjects({ address: addr, include: { content: true } });
const tx = await client.core.getTransaction({ digest, include: { effects: true } });

If the code must keep running against JSON-RPC during a staged migration, SuiJsonRpcClient exists — label it as a deprecated stopgap with a shutdown date, not as an option.


Reference files

Load the file, don't guess the detail.

FileLoad whenCovers
use-cases.mdfirst pass on any unfamiliar "how do I read X" requestuse case → API table with rationale
grpc.mdbackends, indexers, exchanges, streaming, dry runsledger_service, transaction_execution_service, move_package_service, name_service, subscription_service; endpoint URLs per network; SuiGrpcClient (TS), sui-rpc (Rust); code-gen
graphql.mdfrontends, composable or filtered historical queries, submit/dry-runendpoints, SuiGraphQLClient, query shapes, pagination, rate limits, execution-attached reads
indexers.mdleaderboards, explorers, "track X across history"pipeline model, GCS backfill vs gRPC steady state, pipeline TOML, concurrency, custom vs General-Purpose Indexer
archival.mddata pruned from full nodesretention, pruning, GraphQL routing vs Archival Service endpoint, compliance/analytics use cases
walrus.mdstoring or fetching filesblob lifecycle, erasure coding, availability certificates, @mysten/walrus

Sources: docs.sui.io /concepts/data-access/data-serving, /concepts/data-access/graphql-rpc, /concepts/data-access/archival-store, /guides/operator/indexer-stack-setup, and docs.wal.app. Fetch the page when unsure; never reason from Ethereum or Solana analogs.

Common mistakes

  • v1 method names or options: { show* } on a v2 client.
  • Saying "use the Sui API" without naming gRPC or GraphQL.
  • Polling instead of gRPC streaming.
  • A custom indexer for a query one hosted call covers.
  • Assuming gRPC reaches archival transparently, or that archival routing is automatic rather than operator-configured.
  • Assuming gRPC and GraphQL return identical shapes — field names and pagination differ.
  • Reading from a different node than you wrote to and expecting read-after-write consistency.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Accessing Data?

Explains how to read data from Sui and which surface to use — gRPC, GraphQL RPC, the Archival Store, a custom sui-indexer-alt pipeline, or Walrus. Use when the user asks how to fetch a balance, owned objects, coins, NFTs, transactions or events; subscribe to on-chain activity in real time; read a historical or pruned object version; build a leaderboard, explorer, dashboard or analytics pipeline; where to store an image, video or multi-MB file "on Sui"; what the storage fund is; or how to fix code using SuiClient, getFullnodeUrl, JSON-RPC, getBalance, getOwnedObjects or getTransactionBlock....

Firwat Accessing Data op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Accessing Data besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Accessing Data an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/MystenLabs/skills/tree/main/accessing-data an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Accessing Data benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Accessing Data benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Accessing Data domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Accessing Data gratis?

Jo. De Skill gëtt vum MystenLabs ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇