# Input Format for Precompiled Function Calls

### **1. Input Format Specification**

When invoking precompiled contracts for Dilithium5 or MLDSA-87 verification, the input must follow this structured byte format:

Copy

```
[...PUBLIC_KEY...MESSAGE...SIGNATURE]
```

#### **Field Definitions**

| Field        | Description                                                     |
| ------------ | --------------------------------------------------------------- |
| `PUBLIC_KEY` | The public key (Dilithium5: 1,312 bytes / MLDSA-87: \~3 KB)     |
| `MESSAGE`    | Original message (arbitrary length) that was signed             |
| `SIGNATURE`  | Cryptographic signature (Dilithium5: 2.8 KB / MLDSA-87: 2.5 KB) |

***

### **2. Precompiled Contract Addresses**

```
// Precompiled Contract Addresses
address constant DILITHIUM_VERIFIER = 0x0000000000000000000000000000000000000012;
address constant MLDSA_VERIFIER = 0x0000000000000000000000000000000000000013;
```

***

### **3. Verification Logic**

The precompiled contracts:

1. Validate that `SIGNATURE` matches `MESSAGE` when signed by `PUBLIC_KEY`.
2. Return `1` (success) or `0` (failure) as a 32-byte word.

***

### **4. Use Cases**

#### **4.1 Post-Quantum Secure Authentication**

* Verify off-chain signatures before executing sensitive transactions.

#### **4.2 Decentralized Identity**

* Validate quantum-proof credentials in DID (Decentralized Identifiers) systems.

#### **4.3 Gas Optimization**

* 30-50% cheaper than equivalent EVM-based signature verification.

<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://qanchain.gitbook.io/qan/quantum-proof-onchain/input-format-for-precompiled-function-calls.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.
