Smart contracts
Smart contracts on the Polkadot Products Devnet run on PolkaVM (PVM) through
pallet-revive on Asset Hub. They are PolkaVM bytecode with Solidity-style
ABIs.
Where contracts run
Section titled “Where contracts run”pallet-revive is the smart-contract environment on Asset Hub (para 1000).
DotNS and application contracts run there. The EVM chain id is 420420417, and
contract tooling that speaks Ethereum JSON-RPC (Hardhat, cast, viem) uses the
ETH-RPC endpoint listed in
Networks & endpoints.
Contracts can also read platform state through precompiles at fixed addresses. The personhood precompile returns an account's personhood tier and a per-app alias (see Identity & personhood), and ERC-20-style precompiles let contracts read and transfer supported assets.
An account has to be mapped to its EVM address before it can sign PolkaVM transactions on Asset Hub. An unmapped account fails on its first one.
Calling contracts from an app
Section titled “Calling contracts from an app”At runtime, apps make typed calls with @parity/product-sdk-contracts, which
is part of the Product SDK. You
build a runtime from the Asset Hub chain client, then a contract handle from
the contract's address and ABI. Read-only .query() calls need no account, and
.tx() calls are signed through the host wallet.
ensureContractAccountMapped maps an account for pallet-revive when a call
needs it.
Use platform services from the SDK
shows the code.
Never print or commit signing seeds. Fund an account that sends contract transactions from the network faucet at https://faucet.polkadot.io.
Common blockers
Section titled “Common blockers”- The account is not mapped: map it once with
dotns account map --env devnet, or callensureContractAccountMappedfrom your app. - The account has no funds: get PAS from the faucet.
Learn more
Section titled “Learn more”- pallet-revive: the PolkaVM contract environment
- Use platform services from the SDK: call a contract from your app
- Identity & personhood: the personhood precompile