4

Based on the answers to this other question, I understand that there isn't a standard programming language in which precompiles are written in.

The standard EVM precompiles are implemented in the programming language in which the client software is written in, e.g. for go-ethereum and revm.

But what about precompiles used in rollups and sidechains? I saw some projects with precompiles written in Yul, e.g. zkSync's bootloader, and other projects using Solidity directly, e.g. Hedera's HederaTokenService.

If precompiles can indeed be written in Solidity/ Yul, how do node clients use these contracts in practice? Is the bytecode hardcoded into the client somewhere?

Or is it that both zkSync and Hedera provide a native implementation (e.g. in Rust) of their precompiles, but provide these Solidity/Yul as syntactic sugar for their users?

1
  • Not sure, but my hunch is that this is related to ZkSync being a ZK-rollup. EVM is sort of a layer on top of ZK. A bit like Solidity is a layer on top of EVM. So perhaps ZkSync precompiles can be written in Solidity because Solidity is one step deeper in the stack. Commented Apr 17 at 14:06

1 Answer 1

2

Solidity precompiled contracts are similar to regular contracts, with one key difference: they are not deployed but instead created through the genesis JSON file at the launch of a blockchain. As such, their address, bytecode, and storage can be freely configured. For example: Consensys Permissioning Smart Contracts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.