Skip to main content

Encryption contract

ElementContract
Key discoveryGET /v2/encryption-key
Submission pathPOST /v2/request
Request payloadSigned request bytes encrypted with operator public key
Key materialPer-request secret key and nonce bytes

Client flow summary

  1. Serialize the signed request payload to JSON bytes.
  2. Fetch the operator compressed secp256k1 public key from GET /v2/encryption-key.
  3. Generate a fresh ephemeral private key and derive the shared secret with ECDH.
  4. Compute keccak256(shared_secret) and use the first 16 bytes as the AES-GCM key.
  5. Generate a fresh 12-byte nonce.
  6. Prefix the plaintext with its 4-byte big-endian length and encrypt with AES-GCM.
  7. Submit bytes in the order ciphertext || tag || nonce || client_public_key_compressed.

Wire format

SegmentMeaning
ciphertextAES-GCM encrypted request bytes
tagAES-GCM authentication tag
nonce12-byte AES-GCM nonce
client_public_key_compressedEphemeral compressed secp256k1 public key

Error behavior on submission

Error reasonBehavior
InvalidEncryptionRebuild fresh key material and resubmit
RateLimitRetry with backoff when enabled
SafetyFailureReturn error immediately; fix payload
ServiceUnavailableRetry with backoff
Other invalid request errorsReturn error; do not blind-retry
Last modified on April 10, 2026