Back

Blog details

What Is IPLD? The Data Model Behind IPFS's Merkle DAG

AIOZ Network
6 min readSeptember 02, 2026
aioz-pin
AIOZ Pin cover image with the headline What Is IPLD? The Data Model Behind IPFS

IPLD (InterPlanetary Linked Data) is the data model underneath IPFS: it defines what hash-linked data can contain and how it turns into bytes. A file is one shape of IPLD data; a JSON record whose fields link to other CIDs is another, and both get the same verification.

TL;DR:

  • IPLD splits linked data into three layers: the Data Model (what the data is), a codec (how it becomes bytes), and blocks addressed by CID (how those bytes are found and verified)
  • The Data Model has nine kinds: null, boolean, integer, float, string, bytes, list, map, and link, where a link is a CID
  • UnixFS files use the DAG-PB codec, which supports only a small part of the Data Model; DAG-CBOR and DAG-JSON support nearly all of it
  • Every CID records its codec, so whoever fetches a block knows how to decode it before reading a single field
  • Pinning a CID keeps its blocks no matter which codec produced them; decoding is the reader's job

Updated Nov 25, 2026: cut unverifiable claims, added a DAG-CBOR vs DAG-JSON size check on one record, tightened the ending.

Why IPFS Needs a Data Model

IPFS stores everything as blocks that point at other blocks by hash, a structure called a Merkle DAG. That structure says nothing about what a block means, so something has to define it. IPLD is that definition: a shared model for content-addressed data, plus a set of codecs that write it to bytes.

UnixFS, the format IPFS uses for files and directories, is one schema built on IPLD. You can also put your own structured records into the same graph, and every node that speaks IPFS can store, move, and verify them. This post follows one such record, {name: "cat.png", size: 48213, image: <CID>}, from its fields to its bytes to its CID.

The Three Layers: Data Model, Codec, and Blocks

IPLD separates the problem into three layers, and keeping them apart is what lets one CID system carry many data formats.

Diagram of IPLD in three layers: the Data Model with its kinds (map, list, string, bytes, integer, float, boolean, null, link), codecs with their multicodec codes (dag-pb 0x70 for UnixFS, dag-cbor 0x71, dag-json 0x0129, raw 0x55), and blocks addressed by a CID made of codec plus hash

The Data Model covers the kinds of value you can store. There are nine: null, boolean, integer, float, string, bytes, list, map, and link. Lists and maps hold other values, and a link is a CID that points at another block. The cat.png record uses three: strings for name, an integer for size (48,213 bytes, about 47 KiB) and a link for image. Avoid floats in content-addressed data, because the same number can serialize to different bytes in different languages, and different bytes mean a different hash.

A codec turns Data Model values into bytes and back. The codec you pick decides how compact the block is, how fast it parses, and which kinds it can hold. The last layer is the block itself: the codec's bytes are hashed into a CID, moved between peers by the DHT and Bitswap, and kept on disk by pinning.

DAG-PB vs DAG-CBOR vs DAG-JSON

Three codecs cover most IPLD data you will meet:

CodecMulticodec codeData Model coverageTypical use
DAG-PB0x70Small, fixed subset: bytes plus named linksUnixFS files and directories
DAG-CBOR0x71CompleteBinary structured data; the docs call it suitable for any job
DAG-JSON0x0129Almost completeHuman-readable data, development, and debugging
raw0x55Bytes only, no linksLeaf blocks of file data

DAG-PB's limits fit its job, because a file node only needs data and a list of named children. For your own records, design the protocol in DAG-CBOR for speed and size, then use DAG-JSON while you develop and debug. DAG-JSON pays for its readability with slower parsing, and it inflates byte fields by about a third because it must base64-encode them.

What Does DAG-JSON Look Like?

DAG-JSON is ordinary JSON with one reserved shape: a map with a single "/" key holds a CID, and that map is a link. We encoded a small record with the @ipld/dag-json and multiformats JavaScript libraries, where the image field links to the raw block for a one-line text file:

import { CID } from 'multiformats/cid'
import { sha256 } from 'multiformats/hashes/sha2'
import * as dagJson from '@ipld/dag-json'

const image = CID.parse('bafkreifjjcie6lypi6ny7amxnfftagclbuxndqonfipmb64f2km2devei4')
const bytes = dagJson.encode({ name: 'cat.png', size: 48213, image })
const cid = CID.create(1, dagJson.code, await sha256.digest(bytes))

Running it on Oct 19, 2026 with @ipld/dag-json 11.0.1 printed these bytes and this CID:

{"image":{"/":"bafkreifjjcie6lypi6ny7amxnfftagclbuxndqonfipmb64f2km2devei4"},"name":"cat.png","size":48213}
baguqeerazpobtwq63ebkdz47aswze3fi5m2zmhrfasqqz33h2ur4xfjte27q

Notice that the encoder sorted the keys. Canonical ordering means the same data always produces the same bytes, so you get the same CID every time. The bagu prefix is the base32 form of a CIDv1 with the DAG-JSON codec, which tells any reader to decode the block as DAG-JSON. The same record takes 69 bytes in DAG-CBOR against 107 in DAG-JSON, because DAG-CBOR stores the link as 36 raw bytes and needs no quotes or braces. Its CID is bafyreigscmpjfgow6e4fxndkqrzie37rjabohmdpc3xbrwl7a7x6szl7xu. We built those bytes with the Python standard library following the DAG-CBOR spec (shortest keys first, link as tag 42); the same method reproduces the DAG-JSON CID above.

Compare that with a typical NFT metadata file, where "image": "ipfs://bafy..." is a plain string. An IPLD tool sees a string there, not a link, so it cannot follow it or fetch the image as part of the same graph. Only the {"/": ...} form creates a real edge in the DAG. An ERC-8004 agent registration file is another structured JSON file addressed by CID, and storing ERC-8004 registration files on AIOZ Pin shows how one is pinned.

How Does a CID Know Which Codec to Use?

A CIDv1 carries a multicodec code next to the hash, such as 0x70 for DAG-PB, 0x55 for raw, 0x71 for DAG-CBOR, or 0x0129 for DAG-JSON. IPLD is why that field has to exist. The same DAG can mix blocks from several codecs, so the address itself must say how to read each block before you can parse a byte of it. The anatomy of a CID walks through where that code sits in the identifier.

The codec is also part of what gets hashed into identity. The cat.png record as DAG-JSON (bagu...) and as DAG-CBOR (bafyrei...) has the same fields but two CIDs, because the codec and the bytes differ. That is one of the reasons the same file can get different CIDs.

Is UnixFS Part of IPLD?

Yes, as one schema on top of it. UnixFS represents files and directories with DAG-PB nodes for structure, and with CIDv1 the file data usually sits in raw leaf blocks. IPLD itself is broader. You can query part of any IPLD graph with IPLD selectors, or package a whole graph into one file as a CAR archive, whatever codecs its blocks use.

How AIOZ Pin Handles It

We document AIOZ Pin in terms of files, folders, and CIDs. You upload files or directories with POST https://api.aiozpin.network/api/pinning, and the response includes the cid and an is_dir flag. If you already have a CID, such as a DAG-JSON record your own node provides, the AIOZ Pin pinning API offers a pin-by-hash endpoint for it:

const res = await fetch('https://api.aiozpin.network/api/pinning/pinByHash', {
  method: 'POST',
  headers: {
    pinning_api_key: process.env.AIOZ_PIN_API_KEY,
    pinning_secret_key: process.env.AIOZ_PIN_SECRET_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ hash_to_pin: 'YOUR_CID', metadata: { name: 'my-record' } })
})

IPLD is the model, the codec is the encoding and the CID is the address that ties them together, so when you pin a CID you keep its blocks whatever codec wrote them. The Pinning API reference covers every field.

Frequently Asked Questions

What is IPLD in one sentence? IPLD is the data model and codec layer underneath IPFS that defines what hash-linked data can contain and how it is written to bytes.

What's the difference between DAG-PB and DAG-CBOR? DAG-PB supports only bytes and named links, which is enough for UnixFS files, while DAG-CBOR supports the complete Data Model in a compact binary form.

Is DAG-JSON the same as JSON? Almost: DAG-JSON is JSON with a reserved {"/": ...} shape for links and bytes, plus canonical key ordering so the same data always hashes the same way.

How does a reader know which codec to use for a block? The multicodec code inside the block's CID names the codec, so the reader picks the right decoder before it parses the bytes.

Does IPLD only work for files? No, because the Data Model covers maps, lists, strings, numbers, and links, so any structured record can live in an IPLD graph.

Can a pinning service pin non-file IPLD data? A pin keeps whatever blocks sit under a CID, whatever codec wrote them.

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

ENS IPFS Contenthash: Point an .eth Name at a Website

An ENS IPFS contenthash points your .eth name at a site on IPFS. See the byte format, a real encoding, ipfs vs ipns records, gas used, and common mistakes.

7 min readDecember 04, 2026
blog thumbnail

ERC-721 Metadata JSON: Fields, Images and ipfs:// URIs

ERC-721 metadata JSON explained: the three fields EIP-721 defines, OpenSea attributes and animation_url, ipfs:// image links, and folder CIDs for collections.

8 min readDecember 02, 2026
blog thumbnail

Merkle DAG vs Merkle Tree: What IPFS Changes and Why

Merkle DAG vs Merkle tree explained: a tree gives each node one parent and short proofs, while the DAG IPFS uses shares blocks, carries data and links by CID.

8 min readNovember 30, 2026
blog thumbnail

What Is IPNI? How the IPFS Network Indexer Finds Providers

IPNI is the IPFS network indexer behind cid.contact. See how index providers publish signed advertisement chains and how one HTTP query finds providers.

8 min readNovember 27, 2026
blog thumbnail

On-Chain vs Off-Chain NFT Metadata: Where the Data Lives

On-chain vs off-chain NFT metadata: what the contract stores, what lives on IPFS or a web server, what each costs in gas, and how to check any token yourself.

6 min readNovember 25, 2026
blog thumbnail

What Is a Kademlia DHT? The Routing Algorithm Behind IPFS

A Kademlia DHT finds peers by XOR distance. See how k-buckets, k = 20 and iterative lookups let IPFS locate who holds a CID, and how to watch it on Kubo.

6 min readNovember 23, 2026