Generate the Precompile
Learn how to generate your precompile.
In the last section, we created the ABI for our precompile contract. Now, we'll use the precompile generation script provided by the precompile-evm template to generate a boilerplate code in go for the precompile implementation that will be wrapped in the solidity interface we created in the previous step.
Running the Generation Script
To start, go to the root directory of your precompile-evm project:
Now generate the files necessary for the precompile.
Now you should have a new directory in your root directory called md5
:
contract.go
For the rest of this chapter, we'll work with the md5/contract.go
file. If you generated the Go files related to your precompile, contract.go
should look like the code below.
Do not be intimidated if much of this code does not make sense to you. We'll cover the different parts and add some code to implement the logic of our MD5 precompile.