inkathoninkathon

Add a Custom Network

Integrate new Polkadot chains into your inkathon project

Prerequisites

  • Working inkathon project
  • Set up environment for contract development
  • Access to the network's RPC endpoint
  • Account with funds on the target network (for deployments)

ink! v6 Support

Make sure the respective network supports pallet-revive which is mandatory to support ink! v6 contracts. Find currently supported networks in the use.ink documentation.

Step-by-Step Guide

Generate Type Definitions

Generate type definitions for the new network using Papi:

# From the contracts directory
cd contracts

# Add the network (replace with your network details)
bunx papi add -w <network-wss-endpoint> <network-name>

# Example for Pop Network
bunx papi add -w wss://rpc1.paseo.popnetwork.xyz pop

This creates type definitions in contracts/.papi/descriptors/ that enable type-safe interactions.

Deploy Contracts

Now you can deploy the contract to your new network:

CHAIN=<network-name> bun run deploy

Deployer Account

By default, the deployer account is //Alice who is pre-funded on local nodes. You can overwrite this by either passing an ACCOUNT_URI variable or defining an .env.<chain> file (see environment).

Configure Frontend

Update the frontend to connect to your new network and import the freshly deployed contract:

frontend/src/lib/reactive-dot/config.ts
import { newChain } from '@polkadot-api/descriptors'
// …

export const config = defineConfig({
  chains: {
    pop: {
      descriptor: pop,
      provider: getWsProvider('wss://rpc1.paseo.popnetwork.xyz'),
    },
    passethub: {
      descriptor: passethub,
      provider: getWsProvider('wss://testnet-passet-hub.polkadot.io'),
    },
    newChain: {
      descriptor: newChain,
      provider: getWsProvider('TODO'),
    },
  },
  // …
})
frontend/src/lib/inkathon/deployments.ts
import * as flipperNewChain from 'contracts/deployments/flipper/newChain'
// …

export const flipper = {
  contract: contracts.flipper,
  evmAddresses: {
    pop: flipperPop.evmAddress,
    passethub: flipperPassethub.evmAddress,
    newChain: flipperNewChain.evmAddress,
  },
  ss58Addresses: {
    pop: flipperPop.ss58Address,
    passethub: flipperPassethub.ss58Address,
    newChain: flipperNewChain.ss58Address,
  },
}

Learn More