Getting Started
Deploy your first smart contract on Polkadot Hub using Relaycode
Getting Started
Deploy a Solidity smart contract to Polkadot Hub in under 5 minutes.
Prerequisites
- A Polkadot wallet extension (Talisman, SubWallet, or Polkadot.js)
- Testnet tokens from the Polkadot Faucet
Step 1: Connect and Switch Chain
- Open Relaycode and connect your wallet
- Switch to Westend Asset Hub (testnet) using the chain selector
- Ensure you have testnet WND tokens for gas fees
Step 2: Select the Revive Pallet
- In the extrinsic builder, select Revive as the section
- Select instantiate_with_code as the method
- The
codeanddatafields will show the smart contract editor
Step 3: Write Your Contract
The editor comes with a default template. You can modify it or write your own:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract Flipper {
bool public value;
constructor(bool _value) {
value = _value;
}
function flip() public {
value = !value;
}
}Step 4: Compile
- Select your compilation target: EVM or PVM
- Click Compile
- The compiler resolves imports automatically and produces bytecode
- If compilation succeeds, the bytecode is automatically filled into the
codeparameter
Step 5: Set Constructor Arguments
The data field renders typed inputs based on your contract's constructor:
- For the Flipper example: a boolean toggle for
_value - Arguments are automatically ABI-encoded
Step 6: Configure and Submit
- Set value to
0(unless your constructor is payable) - Set weight_limit — use
{ ref_time: 500000000000, proof_size: 500000 }as a starting point - Set storage_deposit_limit —
10000000000(10 WND) is usually sufficient for small contracts - Leave salt as
Nonefor default address derivation, or provide a 32-byte salt for deterministic addresses - Click Sign and Submit
Step 7: Verify
After the transaction is included in a block, your contract is deployed. You can verify it on the Westend Asset Hub explorer.
Using Upload Mode
If you compiled your contract externally (Remix, Hardhat, Foundry):
- Switch the
codefield to Upload mode - Upload your bytecode file (
.binor.hex) - Optionally upload the ABI (
.json) to enable the constructor args form - The
datafield will show typed inputs if an ABI is provided