Skip to main content

How to Build a Decentralized KYC Oracle for Web3 in 2026

A KYC oracle is Didit verification off-chain plus a signed webhook and an attestation your relayer writes. Full KYC is $0.33, AML $0.20, sandbox testing is free and unlimited, and you own the chain side.

How to Build a Decentralized KYC Oracle for Web3 in 2026

Contents

In this guide

Jump to the part you need.

A decentralized KYC oracle lets a smart contract act on a real identity decision without personal data ever touching the chain. This guide is for teams building that bridge: off-chain verification with Didit, a signed webhook, and an on-chain attestation your contract reads. A full KYC check costs $0.33 and an AML screening $0.20; sandbox testing is free and unlimited. The caveat is ownership: Didit verifies the person, your relayer writes the chain.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

Decentralized KYC oracle: the five moving parts and who owns each
LayerWhat it doesWho runs itPublished price
VerificationID document verification, passive liveness, face match, device and IP analysisDidit$0.33 full KYC
AML screening, optionalScreens the person against sanctions, PEP and watchlistsDidit$0.20 per check
Session and decision APIHosted flow plus the decision object with plural feature arraysDiditBilled per completed check
Webhook deliveryPushes status changes signed with HMAC-SHA256DiditNot separately priced in the published feed
Attestation writer and contractVerifies the signature, applies your policy, writes the on-chain claimYouYour own gas
Wallet risk screening, optionalScreens a wallet address with no transaction requiredDidit$0.15 per screening

Start free in the sandbox at business.didit.me, no sales call needed. If you want an AI assistant to write the glue code, connect Didit to it through the MCP server. Current list prices for every module sit on didit.me/pricing.

What the oracle does and where the trust boundary sits

A KYC oracle has three jobs, and only one of them belongs to Didit. The first is verification: prove that the person behind a wallet is a real human holding a government document, and screen that person against sanctions, PEP and watchlists. The second is a policy decision: your rules turn an Approved status into the exact claim your contract needs, such as this address is verified until 12 March 2027. The third is the attestation: a key you control writes that claim to your chain, and your contract reads it.

We cover the first job and hand you the evidence for the second. The documented Didit APIs return decisions and signed webhooks while your relayer writes the chain transaction. That split survives an audit: Didit is SOC 2 Type 2 and ISO/IEC 27001:2022 certified for the personal data it processes, and your contract only ever sees the claim you chose to publish. 4,000+ companies use Didit today.

Keep the on-chain payload small and boring. A boolean, an expiry timestamp, an issuer reference and a policy version are enough for most protocols. Never write names, document numbers or hashes of a document to a public chain. A chain cannot forget, while data protection law gives people a right to erasure under the GDPR, so anything identifiable that you publish stays published. The verification itself stays off-chain, in Didit. The decision carries biometric_retention with a deletes_at date for the live biometric data of that session, so you log the date next to the attestation.

Prerequisites

  • A Didit organization. Sign up at business.didit.me. The sandbox key lets you build and test without paying: sandbox testing is free and unlimited.
  • An API key with permission to create workflows, create sessions and read sessions.
  • A wallet address per user, stored in your database and passed as vendor_data so the decision comes back bound to that address.
  • An HTTPS endpoint that can read a raw POST body and answer in under 5 seconds.
  • A relayer account and a small contract on your chain. This part is yours; nothing in the Didit API signs or sends a transaction.
  • curl or a Node runtime to run the examples below.

Build the oracle in eight steps

Step 1: Decide the claim before you build anything

Write down the exact assertion your contract will read. Common shapes: a boolean per address, a boolean plus an expiry, or a tier such as individual versus business. Age gates want over 18. DeFi pools usually want a verified natural person, not sanctioned, verified within 12 months. If the claim needs a country of residence on-chain, ask whether a boolean would satisfy your auditor instead, because country plus wallet is a strong re-identification pair.

Step 2: Create the verification workflow

Use the console or create the workflow from the API. The call below comes from the Quick Start and runs OCR, passive liveness, face match and AML screening in a single session, which is the minimum set an identity oracle should require.

curl -X POST https://verification.didit.me/v3/workflows/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workflow_label": "Standard KYC",
"workflow_type": "kyc",
"features": [
  {"feature": "OCR"},
  {"feature": "LIVENESS", "config": {"face_liveness_method": "PASSIVE"}},
  {"feature": "FACE_MATCH"},
  {"feature": "AML"}
]
}'

Persist workflow.id. That UUID is the only workflow reference the session call needs.

Step 3: Bind a wallet address to a session

A session is the unit that carries the decision. Send the wallet address as vendor_data so the webhook and the decision both return mapped to that address, and put the chain id in metadata. The callback must sit on an origin registered as an allowed domain on your application, otherwise creation fails with a 400.

curl -X POST https://verification.didit.me/v3/session/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"workflow_id": "$WORKFLOW_ID", "vendor_data": "0x9f2ac1b4c5d6e7f80912a3b4c5d6e7f80912a3b4", "callback": "https://myapp.com/kyc/return", "metadata": {"chain_id": 1, "purpose": "oracle_attestation"}}'

The response contains session_id, url and session_token. Redirect the user to url or open it inside an SDK. The full field list is in Create Session.

One warning before you rely on that mapping: vendor_data is an application mapping choice, not cryptographic proof that the wallet owner completed the verification. Your contract trusting your relayer to have made the mapping is an implementation assumption, not something Didit guarantees. Record the wallet address and the session_id together in your application's audit record, and treat that pair as the evidence you show if a claim is disputed.

Step 4: Register the webhook destination

Register the endpoint that will write attestations, and save the returned secret_shared_key. Subscribe only to the events you act on, because there is no wildcard.

curl -X POST https://verification.didit.me/v3/webhook/destinations/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Oracle relay", "url": "https://myapp.com/api/webhooks/didit", "subscribed_events": ["status.updated", "data.updated"], "webhook_version": "v3"}'

Step 5: Verify the signature before you trust the payload

Read the raw body first, then check X-Signature-V2, which is HMAC-SHA256 over the canonical JSON, and confirm that X-Timestamp is within 300 seconds of now. Compare with a constant-time function and accept a match on the -Previous header during a secret rotation. De-duplicate on event_id and answer 2xx within 5 seconds. The rules are in Webhooks.

Step 6: Read the decision and check every array

The webhook carries the decision on final statuses, and the decision endpoint returns it on demand. Keep the endpoint as your fallback and for reconciliation.

curl https://verification.didit.me/v3/session/<SESSION_ID>/decision/ \
-H "x-api-key: <API_KEY>"

V3 returns plural arrays, so never assume a single object: id_verifications[], liveness_checks[], face_matches[], aml_screenings[]. Branch on session_kind first, either user or business, then read each array. If a feature did not run, the field is absent or null, never a placeholder. The schema is in Retrieve Session.

A session overview with its warnings in the Didit Business Console
The session view your compliance team reads when a decision lands in In Review.

Step 7: Apply your policy and build the attestation payload

Only Approved should produce an attestation. In Review means a human reviewer still has to decide, Declined means a check failed, and Kyc Expired means the document behind an earlier approval has passed its expiry date. Map the status to your contract call, set an expiry your policy can defend, and keep the session_id in your own database as the audit link rather than on-chain.

The documented webhook and decision APIs do not define an on-chain attestation format. The contract schema, the expiry rule and the relayer policy are yours to design, and yours to document for whoever audits the protocol.

AML screening result for a session in the Didit Business Console
The AML result behind the aml_screenings[] array your policy reads before attesting.

Step 8: Write from the relayer, then plan for re-verification

Your handler validates the event, your server applies policy, and a relayer key you control sends the transaction. Nothing on the browser path should be able to write an attestation. When a user re-verifies, write a new attestation with a later expiry and keep the previous one in an append-only log so a dispute can be reconstructed. If your protocol also needs wallet risk beyond identity, screen the address on demand through wallet screening and store the result next to the identity attestation, or bring your own screening provider and run it inside Didit.

A wallet screening result in the Didit Business Console
An on-demand wallet screening result you can attach to the same address attestation.

Expected output

A successful create call returns a session you can redirect to. The final status arrives either as a signed webhook or from the decision endpoint. The webhook envelope looks like this, with the decision attached on a final status:

{
"event_id": "uuid",
"session_id": "uuid",
"status": "Approved",
"webhook_type": "status.updated",
"created_at": 1627680000,
"timestamp": 1627680000,
"application_id": "uuid",
"environment": "live",
"workflow_id": "uuid",
"workflow_version": 1,
"vendor_data": "0x9f2ac1b4c5d6e7f80912a3b4c5d6e7f80912a3b4",
"metadata": {"chain_id": 1, "purpose": "oracle_attestation"},
"decision": { }
}

Inside the decision, expect status, session_kind, vendor_data, decision_trace, biometric_retention with a deletes_at date, and the feature arrays. Status strings are exact and case sensitive, and Kyc Expired uses a single capital K in the middle. Your oracle should end with one row of your own: wallet address, status, expiry, session id, policy version. The full status list is in Verification Statuses.

Inputs and outputs at each hop

What you send and what you get back on the path from wallet to attestation
HopYou sendYou get backWhat it is for
Workflowworkflow_label, workflow_type, features[]workflow.idFixing the checks every session must pass
Sessionworkflow_id, vendor_data (wallet), metadata, callbacksession_id, url, session_tokenBinding the decision to an address
Hosted flowThe user captures document, face and livenessNothing yetProducing the evidence
WebhookNothing, Didit pushesevent_id, status, decision, X-Signature-V2Triggering your policy
Decision endpointsession_idFull decision with plural arraysReconciliation and re-checks
Your relayerWallet, claim, expiryTransaction hashThe on-chain attestation

Failure cases and how to recover

Common failures when you build a KYC oracle, and the fix
SymptomCauseRecovery
401 from verification.didit.meInvalid, revoked or expired API keyIssue a new key and redeploy the secret
403 with the message that you do not have permission to perform this actionThe key lacks the required privilege, for example read:sessionsGrant the privilege to the key you use for decisions
400 on session createInvalid workflow_id, or a callback outside the allowed domainsCheck the workflow UUID and register the callback origin
404 on the decision endpointWrong session_id, or the session belongs to another applicationRe-read the id from your own store, not from the user input
Missing or duplicated attestationsHandler slower than 5 seconds, or a 5xx or 404 responseDidit retries twice, after about 1 and 4 minutes, then drops the delivery. Resend from the destination delivery log and de-duplicate on event_id
Signature mismatchYou parsed JSON before hashing, or the secret was rotatedHash the raw body and accept the -Previous header during rotation
Status In ReviewAutomated checks raised warningsThis is not a decision. Wait for the reviewer, then act on the new event
Status Expired or AbandonedThe user never opened the link or never finishedCreate a new session. Do not attest
Status Kyc ExpiredThe verified document passed its expiry dateStop treating the address as verified and request re-verification
What a KYC oracle run costs, by published unit price
ActionPublished priceUnit
Full KYC check, ID document $0.15 plus passive liveness $0.10 plus face match $0.05 plus device and IP $0.03$0.33Completed check
AML screening against 1,300+ lists$0.20Check
Ongoing AML monitoring$0.07Person per year
Wallet screening$0.15Screening
Business verification from a registry (KYB)From $2.00Company, by country and data tier
Company AML and person AML per UBO or officer$0.20 eachCheck
Workflow orchestrator, reusable KYC, MCP server, SDKsFreeIncluded
Sandbox testingFree and unlimitedEvery plan

You pay for a check only when it finishes with a result, so a session the user abandons before any check completes does not bill you a full KYC. Sandbox testing is free and unlimited, which is where every one of the steps above should be exercised first.

The review boundary has two lines. On our side, a session that lands in In Review is decided by a human reviewer in the Didit Console, and your oracle should not treat that status as an approval. On your side, your compliance team owns the policy, the relayer key and the contract upgrade authority. The documented APIs return decisions and signed webhooks, and your relayer writes the chain transaction. Decide in advance who in your team can move an address from verified to revoked, and log every such action next to the session_id that justified it.

Worked cost example

Take a protocol that verifies 1,000 new wallets in a month with the compliance set: full KYC plus AML screening. At list prices, one user costs $0.33 + $0.20 = $0.53. One thousand users cost 1,000 x $0.53 = $530.00. Of those 1,000 users, 300 add a withdrawal address that you screen on demand: 300 x $0.15 = $45.00. Month one total: $530.00 + $45.00 = $575.00. Ongoing AML monitoring for the 1,000 verified users runs at $0.07 per person per year, so 1,000 x $0.07 = $70.00 across the year.

The same month on the Growth plan, with 4% off every Didit price: a full KYC check is $0.3168 and AML screening $0.192, so one user is $0.5088 and 1,000 users are $508.80. Wallet screening is $0.144, so 300 screenings are $43.20. Usage totals $508.80 + $43.20 = $552.00. Growth costs $99 a month and includes $115 of credit, which pays the first $115.00 of that usage, leaving $437.00 from prepaid balance, for a month total of $99.00 + $437.00 = $536.00. The on-chain side is separate: your own gas, priced by your chain.

Build and rehearse the same numbers in the sandbox first. Sandbox testing is free and unlimited, so none of those checks bill while you prove the flow.

Building it with an AI assistant

Most of the glue on this page is API calls, which a coding agent can write quickly if it can read the current docs. The Didit MCP server is hosted at https://mcp.didit.me/mcp with OAuth sign-in, and it is free on every plan. Setup for each client is at didit.me/developers/mcp. If you prefer one prompt instead of a connector, use the integration prompt and point your agent at the documentation index.

Setup for every client: didit.me/developers/mcp.

Sources

Next step: open a free sandbox organization at business.didit.me, create the workflow from Step 2, and run one session with your own wallet address in vendor_data. No sales call needed, and sandbox testing is free and unlimited, so you can prove the whole path before your relayer writes anything.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

What is a decentralized KYC oracle?

A decentralized KYC oracle is infrastructure that lets a smart contract act on a verified identity without storing personal data on-chain. An off-chain provider such as Didit verifies the person and returns a decision, and a contract you control records a minimal claim about the wallet, usually a boolean plus an expiry. The chain only sees the claim, never the document or the face.

Do I need zero-knowledge proofs to build one?

No. A boolean attestation per address with an expiry covers age gates, jurisdiction gates and sanctions gating. A boolean attestation is simpler to implement. Use zero-knowledge proofs when your requirements include unlinkability, for example when a user must prove eligibility across several addresses without linking them. Start with the attestation and add proofs only when a specific requirement demands unlinkability.

How do I keep personal data off the chain?

Keep the document, the face, the name and the address inside Didit, and publish only a claim plus an expiry plus an issuer reference. Do not write a hash of a document either, because a chain cannot be edited while data protection law gives people a right to erasure. The decision returns biometric_retention with the deletes_at date for the live biometric data of the session, so you can log that date next to your attestation.

How does a KYC oracle check sanctions and watchlists for a trust or a fund?

Screen the entity, not only the individuals. A Didit business verification workflow pulls the official registry record, priced by country and data tier from $2.00 per company, extracts the officers and beneficial owners, and runs company AML at $0.20 plus person AML at $0.20 per UBO or officer, with a linked full KYC at $0.33 for each person who has to be verified. The decision returns registry_checks, key_people_checks and aml_screenings, and your oracle should attest only when the entity and every required person have cleared the watchlists your policy names.

What does it cost to verify one user?

A full KYC check is $0.33: ID document $0.15, passive liveness $0.10, face match $0.05 and device and IP analysis $0.03. AML screening is a separate $0.20 per check, so the compliance set is $0.53 per user. You pay per completed check from prepaid credit, and sandbox testing is free and unlimited.

What happens if a session lands in In Review?

In Review means automated checks raised warnings and a human compliance reviewer has to decide in the Didit Console. Your oracle must treat it as pending, not as approved, and wait for the follow-up event after the reviewer approves, declines or asks for a resubmission. If you auto-attest on In Review you will publish claims your own compliance team has not signed off.

Can someone forge a webhook and get a fake attestation?

Only if you skip signature checks. Every Didit webhook carries X-Signature-V2, an HMAC-SHA256 over the canonical JSON with your destination secret, plus an X-Timestamp you should reject beyond 300 seconds. Verify against the raw body before parsing, compare in constant time, and de-duplicate on event_id. Belt and braces: re-fetch the decision from the API before your relayer sends a transaction.

How long should an on-chain attestation last?

Shorter than the identity evidence behind it. A verified document eventually expires, and Didit moves that session to Kyc Expired when it does, so an attestation that outlives the document is a false claim. Twelve months for DeFi access and six months for higher-risk flows are example policy values, not recommendations. Set the final period in your protocol's documented risk assessment. Re-run the session on renewal rather than extending the old attestation.

Does Didit run the oracle or sign my transactions?

No. Didit verifies people and businesses, returns the decision through the API, and delivers signed webhooks. Nothing in the documented API signs or sends a chain transaction: your relayer key writes the transaction and your contract holds the claim. Your team owns the relayer key, the contract and the upgrade authority.

Can I screen a wallet address without a transaction?

Yes. Wallet screening is available on demand at $0.15 per screening, so you can check an address when a user connects or adds a withdrawal destination, before any transaction exists. If you already have a screening provider, bring your own screening provider and run it inside Didit.

How do I test the whole flow without paying?

Use a sandbox application. Sandbox testing is free and unlimited on every plan, and sandbox sessions bill nothing. You can also arm a sandbox scenario such as a decline to exercise your policy paths before a real user ever hits the flow. The steps are in the Quick Start.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.