EVM Codes - Precompiled Contracts
On top of having a set of opcodes to choose from, the EVM also offers a set of more advanced functionalities through precompiled contracts. These are a special kind of contracts that are bundled with the EVM at fixed addresses, and can be called with a determined gas cost. The addresses start from 1, and increment for each contract. New hardforks may introduce new precompiled contracts. They are called from the opcodes like regular contracts, with instructions like CALL. The gas cost mentioned here is purely the cost of the contract, and does not consider the cost of the call itself nor the instructions to put the parameters in memory. The precompiled contracts are also available in the playground. For all precompiled contracts, if the input is shorter than expected, it is assumed to be virtually padded with zeros at the end. If the input is longer than expected, surplus bytes at the end are ignored. After the hardfork Berlin, all the precompiled contracts addresses are always consider
Precompiled Contracts Introduction On top of having a set of opcodes to choose from, the EVM also offers a set of more advanced functionalities through precompiled contracts. These are a special kind of contracts that are bundled with the EVM at fixed addresses, and can be called with a determined gas cost. Early precompiled contracts use sequential addresses starting from 1, while new hardforks may introduce precompiled contracts at non-contiguous addresses. They are called from the opcodes like regular contracts, with instructions like CALL. The gas cost mentioned here is purely the cost…
saved by
related reading
- revm/documentation/src/crates/precompile.md at b7b92aee232558ea48e9580bfac74d442a17babd · bluealloy/revmgithub.com
- How to add a custom precompile contractgithub.com
- solidity - Are there any examples of using precompiled contracts? - Ethereum Stack Exchangeethereum.stackexchange.com
- EVM Codes - Opcodesevm.codes
- Blake2b F precompile by pdyraga · Pull Request #4 · keep-network/go-ethereumgithub.com
- REVM Is All You Need. How to build simulated blockchain… | by Solid Quant | Mediummedium.com
- solidity - How to use Ethereum precompile bn256Pairing to check equality on symmetric groups? - Ethereum Stack Exchangeethereum.stackexchange.com
- Contract ABI Specification — Solidity 0.8.38-develop documentationdocs.soliditylang.org
- go-ethereum/core/vm/contracts.go at bd6879ac518431174a490ba42f7e6e822dcb3ee1 · ethereum/go-ethereum · GitHubgithub.com
- Introduction to Smart Contracts — Solidity 0.8.38-develop documentationdocs.soliditylang.org
- GitHub - foundry-rs/forge-std: A collection of helpful contracts and libraries for use with Forge and Foundrygithub.com
- The Ethereum Virtual Machine — How does it work? | by Luit | MyCrypto | Mediummedium.com