ABX
How ABX works

Metadata

How ABX stores, resolves, and locks collection and token metadata.

ABX metadata is a field store on the collection contract. Each field has a name, a representation, and a value. A field may hold bytes, point to bytes, or compute them from chain state.

Fields and scope

Fields live at two scopes:

  • Collection fields apply to the whole project and feed contractURI.
  • Token fields apply to one token and feed tokenURI.

A token field overrides a collection field with the same name.

A collection image is therefore the fallback image for every token and can mask a computed render. Empty field writes are not allowed. Use featured_image for collection artwork that should not replace token images.

Common token fields are name, description, image, animation_url, external_url, attributes, background_color, and youtube_url. Common collection fields include name, description, banner_image, featured_image, external_link, creator, creator_links, display_notes, and license.

Other field names appear in the token's artifact manifest. The generated keys artifacts and abx_provenance cannot be set as fields.

All deploy families accept --banner-image <uri> and --featured-image <uri> alongside --description and --external-url. These write collection URL fields in the deployment transaction; dry runs name the artwork fields. The flags do not set collection image or override token art. The collection image continues to resolve from its existing image fields or representative token.

Before handing over admin, inspect the actual collection document:

abx contracturi <address> --validate marketplace --json

The optional profile checks name, description, image, external_link, banner_image, and featured_image. It reports missing and malformed fields separately and exits unsuccessfully when the profile is incomplete. These are launch-readiness checks; some fields are optional in the underlying standard. Without --validate, the existing document output is unchanged. set-admin performs one bounded document check and warns before transferring ownership. HTTP reads have a 10-second timeout and 1 MiB body limit; no token enumeration or reindex is needed for this check. A passing document does not guarantee immediate marketplace ingestion.

Resolver routes

Print a browser URL without constructing routes yourself:

abx view-url <contract> --token 0 --remote abx --json
abx view-url <contract> --token 0 --base-url https://resolver.example/prefix

The result has a dedicated viewerUrl: a live application URL for code collections, or image content for image collections. A selected provider's public descriptor supplies the token API base and isolated content template; custom bases preserve their path prefix. Without either flag, the CLI uses ABX_PUBLIC_BASE_URL or the local resolver. Successful mint output includes the same URLs, sharing one public discovery lookup across all minted IDs. A URL does not prove that indexing or rendering has finished, and it does not register a project or open a browser.

Conforming resolvers expose token metadata at /t/{chainId}/{contract}/{tokenId}. Inline or computed field bytes use the stable /t/{chainId}/{contract}/{tokenId}/data/{field} route. Code projects also have /a/{chainId}/{contract}/{tokenId} as their canonical live application view; an animation_url may point to either route when they serve the same document.

HTTP resolvers may keep these stable routes while serving project bytes from token-scoped content origins. Live-view routes may return a restricted wrapper for marketplace embedding; byte artifact routes redirect to the original bytes. A canonical Link response header can identify the direct content URL. Content hosting does not change the on-chain metadata or URI configuration. Contracts still append chain/address/token coordinates to their configured resolver bases. Content hostnames and browser paths are provider delivery choices, discovered through the descriptor or canonical link; artwork must use token data for identity rather than parse location.pathname. Fully on-chain data documents and externally hosted content retain their own delivery behavior. See content origins for the reference implementation.

Parameters are separate. Read them from the contract rather than tokenURI. See Parameters.

Representations

RepresentationMeaning
inlineBytes stored in the field
inline-gzipGzipped bytes, decoded offchain
readerBytes read from an onchain storage contract
reader-gzipGzipped bytes read from an onchain storage contract
rendererBytes computed by a contract
ipfsAn IPFS CID
arweaveAn Arweave transaction ID
urlA URL
url-templateA URL with an {id} placeholder
keccak256 / sha256An onchain commitment to bytes stored elsewhere

The representation describes the route. The contract does not fetch a URL, CID, or transaction ID.

For URI fields such as image and animation_url, inline or computed content is embedded in an onchain metadata document. A resolver serves the same content through a URL. A renderer that returns text/uri-list is treated as a locator instead.

Stored image type

Bytes stored in the image field itself (inline, reader, or their gzip forms) carry no media type. Both serving planes label them with the reserved field abx_image_type, and fall back to image/svg+xml when it is unset:

abx set-field 0xYourContract --field abx_image_type --text image/jpeg

The value must be inline and a lowercase image/<subtype> with no parameters. Any other value is ignored and the image is served as SVG. A token value overrides a collection value, so a series of JPEGs can declare the type once with --collection. abx deploy --onchain-image and abx set-field --field image --file write the declaration for you. They refuse formats that browsers don't draw, such as TIFF and PSD.

The declaration applies only to stored bytes. A URL, CID, or hash commitment gets its type from the content it points to, and a renderer field returns its own type. Like the gateway fields, abx_image_type never appears in the metadata document or the artifact list. Lock it with abx lock-field --field abx_image_type when you lock image, or the owner can still change the label.

Renderers before spec v12 ignore abx_image_type and label every stored image as SVG. Existing collections with raster images can move to the current renderer with abx set-renderer, unless the URI configuration is locked.

URI resolution

Each contract chooses one of two paths:

  1. An onchain metadata renderer returns a data:application/json document.
  2. A base URL or per-token URL points to a resolver.

The lookup order is:

  1. Onchain renderer
  2. Per-token URL override
  3. Base URL plus chain, contract, and token ID
  4. Empty string

An onchain renderer can resolve inline, reader, renderer, url, url-template, ipfs, and arweave. Hash commitments and gzipped values need an offchain resolver.

For an in-range token that has not been minted, an offchain resolver returns { "minted": false } instead of full metadata. Its image, data, and live-view routes return 404 until the mint exists. Token IDs outside the project's range also return 404.

Gateways

Store an IPFS CID or Arweave transaction ID as the field value. Keep the HTTP gateway separate so it can change without changing the content address. abx set-field --url accepts ipfs:// and ar:// locators and stores their content ID and optional path in the corresponding typed representation. Use an HTTP(S) locator when you intend to store that exact serving URL.

abx set-gateway 0xYourContract \
  --ipfs https://your-gateway.example/ipfs/

The collection fields abx_gateway_ipfs and abx_gateway_arweave hold these serving preferences. They do not appear in the public metadata document or artifact list. Public defaults apply when they are unset.

Locks

lock-field freezes one field. lock-uri freezes the URI configuration. Code projects have separate locks for scripts and dependencies. Parameters have their own schema deadlines.

abx lock-field 0xYourContract --field image
abx lock-uri 0xYourContract

A lock freezes the value or address stored by the ABX contract. It cannot freeze:

  • bytes behind a mutable URL
  • code behind an upgradeable renderer, reader, or hook
  • a live dependency registry
  • an unlocked parameter

Check the whole dependency graph before calling a project immutable. See Owner powers.

Provenance

Served metadata includes abx_provenance. Each entry names the field, its source, and a short note. The resolver also reports a status such as on-chain, verified, mismatch, off-chain, or n/a.

The status is a resolver result. A contract cannot fetch and hash remote bytes.

Example

{
  "name": "Drift #42",
  "image": "https://metadata.example/84532/0xabc/42/image",
  "attributes": [{"trait_type": "Palette", "value": "Ochre"}],
  "abx_provenance": [
    {"field": "image", "source": "reader", "status": "on-chain"}
  ]
}

The resolver URL above may serve bytes that live onchain. Provenance describes where the bytes live; the URL describes how an HTTP client reaches them.

On this page