How to Configure Precompiles in a Custom Maroo Network
A focused guide for developers running private or specialized Maroo-based networks who need to modify the default set of precompiled contracts to add custom features or reduce the network's surface area.
Prerequisites
- Familiarity with the Go programming language.
- Understanding of the Maroo application structure (`app.go`).
- A local Maroo development environment setup.
Locating the Precompile Registration File
All default precompiles are registered in a single location. Navigate to the
precompiles/types/defaults.go file in your Maroo source code directory. You will find the DefaultStaticPrecompiles function, which is the heart of the registration process.Disabling a Precompile
Let's say you are building a private network where on-chain governance is handled externally and you want to disable the
GovPrecompile to save resources and reduce complexity. To do this, simply comment out or delete the line that adds it to the set.// Inside precompiles/types/defaults.go
func DefaultStaticPrecompiles(...) map[common.Address]vm.PrecompiledContract {
precompiles := precompiletypes.NewStaticPrecompiles().
WithPraguePrecompiles().
WithP256Precompile().
WithBech32Precompile().
WithStakingPrecompile(stakingKeeper, bankKeeper, opts...).
WithDistributionPrecompile(distributionKeeper, stakingKeeper, bankKeeper, opts...).
WithICS20Precompile(bankKeeper, stakingKeeper, transferKeeper, channelKeeper).
WithBankPrecompile(bankKeeper, erc20Keeper).
// WithGovPrecompile(govKeeper, bankKeeper, codec, opts...). <-- THIS LINE IS COMMENTED OUT
WithSlashingPrecompile(slashingKeeper, bankKeeper, opts...)
// ... rest of the function
} Warning: Changing the set of precompiles is a consensus-breaking change. This must be done on all nodes before the network's genesis. If done on a live network, it requires a coordinated hard fork.
Rebuilding and Verifying
After modifying the file, you must recompile your Maroo node binary. Use the standard
make install command from the root of the project. Once you start a new chain with this modified binary, the governance precompile address will no longer be active. Calls to it will behave like calls to any regular, non-contract address.