Precompiles
Name
Address
Purpose
Common pattern: Encrypted events
// 1. Derive an AES key via ECDH
sbytes32 aesKey = sbytes32(ecdh(contractPrivKey, recipientCompressedPubKey));
// 2. Generate a random nonce
uint96 nonce = uint96(unsafe_rng_u96());
// 3. Encrypt the sensitive data
bytes memory encrypted = aes_gcm_encrypt(aesKey, nonce, plaintext);
// 4. Emit a regular event with the encrypted bytes
emit EncryptedData(msg.sender, recipient, nonce, encrypted);Last updated

