Skip to main content

offchain

Documentation | Zora API


offchain is a library for parsing NFT metadata. It's used by Zora's indexer & API. It can handle metadata of many standards (OpenSea, ZORA, Nouns), hosted in many places (ipfs, http, dataURIs), and normalize them into a consistent format.

Our goal with this project is to democratize access to NFT metadata.

pip install offchain
from offchain import MetadataPipeline, Token

pipeline = MetadataPipeline()
token = Token(
    collection_address="0x5180db8f5c931aae63c74266b211f580155ecac8",
    token_id=9559
)
metadata = pipeline.run([token])[0]

metadata.name               # -> 'antares the improbable'
metadata.description        # -> 'You are a WITCH who bathes in the tears of...'
metadata.standard           # -> OPENSEA_STANDARD
metadata.attributes         # -> [Attribute(trait_type='Skin Tone', ...]
metadata.image              # -> MediaDetails(size=2139693, sha256=None, uri='https://cryptocoven.s3.amazonaws.com/2048b255aa1d02045eef13cdd7100479.png', mime_type='image/png')
metadata.additional_fields  # -> [MetadataField(...), ...]

See documentation for more examples and tutorials.

Contributing

We welcome contributions that add support for new metadata standards, new ways of retreiving metadata, and ways of normalizing them to a consistent form. We are commited to integrating contributions to our indexer and making the results available in our API.

You should be able to contribute a new standard for metadata, and have NFTs that adhere to that metadata standard be returned correctly from queries to api.zora.co. We hope this helps to foster innovation in how NFTs are represented, where metadata is stored, and what is expressed in that metadata.

Features

  • Multiple metadata standards: represent metadata any way you wish
  • Multiple transport protocols: store metadata where you want
  • Composible for custom applications: only parse the standards you care about
  • Future proof: extensible to new formats, locations, etc. The more gigabrain the better.

Development

This project is developed using Python 3.9. Here's a recommended setup:

Poetry

This project uses poetry for dependency management and packaging. Install poetry:

curl -sSL https://install.python-poetry.org | python3 -

Setup

poetry install

Pre-commit

Pre-commit runs checks to enforce coding standards on every commit

pip install pre-commit  # into global python path
pre-commit install

Testing

poetry run python -m pytest tests/

Documentation

This project uses mkdocs and mkdocs-material for documentation.

poetry run mkdocs serve

Release files for offchain 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for offchain 0.3.5
File Size Uploaded
offchain-0.3.5.tar.gz 36.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for offchain 0.3.5
File Interpreter ABI Platform
offchain-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 100.6 kB

Release files / offchain-0.3.5.tar.gz

Download URL offchain-0.3.5.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
200f722e82b4284df8c3ab13bc0cb37a5bc3b71d8f16d15dd5716cb4228388f9
BLAKE2b-256 checksum
How to use checksums
23819dad2c5f4edaaddc7edb91092e887f80d4579b1c8deef330d08b5af3d3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/5.15.0-1070-azure

Release files / offchain-0.3.5-py3-none-any.whl

Download URL offchain-0.3.5-py3-none-any.whl
Size 64.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c80429eb279785cc69646bf2e6e26b4fd4477ccb69a37f9152032e343fcd1be5
BLAKE2b-256 checksum
How to use checksums
77460ede98ad0704bd31f8d81c23e561c6895c3a6e8b35c9940b3eecf51d59d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/5.15.0-1070-azure

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page