Deploying Your EVM Protocol
This guide provides step-by-step instructions on how to deploy your custom EVM protocol.
Prerequisites
Before deployment, ensure you are familiar with payable functions in Solidity and have initiated a Hardhat project.
Package Installation
To streamline development, start by installing the Entangle Labs UIP Contracts NPM package. It includes ready-to-use code and interfaces for deployment.
Deployment Steps
Parameter Explanation
chainID
: The identifier of the destination chain.SelectorLib.encodeDefaultSelector()
: A default selector for theexecute
function in the endpoint contract (this value should remain unchanged).encodedParams
: Encoded parameters such asblockFinalizationOption
andcustomGasLimit
inbyte
format (details on creating these parameters are provided below).destAddress
: The address of the recipient on the destination chain.Payload (
abi.encode(...)
): A combination of the encoded message and message sender inbytes
format. This payload can carry any data inbytes
format.
Configuring Encoded Parameters
The encodedParams
parameter includes transmitter-related settings. These settings currently support two fields:
blockFinalizationOption
: This field, defines the amount of blocks to wait before transmitting the message to UIP. Note that increasing the amount of blocks to wait also inceases the message transmission time. Currently there are several available options, such as:HARD finalization: 0 (DEFAULT) - This option is optimal for common usage.
SOFT finalization: 1 - This option is safer than the HARD option, as the amount of blocks to be passed before the message would be transmit increases.
NO finalization: 2 - Use this option carefully, it sets the amount of blocks to zero.
customGasLimit
: The maximum gas allowed for executing the protocol contract on the destination chain.
To pack these parameters into a “bytes” type variable, use the abi.encodePacked()
function and pass in the TransmitterParams
struct fields. Please refer to the latest implementation of TransmitterParamsLib
for the up-to-date parameter definitions.
Receiver Contract Requirements
The receiving contract must implement the MessageReceiver
interface, which you can find in @entagle-labs/uip-contracts npm package — installed in the Package Installation step — specifically the execute
function:
The execute
function processes the received payload. Note that the Endpoint contract should have access control to this function. Make sure that your contract imports MessageReceiver
and inherits from it, for example:
Notes
Payment: All transactions use the native currency of the chain you're working on. The
msg.value
sent during thepropose
call is considered the combined delivery fee.References: Ensure all configurations adhere to the latest documentation and libraries provided in the
@entangle-labs/uip-contracts
package.
By following these steps, you can successfully deploy your custom EVM protocol across multiple chains. If you encounter issues, refer to the How to Test Your DApp guide or reach out to us through our contact form.
Last updated
Was this helpful?