---
id: BI0155
title: "NFT storage permanence audit"
url: https://carbium.sh/library/blockchainideas/nft-storage-permanence-audit
collection: Blockchain ideas
category: Creator and membership
revision: 1
updated: 2026-11-23
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# NFT storage permanence audit

Explorers read the URI stored in an NFT's metadata account and load it from there. This audit reads that account through services.carbium.sh and says, for each URI, whether a browser can load it.

## Who uses it

Two groups hit this. The first is a creator team that uploaded metadata and images to a Google Cloud Storage bucket, set the URI on the mint, and then saw no picture in any explorer. Before a reveal, they need to know which of their links a browser can load.

The second is a marketplace or support desk. A buyer says the NFT shows no image in their wallet. The agent runs this audit on the mint and sees whether the URI is a storage path, a private object or a host that no longer answers.

## Why storage links fail

An explorer never opens your bucket directly. It reads the URI from the mint's metadata account, loads that address in a browser, reads the JSON it gets back and then loads the image address inside that JSON. Each step needs a web address that a browser can open with no login.

| Link form | What a browser does | Where it breaks |
|---|---|---|
| `gs://bucket/meta.json` | Cannot open it: gs:// is a storage path with no web address | Every reader, so the explorer shows no metadata |
| `https://storage.googleapis.com/bucket/meta.json` on a private bucket | Gets a 403 response | Every reader, until the object gets public read |
| Same link, object public, no CORS header | Opens in a tab, but a script on the explorer's page is refused | Explorer pages that fetch the JSON in script |
| Signed link with an expiry | Opens until the expiry time | Every reader after that time |

The image address inside the JSON follows the same rules, so a correct URI with a broken image link still shows an empty picture.

## What the audit reads

The audit reads the metadata account on chain and never opens the bucket. It derives that account's address from the word metadata, the Token Metadata program and the mint. After a one-byte key and two 32-byte keys, the account holds name, symbol and URI as strings, each prefixed with its length as a 4-byte number, so the code starts at byte 65 and reads them in order.

- Derive the metadata account address from the mint.
- Read that account with getAccountInfo at confirmed commitment, the level the code sets.
- Decode name, symbol and URI, and drop the zero bytes that pad each string.
- Give the URI a verdict: empty, storage path, content address, a non-web scheme, or a web host named in the output.

The code does not fetch the URI. A request sent from the audit host would test that host's route, and a reader's browser would take a different one. Each verdict is one output block, so a list of mints prints as a list you can sort or search.

## The build

One file for Node 24 and @solana/kit 8.6.0, with no other packages. It reads the key from `CARBIUM_KEY`, sends every call to `services.carbium.sh` through the RPC header, and signs nothing. Pass one or more mints as arguments.

`main.ts` (run: `CARBIUM_KEY=<YOUR_KEY> node main.ts <mint> [mint ...]`)

```ts
// BI0155 · NFT storage permanence audit
// https://carbium.sh/library/blockchainideas/nft-storage-permanence-audit
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, getAddressEncoder, getProgramDerivedAddress, getUtf8Encoder } from "@solana/kit";

const key = process.env.CARBIUM_KEY;
if (!key) {
  console.error("Set CARBIUM_KEY to your Carbium API key.");
  process.exit(1);
}
const mints = process.argv.slice(2);
if (mints.length === 0) {
  console.error("Usage: node main.ts <mint> [mint ...]");
  process.exit(1);
}
const rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({
    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",
    headers: { "x-api-key": key },
  }),
);
const METADATA_PROGRAM = address("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
const addr = getAddressEncoder();
const utf8 = getUtf8Encoder();

// Token Metadata strings: a 4-byte little-endian length, then bytes padded with zeros.
function readString(bytes: Uint8Array, at: number): [string, number] {
  const len = new DataView(bytes.buffer, bytes.byteOffset).getUint32(at, true);
  const text = new TextDecoder().decode(bytes.subarray(at + 4, at + 4 + len)).replace(/\x00/g, "").trim();
  return [text, at + 4 + len];
}

function verdict(uri: string): string {
  if (uri === "") return "empty: explorers have nothing to load";
  if (uri.startsWith("gs://")) return "storage path: browsers cannot load gs://";
  if (uri.startsWith("ar://") || uri.startsWith("ipfs://")) return "content address: loads through a gateway";
  let url: URL;
  try {
    url = new URL(uri);
  } catch {
    return "not a URL";
  }
  if (url.protocol !== "https:") return `${url.protocol} is not loaded by browsers`;
  if (url.hostname === "storage.googleapis.com") return "Google Cloud Storage over https: loads only if the object is public and CORS allows the explorer";
  return `https on ${url.hostname}: loads while that host serves it`;
}

for (const mint of mints) {
  try {
    const [pda] = await getProgramDerivedAddress({
      programAddress: METADATA_PROGRAM,
      seeds: [utf8.encode("metadata"), addr.encode(METADATA_PROGRAM), addr.encode(address(mint))],
    });
    const { value } = await rpc.getAccountInfo(pda, { encoding: "base64", commitment: "confirmed" }).send();
    if (!value) {
      console.log(`${mint}: no metadata account at ${pda}`);
    } else {
      const bytes = Uint8Array.from(atob(value.data[0]), (c) => c.charCodeAt(0));
      const [name, a] = readString(bytes, 65);
      const [symbol, b] = readString(bytes, a);
      const [uri] = readString(bytes, b);
      console.log(`${mint}\n  name ${name} (${symbol})\n  uri ${uri || "(empty)"}\n  ${verdict(uri)}`);
    }
  } catch (e) {
    console.error(`${mint}: ${e instanceof Error ? e.message : String(e)}`);
  }
  await new Promise((resolve) => setTimeout(resolve, 2100));
}
```

Free allows 0.5 account reads a second and Dev allows 15, with each read costing 10 cells. The loop waits 2.1 seconds between mints so a Free key stays under its rate, and a Dev key can run with a shorter gap. [Limits are per account](https://carbium.sh/docs/limits), so other tools on the same key draw on the same budget.

## What to change at upload

The fix sits at upload, so check each link as you write it. A creator can run this audit before the reveal, and a broken link shows up while the mint is still a draft.

- Host the JSON on an https address you control, with public read on that object.
- Send CORS headers that allow an explorer's page to read the JSON from script.
- Put the image address inside the JSON in the same form, and open both in a plain browser tab.
- Keep gs:// paths in your own pipeline, and write the https address to the mint.
- Run the audit after the mint is set, and again after every URI update.

## Where it ends

- The audit reads the Token Metadata account only. A Token-2022 mint that keeps its metadata inside the mint has no such account, and the audit prints that. The mint needs the metadataPointer extension naming it before a reader can find that data.
- A pass shows that the URI loads when you run the audit. It cannot say what happens next month: a bucket can be deleted, a signed link expires and an object can be replaced.
- The update authority can change the URI on a mutable account. Check that with the [metadata update authority check](https://carbium.sh/library/howsolana/metadata-update-authority-check) and keep both results together.
- The image is out of scope. Its address sits in the JSON, which this read never opens.
- The audit takes one mint per argument. It does not list a collection's members, so pass the mints you already have.

> Re-run the audit whenever the bucket, its policy or the mint's update authority changes, because each result describes one moment.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| Every mint prints no metadata account. | Check that the address is the mint and not a token account. A Token-2022 mint with metadata inside it has no Token Metadata account, so the audit cannot read it. |
| The run stops with an invalid address message. | Pass base58 mint addresses only. The message names the argument that failed, and the other mints still print. |
| The verdict says the URI is fine, but explorers show no image. | The image address sits in the JSON. Open the JSON, read its image field, and load that address in a browser tab. |
| A later mint fails with a 429. | Free allows 0.5 account reads a second. Lengthen the gap in the loop, or move the key to a plan whose rate covers the list. |
| The run exits at once and says to set CARBIUM_KEY. | Export the key in the shell that runs the file. The code reads it from the environment and never prints it. |

## Questions

### Why does my gs:// link show nothing in an explorer?

An explorer loads the URI in a browser, and gs:// names a storage path that browsers cannot open. Write the https address of the object instead, and make that object publicly readable.

### Can I change the URI on an NFT that is already minted?

Only if the mint's update authority is still yours and the metadata is mutable. The change writes a new URI to the account, so run the audit again after it. This audit reads the result and changes nothing.

### Does a passing audit mean the image will stay up?

No. It means the URI loads at the moment you run the check. Buckets get deleted, signed links expire and objects can be replaced.

### Can the audit check the image itself?

Not from chain data. The image address is inside the JSON, and this read never opens that file. Open the JSON in a browser tab and check the image address there.

## Related

- [Metadata mutability check](https://carbium.sh/library/blockchainideas/metadata-mutability-check) (Blockchain ideas, BI0134)
- [Metadata update authority check](https://carbium.sh/library/howsolana/metadata-update-authority-check) (How to use Solana, HS0090)
- [carbium.sh/docs/rpc](https://carbium.sh/docs/rpc)
- [carbium.sh/docs/auth](https://carbium.sh/docs/auth)
- [carbium.sh/docs/limits](https://carbium.sh/docs/limits)
- [carbium.sh/docs/endpoints](https://carbium.sh/docs/endpoints)
