Substrate Developer Hub

Substrate Developer Hub

  • Tutorials
  • Knowledge Base
  • Recipes
  • API Reference
  • Languages iconEnglish
    • 简体中文
    • 繁體中文
    • Help Translate

›Smart Contracts

Getting Started

  • Overview
  • Installation
  • Getting Started on Windows
  • Glossary

Learn Substrate

  • Extrinsics
  • Transaction Pool
  • Account Abstractions
  • Session Keys
  • Transaction Weight
  • Off-Chain Features

Runtime

  • Runtime Overview
  • Runtime Primitives
  • FRAME
  • Pallets
  • Runtime Macros
  • Runtime Metadata
  • Runtime Storage
  • Runtime Origin
  • Runtime Execution
  • Runtime Events
  • Runtime Errors
  • Transaction Fees
  • Off-Chain Workers
  • Debugging
  • Runtime Tests
  • On-Chain Randomness
  • Runtime Upgrades

Smart Contracts

  • Overview
  • ink! Smart Contracts
  • ink! Concepts
  • ink! Development
  • EVM Pallet
  • ink! F.A.Q.

Integrate

  • Polkadot-JS
  • Client Libraries
  • Chain Specification
  • The Subkey Tool
  • Memory Profiling

Advanced

  • SCALE Codec
  • Consensus
  • The Block Import Pipeline
  • Executor
  • Cryptography
  • Storage
  • SS58 Address Format

Contribute

  • Help Translate
Edit

ink! Development

ink! is a Rust-based embedded domain specific language (eDSL) for writing WebAssembly smart contracts specifically for the FRAME Contracts pallet.

ink! is still under development, so the documentation for using it is sparse. However, on this page you will find the best resources to get you started building ink! contracts right away.

Tutorials

The ink! project maintains an up-to-date tutorial teaching all the basics of developing on ink!.

This is the best way to get start learning the language today.

Start the ink! tutorial!

You will learn how to:

  • Set up your computer to build and deploy ink! smart contracts.
  • Learn the basics of ink! by creating an incrementer contract.
  • Learn more advance tricks by developing an ERC20 contract.

Example Contracts

ink! provides a set of example smart contracts that can help you understand how it is similar and different to other smart contract languages.

This includes:

  • A Flipper Contract
  • An ERC20 Contract
  • An ERC721 Contract
  • A Delegator Contract

FAQ

Here are some answers to frequently asked questions developers have while building on ink!.

What is the difference between memory and storage?

In ink!, memory refers to computer memory, while storage refers to the on-chain storage used by a contract instance. memory is temporary and only lasts until the contract execution is done, while storage is persistent and lasts over many contract executions. The contract storage is built on top of the runtime storage, and access is considered to be slow.

How do I run tests?

When building a smart contract with ink!, you can define a set of tests.

For example, in the minimal flipper contract, you can find a small test at the bottom of the contract.

You should run this test just like you would any other Rust test:

cargo +nightly test

Get Help

Join the growing community of ink! smart contract developers:

  • Ask development questions on StackOverflow with the ink tag.
  • Join the live chat in the Smart Contracts & Parity ink! on Riot.
  • Report bugs, make feature requests, and ask technical questions on the ink! GitHub.

Next Steps

Learn More

  • Learn more about the design philosophy of ink! in our conceptual documentation.
  • Learn more about the Contracts pallet.

Examples

  • Follow a tutorial to add this Contracts pallet to your Substrate runtime.

References

  • Visit the ink! repository for additional docs and to look at the source.
  • Visit the ink! developer homepage
  • Visit the reference docs for the ink! metadata.
  • Visit the reference docs for the core ink! language.
Last updated on 10/31/2020 by Dan Forbes
← ink! ConceptsEVM Pallet →
  • Tutorials
  • Example Contracts
  • FAQ
    • What is the difference between memory and storage?
    • How do I run tests?
  • Get Help
  • Next Steps
    • Learn More
    • Examples
    • References
Substrate Developer Hub
Developer Hub
TutorialsKnowledge BaseRecipesAPI Reference
Community
Community HomeNewsletterSubstrate Technical ChatSubstrate SeminarStack OverflowTwitterEvents
More
Substrate Builders ProgramBlogSubstrate GitHubDeveloper Hub GitHubPrivacy PolicyTerms of UseCookie Settings
Copyright © 2021 Parity Technologies