Introduction
In this tutorial, we’ll walk through deploying a smart contract written in ink! (Rust-based smart contract language) using the use.ink UI playground. We’ll also set up and connect our wallet using the Polkadot.js extension to sign transactions and deploy the contract to a test network.
You can check out my article on deploying smart contracts locally here.
Prerequisites
Before we start, make sure you have:
- Rust installed since we will compile locally.
- A modern browser (I’ll be using Firefox).
- The Polkadot.js extension installed.
- Some test tokens (usually on a testnet) Claim here.
Setting Up Polkadot.js Extension
- Install the extension Download it from Mozilla Add-ons or Chrome Web Store.
-
- Open the extension.
- Click “+” to create a new account.
- Save your seed phrase securely (very important!).
- Give your account a recognizable name.
Get test tokens
Depending on which network you're deploying to (e.g., PassetHub), you might need some test tokens. You can request them from a faucet.
Verify connection
Visit Polkadot.js Apps to make sure your account shows up.
Writing or Uploading Your Contract on use.ink
Visit use.ink playground:
You can interact with your smart contract after following through the steps and instantiating.
Final results:
Troubleshooting
1. AccountUnmapped
Example error:
AccountUnmapped
An `AccountID32` account tried to interact with the pallet without having a mapping.Call [`Pallet::map_account`] in order to create a mapping for the account.
Mapping simply means linking your wallet account to the on-chain account system so it can interact with smart contracts and pallets properly. It does not create a new address — it just registers it on-chain.
Solution
- Visit the polkadot developer page here.
- Change the network on the far left!
Change to
test paseo
and choosePassetHub- contracts : via IBP1
.
Go to
Developer
section, thenIntrinsics
. - In thesubmit the following extrinsic
field, selectrevive
andmapAccount()
as appropriate and submit.
2. Polkadot extension doesn't connect on the Polkadot site or use.ink site
The wallet extension is not connecting by default, no worries!
Solution
- Access the polkadot extension.
- Click on
Connect Accounts
and confirm in the popup. - Refresh the page.
Conclusion
Deploying ink! smart contracts using use.ink and Polkadot.js is now easier than ever. By following these steps, you can quickly upload, deploy, and interact with your contracts on a test network.
Always remember to use test tokens first, and verify your wallet connection to avoid common errors like AccountUnmapped
.
Top comments (3)
Nice work 👍
thank you Christine! hoping the guide was helpful and you were able to deploy your smart contract
The guide was soo helpful. I am in the process of deploying my smartcontract