For Builders

Introduction

The DIVS Python SDK enables developers to integrate trustless image claim verification directly into their applications, bots, browser extensions, or moderation tools. This guide helps you make your first verification request in under 5 minutes, giving you access to decentralized image analysis powered by independent Vision-Language Model (VLM) nodes.


1️⃣ Prerequisites

Before you start, you’ll need:

Copy the generated key (prefixed wtns_)

  • ✅ A Python 3.10.17+ environment

  • ✅ A publicly accessible image URL or base64-encoded image


2️⃣ Install the SDK

Install the official Witness SDK via PyPI

Verify installation:



3️⃣ Verify Your Image

Option 1 – Public Image URL


Option 2 – Local File Path (from your script's directory)


Option 3 – Base64-Encoded Image


Key Points:

  • You can pass URLs, local file paths, or base64 strings interchangeably in inputs=[...].

  • Local files are easiest for dev environments; URLs are useful for remote images; base64 works well for in-memory or private images.


4️⃣ Sample Output


5️⃣ Advanced Usage

Verify Multiple Images


Custom options


6️⃣ Best Practices

  • Cache Results: Avoid repeated verifications for the same image+claim pair.


7️⃣ Example Use Cases

  • Fact-checking bots: Validate viral images before sharing.

  • News authenticity tools: Detect manipulated or miscaptioned images.

  • Moderation pipelines: Flag potentially misleading visuals.

  • Browser extensions: Give end-users quick access to decentralized verification results.


8️⃣ Troubleshooting

  • ModuleNotFoundError: No module named 'witnesschain' Ensure you ran pip install witnesschain in the same environment.

  • Authentication errors

    • Check that WITNESSCHAIN_API_KEY matches exactly the string on your dashboard.

    • Confirm you haven’t accidentally revoked the key or has been expired.

  • Slow or no responses

    • Verify your network connectivity.

    • Check the challenge_id for more insights


Last updated