ink! Tutorial:

Creating an ink! Project

What will you learn taking this tutorial?

How to use the ink! CLI to generate an initial smart contract with some scaffolding code.

Start, build and test your smart contract!

ink! is an Embedded Domain Specific Language (EDSL) that you can use to write WebAssembly based smart contracts in the Rust programming language.

ink! is just standard Rust in a well defined "contract format" with specialized #[ink(…)] attribute macros. These attribute macros tell ink! what the different parts of your Rust smart contract represent, and ultimately allow ink! to do all the magic needed to create Substrate compatible Wasm bytecode!

Use the ink! CLI to generate an initial smart contract with some scaffolding code.

Make sure you are in your working directory, and then run:

Deploy and interact with your smart contract!

ink! is an Embedded Domain Specific Language (EDSL) that you can use to write WebAssembly based smart contracts in the Rust programming language.

ink! is just standard Rust in a well defined "contract format" with specialized #[ink(…)] attribute macros. These attribute macros tell ink! what the different parts of your Rust smart contract represent, and ultimately allow ink! to do all the magic needed to create Substrate compatible Wasm bytecode!

Use the ink! CLI to generate an initial smart contract with some scaffolding code.

Make sure you are in your working directory, and then run:

Frontend development 101

Overview

Now after you wrote, compiled and deployed your smart contract, it is time to craft a user experience around it. While this can take many forms, web apps dominate Web3 today.

JavaScript, as the web's native language, offers the best tools for building these experiences, especially for smart contract interaction. Here, we focus on TypeScript-powered tools that provide both JavaScript flexibility and type safety.

JavaScript/TypeScript Tools

There are several levels of abstraction where you can start your journey creating a web frontend for your contracts. Each levels offers different advantages and disadvantages. The following list is of tools. They are sorted from the most generic no third party library way to interact with Polkadot's smart contracts to the most opinionated template using libraries and proven frontend frameworks.

React

useInkathon is recommended ✅ — a hooks library for the popular frontend javascript framework React with focus on smart-contract interactions. Built using @polkadot/api & @polkadot/api-contract.

React and Next.js

inkathon is recommended ✅ — a full stack web app template using the popular full stack template Nextjs. Itself is using useInkathon. The fastest way to get up and running with a smart contract and a corresponding web app.

Low level libraries

@polkadot/api-contract is recommended ✅ — abstraction on top of @polkadot/api for the pallet-contracts. Makes interaction with smart contracts more comfortable and type safe.


@polkadot/api is not recommended ❌ — allows for most general interaction with Polkadot-SDK based blockchains from JavaScript. In order to talk to smart-contracts, one would use the pallet-contracts runtime calls.

Using no libraries

RPC Interface is not recommended ❌— nodes participating in the blockchain network offer an JSON RPC interface to interact with the blockchains state and capabilities.

Other Languages

Of course the browser and JavaScript should not be the one and only platform for smart contract frontends. It's just the most mature for smart contract frontend tooling.

The following is a list of libraries which could be used to craft smart-contract dApps on other platforms than the web.

Have questions not covered here?

Get In Touch

© use.ink 2025. All rights reserved.