IPC subnets have the same exact support for the deployment of EVM contracts as the Filecoin network. We highly recommend refering to the following docs for a detailed description of FEVM and the steps and tooling to use EVM in Filecoin. In this section, we will present the additional steps required to follow the docs in a subnet.
In order to connect the Ethereum tooling to your subnet, you'll need to get the RPC endpoint of your subnet peer and the subnet's chainID
. For this, you can use the following command from your IPC agent to retrieve the RPC endpoint for a specific subnet:
./bin/ipc-agent subnet rpc --subnet <subnet-id>
# Sample command
$ ./bin/ipc-agent subnet rpc --subnet /r31415926/t2xwzbdu7z5sam6hc57xxwkctciuaz7oe5omipwbq
rpc: http://127.0.0.1:1240/rpc/v1
chainID: 31415926
To connect Metamask to your subnet, you need to add it as a new network. To do this you need to:
- Click
Add network
in networks section of Metamask.
- Add a network manually
- Configure your network by passing to the form the RPC endpoint and
chainID
of your subnet. ThechainID
of IPC subnets will always be31415926
until this issue is implemented.
With this your Metamask should be successfully connected to your subnet, and you should be able to interact with it seamlessly as described in the Filecoin docs.
To deploy a smart contract in your subnet the only pre-requirement is to have some funds in the subnet to pay for the gas. To inject funds in your subnet you can follow the steps described here.
It is important to note that the IPC agent doesn't understand Ethereum addresses directly, which means that to send funds to an Ethereum address, you will need to send funds to their underlying f4 address. You can use the following command from the IPC agent to get the f4 address for an Ethereum address:
./bin/ipc-agent util eth-to-f4-addr --addr <eth-adddress>
$ ./bin/ipc-agent util eth-to-f4-addr --addr 0x6BE1Ccf648c74800380d0520D797a170c808b624
t410fnpq4z5siy5eaaoanauqnpf5bodearnren5fxyoi
💡 For more information about the relationship between
f4
and Ethereum addresses refer to this page.
From there on, you should be able to follow the same steps currently used to deploy EVM contract in the Filecoin mainnet. You can find here the steps to deploy an ERC20 contract using Remix.