Precompiles
Call Mercury EVM precompiles from Rust
Mercury EVM ships with six cryptographic precompiles at fixed addresses. They are callable via eth_call from any provider connected to a Seismic node — no encryption state or wallet is required.
Convenience Helpers
The seismic_alloy_provider::precompiles module provides three layers of helpers:
Address constants —
precompiles::addresses::RNG,precompiles::addresses::ECDH, etc.Encode/decode functions —
precompiles::encode_rng(),precompiles::decode_secp256k1_sign(), etc.Async call wrappers —
precompiles::call::rng(),precompiles::call::ecdh(), etc.
use seismic_alloy_provider::precompiles;
// Generate 32 random bytes
let random = precompiles::call::rng::<SeismicFoundry, _>(&provider, 32, b"my_domain").await?;
// Derive a shared AES key via ECDH
let aes_key = precompiles::call::ecdh::<SeismicFoundry, _>(&provider, &secret_key, &pubkey).await?;
// AES-GCM encrypt/decrypt
let ciphertext = precompiles::call::aes_encrypt::<SeismicFoundry, _>(&provider, &key, &nonce, plaintext).await?;
let plaintext = precompiles::call::aes_decrypt::<SeismicFoundry, _>(&provider, &key, &nonce, &ciphertext).await?;Manual Calling Pattern
You can also call precompiles directly by building a TransactionRequest:
Reference
Quick Example
Internal Usage
The SeismicSignedProvider uses several of these precompiles internally as part of the filler pipeline:
ECDH (
0x65) — Used during TEE key exchange to derive a shared secret between the client and the Seismic node's TEEAES-GCM Encrypt (
0x66) — Used to encrypt calldata before sending shielded transactionsAES-GCM Decrypt (
0x67) — Used to decrypt responses from signed readsHKDF (
0x68) — Used to derive AES keys from ECDH shared secrets
You can also call these precompiles directly for custom cryptographic workflows.
See Also
Provider Overview — Signed and unsigned provider types
Encryption — How the provider uses precompiles internally
Contract Interaction — Shielded and transparent calls
Last updated

