Precompile
A built-in function on a blockchain's virtual machine, implemented in low-level code rather than ordinary smart contract bytecode, for efficiency.
A precompile is a built-in function available directly on a blockchain's virtual machine — implemented in efficient, low-level code rather than ordinary smart contract bytecode (see Kaavon's "Bytecode" glossary definition) — generally used for computationally expensive operations, such as specific cryptographic functions, that would otherwise be impractically costly to run as regular contract code.
Because a precompile runs as native code rather than being interpreted like ordinary contract bytecode, it executes significantly faster and at meaningfully lower gas cost than the equivalent operation implemented as an ordinary smart contract would.
Examples
- A specific elliptic-curve cryptographic operation might be implemented as a precompile specifically because running it as ordinary contract code would be prohibitively expensive in gas.
- A precompile executes as efficient native code, meaningfully faster and cheaper than the equivalent operation implemented as regular smart contract bytecode.