Skip to content

feat: Dilithium signatures#1

Open
czareko wants to merge 7 commits into
masterfrom
feat/dilithium-signatures
Open

feat: Dilithium signatures#1
czareko wants to merge 7 commits into
masterfrom
feat/dilithium-signatures

Conversation

@czareko

@czareko czareko commented Mar 10, 2026

Copy link
Copy Markdown

Dilithium (ML-DSA-87, NIST FIPS 204) post-quantum signature support for access keys in NEAR

  • Protocol feature: Introduce ProtocolFeature::DilithiumSignatures enabled from protocol version 202.

  • core/crypto – Cryptographic layer (key types, signatures, verification) - Implemented Dilithium public keys, secret keys, and signatures via qp-rusty-crystals-dilithium.

  • core/primitives – Transaction and action validation at protocol level - Transactions validated with Dilithium keys based on protocol version (allow only when DilithiumSignatures is enabled).

  • runtime – Verifying transaction signatures during block execution - Dilithium signatures verified in the verifier.

  • rosetta-rpc – Rosetta-compatible API (blockchain indexing) - Support CurveType::Dilithium and SignatureType::Dilithium in models.

  • tools/mirror – Migration tool between networks - Dilithium keys mapped during migration.

  • integration-tests – End-to-end tests (transactions, blocks, runtime) - Added create_runtime_node_with_dilithium() helper with protocol 202, and tests test_add_key_dilithium_runtime and test_transfer_signed_by_dilithium_runtime.

  • RuntimeUser – User abstraction for signing and sending transactions - Added new_with_protocol_version() and pass protocol version from genesis, so tests run with protocol 202.

  • Protocol version: No change to NIGHTLY_PROTOCOL_VERSION; Dilithium remains in the "not yet in Nightly" bucket (202); tests use explicit protocol_version = 202.

  • Run tests: cargo test --package integration-tests --features test_features -- dilithium --show-output

TODO (Optional)

  • Dilithium implicit accountsderive_dilithium_implicit_account_id, AccountType::DilithiumImplicitAccount, runtime handling in action_implicit_account_creation_transfer. Requires format for account ID (e.g. prefix 0d + hex).
  • Wallet contract – Support for Dilithium keys (public_key_kind = 2) in the ETH-style wallet contract ABI and verification logic.

Commands for local run:
Init: cargo run --profile dev-release -p neard -- init
Start: cargo run --profile dev-release -p neard -- run

@czareko czareko changed the title Feat/dilithium signatures feat: Dilithium signatures Mar 11, 2026
@czareko czareko requested a review from illuzen March 11, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants