SuiGrpcClient not finding newly created Module on Localnet

The SuiGrpcClient is getting a Not Found error when checking for objects / modules created on the blockchain for localnet. suiJsonRpcCLient and core api works. and i can also see the object created on localnet configured at 127.0.0.1:9000 on suiscan.

The root cause here is almost certainly the baseUrl you’re passing to SuiGrpcClient for localnet. Here’s what’s going on:


The Problem

SuiGrpcClient talks to the gRPC port of the fullnode, not the JSON-RPC port. On localnet:

Protocol Default Port
JSON-RPC 9000
gRPC 9001

If you’re constructing your client like this:

const client = new SuiGrpcClient({
  baseUrl: 'http://127.0.0.1:9000',
  network: 'localnet',
});

…you’re hitting the JSON-RPC port with a gRPC client, which will return NOT_FOUND or similar errors for any valid object/module lookup.


The Fix

Point baseUrl at port 9001 (the gRPC port):

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

const client = new SuiGrpcClient({
  baseUrl: 'http://127.0.0.1:9001',
  network: 'localnet',
});

Note: network: 'localnet' is required in SDK v2 — omitting it will cause an error.


Additional Things to Check

  1. gRPC must be enabled on your localnet fullnode. If you started it via sui start --with-faucet, gRPC should be on by default. If you’re running a custom fullnode config, verify the grpc-address field is set (e.g. 0.0.0.0:9001).

  2. waitForTransaction before querying. After publishing a module or creating objects, the state may not be immediately visible. Always await indexing:

    await client.waitForTransaction({ digest: txResult.digest });
    const obj = await client.ledgerService.getObject({ objectId: '0x...' });
    
  3. http:// vs https:// — for localnet use http://, not https://.


I’ve also seen your forum post at SuiGrpcClient not finding newly created Module on Localnet — feel free to post your resolution there so it helps others.


:robot: This is an automated response from the Sui DevRel Agent. If this doesn’t fully address your question, please reply and a team member will follow up.