Performing transactions in a subnet

The below is a tutorial on how to issue a transaction from a wallet in a subnet.

Connecting to a subnet

Assuming the process of launching a custom IPC Subnet with at least one validator node is complete, the custom IPC Subnet is now available for a user (defined here as a wallet on the subnet that is does not necessarily represent a validator) to perform transactions.

  • A user would begin by launching Metamask, and manually adding the custom IPC Network to their Metamask networks list using “Add a network manually.”

  • Name the network, include the local New RPC URL and relevant ChainID (both of which are provided when you successfully launch the validator node), and name the currency symbol (for Filecoin subnets, tFIL is used).

  • Once, the network is added successfully, "Switch to IPC Local Subnet," or whatever you named your subnet.

  • Now, an account on this custom IPC Subnet can be imported to MetaMask. Select “+ Add account or hardware wallet.”

  • Select "Import account".

  • Enter the private key for the account, which is generated when establishing the subnet, and select “import.”

Note: The private key can be retrieved on the command line by the user that deployed the subnet using the following command:

ipc % cat ~/.ipc/validator_1.sk

The user now has a wallet address available for transactions in the custom IPC subnet.

Deploying Smart Contracts in a Subnet

Consider the deployment of a simple smart contract that issues ERC20 tokens in the IPC subnet --these tokens will be acquired by a user's IPC subnet MetaMask wallet. The steps for achieving this are as follows:

  • Open Remix and a simple contract .sol file for issuing ERC20 tokens.

  • For the environment, connect the IPC Subnet using the “Injected provider - Metamask” custom network. Connect the relevant account on the IPC Subnet.

  • Select the relevant account and set the gas limit.

  • Compile and deploy the contract. Mint new tokens by specifying the address you want the tokens to go to, and the number of tokens you wish to mint. Click “Transact.”

  • Copy the token address and import the token to the MetaMask wallet on the custom IPC subnet.

  • The funds of the new token should be displayed, indicating a successful transaction was performed on the IPC subnet.

Block Explorers

Currently, browsing a custom subnet using a block explorer is not possible. However, a block explorer that can browse custom subnets should be released soon.

Last updated