How It Works

From API call to on-chain proof in minutes. No blockchain expertise required.

Architecture

Your System                  MidnightZK                Midnight Blockchain
    |                              |                              |
    |  POST /anchor {hash}         |                              |
    |----------------------------->|                              |
    |                              |                              |
    |  202 Accepted {task_id}      |                              |
    |<-----------------------------|                              |
    |                              |                              |
    |                              |  Generate ZK Proof           |
    |                              |  ........................     |
    |                              |                              |
    |                              |  Submit Transaction          |
    |                              |----------------------------->|
    |                              |                              |
    |                              |  Confirmed (block #N)        |
    |                              |<-----------------------------|
    |                              |                              |
    |  Webhook: task.completed     |                              |
    |<-----------------------------|                              |
    |  {tx_hash, block_height}     |                              |

Step by Step

1

Get your API key

Each client receives a dedicated API key and app namespace (e.g., tw-cbam). Your key defines your rate limits, scopes, and webhook endpoint.

2

Hash your data locally

Generate a SHA-256 hash of the document or data you want to anchor. The hash is a fixed-length fingerprint — it's mathematically impossible to reverse it back to the original data.

# Example: hash a file
sha256sum report.pdf
a1b2c3d4e5f6... report.pdf
3

Call the Anchor API

Send the hash to MidnightZK. The API returns immediately with a task ID — the actual proof generation happens asynchronously.

POST /api/v1/tw-cbam/anchor
Authorization: Bearer mr_live_...
{
  "hash": "a1b2c3d4e5f6..."
}

Response: 202 Accepted
{
  "task_id": "uuid-...",
  "status": "QUEUED"
}
4

ZK proof generation

MidnightZK's enclave worker generates a zero-knowledge proof. This proof mathematically guarantees that the hash was correctly processed — without revealing the hash itself to the blockchain in plaintext.

5

On-chain confirmation

The proof is submitted to the Midnight blockchain. Once confirmed in a block, MidnightZK sends a webhook to your system with the transaction details.

Webhook: POST your-endpoint.com/callback
{
  "event": "task.completed",
  "task_id": "uuid-...",
  "tx_hash": "0xabc...",
  "block_height": 79757
}

Verify anytime

Anyone with the original data can re-hash it and call the verification endpoint. If the hash matches an on-chain record, the data's integrity is confirmed — no trust required.

Frequently Asked Questions

Do I need to understand blockchain or cryptography?

No. MidnightZK handles all blockchain interactions. You only need to generate a SHA-256 hash (a standard operation in any programming language) and call a REST API.

How long does anchoring take?

Typically 1-3 minutes from API call to on-chain confirmation, depending on network conditions. You receive the result via webhook — no polling required.

Does my data touch the blockchain?

No. Only the zero-knowledge proof is written on-chain. Your raw data never leaves your system. Even the hash is processed in memory and destroyed immediately after proof generation.

What is the Midnight blockchain?

Midnight is a Layer-1 blockchain built by Input Output Global (IOG), the creators of Cardano. It's designed specifically for data protection, with native zero-knowledge proof support. MidnightZK is an independent service built on top of Midnight.

Ready to anchor your first proof?

Get in touch and we'll help you integrate in hours.

Contact Us