# How Does the KRNL Protocol Work?

This page is dedicated to illustrating how the KRNL Protocol works when an application submits a transaction to a system, and how systems receive responses from the execution layer. This is the high level architecture:

#### Step 1 — User interacts with dApp

The user initiates an action (e.g., submit data, verify a record, trigger a workflow) through the application frontend, which is integrated with KRNL.

<figure><img src="/files/8U3vIBdTq8Qy9TNcmyhc" alt=""><figcaption></figcaption></figure>

#### Step 2 — User Account (EOA) Authorizes a smart contract account

The user's account delegates execution rights to their delegated account via programmable authorization, enabling automated workflow execution.

<figure><img src="/files/WKeCheQbdJcsXBiUmta0" alt=""><figcaption></figcaption></figure>

#### Step 3 — dApp uses KRNL SDK (fetch metadata)

The application backend uses the KRNL SDK to retrieve workflow definitions and registry metadata, ensuring the correct execution steps and logic are loaded.

<figure><img src="/files/ghxBxVi5l6PM9rEb4zM7" alt=""><figcaption></figcaption></figure>

#### Step 4 — SDK sends JSON-RPC request to KRNL Node

The execution request (workflow definition + parameters) is transmitted to the KRNL Node over a secure protocol for processing.

<figure><img src="/files/GkRCHgz02iCtESYZk3E8" alt=""><figcaption></figcaption></figure>

#### Step 5 — Workflow Engine loads the workflow

The KRNL Node parses the workflow into an execution graph, allocates resources, and prepares execution in an isolated sandbox environment.

<figure><img src="/files/HZ2YxkasnAw8YS1AYFxW" alt=""><figcaption></figcaption></figure>

#### Step 6 — Executor runs steps (sandboxed) and calls externals

Each execution step (API call, database query, data transformation, AI inference) is executed by an Executor within a secure sandbox.

<figure><img src="/files/G7kwK7PxIEPTlQwfTA2P" alt=""><figcaption></figcaption></figure>

#### Step 7 — Attestor signs the final result

The Attestor monitors network traffic, derives ephemeral keys, and cryptographically signs the final execution result, producing a verifiable proof.

<figure><img src="/files/SsmYDICI1KlBIw17Mdrf" alt=""><figcaption></figcaption></figure>

#### Step 8 — KRNL Node sends the UserOps to the Relayer/Bundler&#x20;

The signed execution proof is wrapped into a structured request and handed off to the external bundler for settlement.

<figure><img src="/files/soOmnkfm4ctPsdnnNtAF" alt=""><figcaption></figcaption></figure>

#### Step 9 — Bundler forwards the UserOps after validation to designated SCA

The bundler checks proof validity, batches requests if needed, optimizes resource usage, and submits the request to the delegated account for final processing.

<figure><img src="/files/c2RAUWTIWC6XVWFyZ4Ut" alt=""><figcaption></figcaption></figure>

#### Step 10 — SCA sends the fees to KRNL Vault & Execute the target smart contract

The delegated account verifies the attestor's signature, atomically transfers execution fees to the KRNL Vault, and calls the target system with the verified response.

<figure><img src="/files/BnxbltCM1Lwtt9NruXiq" alt=""><figcaption></figcaption></figure>

#### Step 11 — Target Contract updates state / business logic

The target contract executes its logic (e.g., update records, trigger payments, issue credentials) only after validating the KRNL proof, ensuring verified execution is logged on a tamper proof blockchain.

<figure><img src="/files/QvmBCNS6xTg0LExj4dsO" alt=""><figcaption></figcaption></figure>

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krnl.xyz/getting-started/how-does-kos-work.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
