> For the complete documentation index, see [llms.txt](https://docs.seismic.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seismic.systems/reference/precompiles.md).

# Precompiles

Seismic adds six precompiled contracts to the EVM, giving smart contracts access to cryptographic primitives that would be prohibitively expensive to implement in Solidity. All standard Ethereum precompiles (e.g. `ecrecover`, `sha256`) remain available at their usual addresses.

Precompiles are called like regular contracts using `staticcall` or `call` to their fixed addresses. They execute native code rather than EVM bytecode, making them significantly cheaper and faster than equivalent Solidity implementations.

{% hint style="warning" %}
All precompiles expect **raw concatenated bytes** as input, not ABI-encoded data. Use `abi.encodePacked` (not `abi.encode`) when constructing input in Solidity.
{% endhint %}

These are the precompiles Seismic adds:

| Name            | Address                                             | Purpose                                                |
| --------------- | --------------------------------------------------- | ------------------------------------------------------ |
| RNG             | [`0x64`](/reference/precompiles/rng.md)             | Securely generate random bytes inside the TEE          |
| ECDH            | [`0x65`](/reference/precompiles/ecdh.md)            | Derive an AES key from a private key and a public key  |
| AES-GCM Encrypt | [`0x66`](/reference/precompiles/aes-gcm-encrypt.md) | Encrypt data with AES-256-GCM authenticated encryption |
| AES-GCM Decrypt | [`0x67`](/reference/precompiles/aes-gcm-decrypt.md) | Decrypt data with AES-256-GCM authenticated encryption |
| HKDF            | [`0x68`](/reference/precompiles/hkdf.md)            | Derive a 32-byte key from input key material           |
| secp256k1 Sign  | [`0x69`](/reference/precompiles/secp256k1-sign.md)  | Sign a message hash with a secp256k1 private key       |

## Common pattern: Encrypted events

A frequent use of the precompiles is encrypting event data so that only the intended recipient can read it. The typical flow chains ECDH and AES-GCM Encrypt together:

```solidity
// 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);
```

For a complete walkthrough of this pattern, see [Events](/seismic-solidity/events.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.seismic.systems/reference/precompiles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
