CurrentKey

Storage Plain v361 → current

The currently active ML-KEM-768 public key for encrypting MEV -protected transactions.

Explore chain
Queried by: developerswalletsvalidators

The Big Picture

CurrentKey is the decryption-side key in the MevShield protocol. The block author who announced this key holds the matching private key and uses it to decrypt encrypted submissions. Users should NOT read CurrentKey for encryption — instead, read NextKey, which is the key announced by the upcoming block author. CurrentKey exists so the current block author can identify which private key to use for decryption.

Why This Matters

To submit an MEV-protected transaction, you need the current encryption key. Without it, you can't encrypt your transaction for protection. If CurrentKey is None, MEV protection isn't available.

Example Scenario

You want to submit an encrypted swap. Query NextKey - if Some(key), use it to encrypt your transaction via ML-KEM + XChaCha20-Poly1305. If None, no validator has announced a key and MEV protection isn't available. CurrentKey is only relevant for the block author's decryption side.

Common Questions

Should I use CurrentKey or NextKey?
Always use NextKey for new encrypted submissions. CurrentKey is the decryption-side reference — the block author who announced this key uses the matching private key to decrypt submissions that were encrypted with it when it was still NextKey. By the time a key is in CurrentKey, new submissions should use the newer NextKey instead.
What if CurrentKey is None?
MEV protection isn't available. Either the previous block author didn't announce a key, or the network hasn't enabled MevShield. Submit transactions normally (unencrypted).

Use Cases

  • Encrypt transactions for MEV protection
  • Verify key is available before submission
  • Build MEV-protected wallet interfaces

From Chain Metadata

Current ML‑KEM‑768 public key bytes (encoded form).

Purpose & Usage

Purpose

Provides the encryption key users should use for the current block's submissions.

Common Query Patterns

  • Query to get current encryption key
  • Check if MEV protection is available

Notes

  • ML-KEM-768 public key in encoded form
  • None if no key was announced (MEV protection unavailable)
  • Rotates each block as NextKey becomes CurrentKey
Part of: MEV Shield

Stored Value

value (BoundedVec)

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query CurrentKey storage (no keys - plain value)
const result = await api.query
  [stringCamelCase("MevShield")]
  [stringCamelCase("CurrentKey")]();
console.log("CurrentKey:", result.toHuman());

Runtime Info

View Source
Pallet
MevShield
Storage Kind
Plain
First Version
v361
Current Version
v393