Room-House.com Russia
  • SkyPirl (Pirl)
    • О SkyPirl
    • Создать кошелек SkyPirl 2.0
    • Как стать номинатором (Stake)
    • Запустить валидатор
    • как вывести средства со стейка
    • Как работает выплата
    • Как проголосовать за Совет
    • Как установить личность
    • косая черта
    • Refund of slashed
    • ХАРАКТЕРИСТИКИ МОНЕТ
    • Правительство и казначейство
    • Telemetry
    • Source Code
  • PIRLmeet
    • О PIRLmeet.com
    • Бесплатная пробная версия
    • CINEMA
    • Microphone On-Off
    • Демонстрация экрана
      • Поделитесь или не делитесь своим аудио
      • Учебное пособие по записи видео + камера + загрузка видео в формате mp4
    • Руки вверх
    • Изменить мелодию звонка при поднятии руки
    • Потоковое видео в формате MP4
    • Потоковое видео mp4 в браузере Firefox
    • Замок шкафа
      • Учетная запись блокировки кабинета
      • Как я могу «запереть шкаф» и не дать посторонним войти в комнату?
      • Как я могу добавить людей в комнату, когда комната заблокирована?
    • Подключить кошелек SkyPirl к PIRLmeet
    • Изменить обложку
    • Название видео
    • Настройка собственного PIRLmeet
    • Как скачать видео на ютуб, фейсбук и конвертировать в мп4 файлы
    • Используйте приложение для улучшения камеры во время прямой трансляции
    • PIRLmeet может организовывать встречи, которые длятся 24/7 и 365 дней в году.
    • Как PIRLmeet защищает продукты?
    • Получите монету Pirl при воспроизведении видео на PIRLmeet
    • Source Code
  • SkyPirl Light Wallet
  • Сообщество SkyPirl
  • Бизнес-парадигма R-H
  • Дорожная карта
  • Команда SkyPirl
  • хТер . Технологии
    • О xTER SafeContainer
    • xTer Экосистема
    • xTer SkyPirl
    • xTer Room-House
      • Как Room-House
    • xTer Room-House Plus
      • Как xTer room-House plus
    • xTer TrueAD
    • xTer SmartFilter
  • Белая бумага
  • Блог
    • Новости
      • ------ Что такое Web 1.0, 2.0, 3.0?------
      • Первый в мире децентрализованный аудиочат Room-House
      • Что такого особенного в децентрализованных аудиочатах?
      • Особенности, которые делают децентрализованные чаты Room-House.com конкурентоспособными с гигантами
      • Вы когда-нибудь слышали о децентрализованном благотворительном фонде?
      • Что такое онлайн-встреча? 4 самых эффективных решения для онлайн-конференций
      • Что такое онлайн-встреча? Легко или сложно организовать?
      • Каков стандарт профессиональной онлайн-комнаты для совещаний?
      • История первого в мире программного обеспечения для онлайн-конференций
      • Децентрализованное приложение Room-House.com (Daap)
      • В каком году родился интернет? И рождение проекта SkyPirl
      • Сотрудничество между Room-House и Российским государственным социальным университетом
    • Технические
      • Что такое биткойн? Как создаются биткойны?
      • Export Your Private Key from Third-Party Wallets
      • Что такое стейблкоин?
      • Что такое обернутый биткойн?
      • 7 способов получения пассивного дохода с помощью криптовалюты
      • Что такое децентрализованная социальная сеть?
      • Сколько биткойнов можно добыть за день?
      • Сколько биткойнов в мире?
      • Что такое децентрализованная биржа? отличается от централизованного этажа?
      • Что такое стейкинг? 5 вещей, которые следует учитывать при инвестировании в стейкинг
      • Что такое блокчейн-мосты?
      • Сравните горячий кошелек и холодный кошелек, какой из них вам следует использовать?
      • Что такое НФТ?
      • Создание децентрализованного интернета в космосе
      • Веб 3.0 Парадокс
      • Споры о будущем Интернета
      • Виртуальная вселенная метавселенной может произвести революцию в Интернете
      • «Блокчейн — самая влиятельная технология со времен Интернета»
      • Web3 - Ожидания от децентрализованного Интернета
      • Что такое дапп? Понятие Dapp и их классификация
      • Как децентрализованные веб-браузеры обеспечивают непревзойденную конфиденциальность
      • Web 3.0 раскручен?
      • Что такое узлы? Типы узлов в блокчейне
      • Блокчейн можно взломать или нет?
      • Что такое закрытый ключ и открытый ключ в биткойнах?
      • Что такое одноразовый номер в блокчейне?
      • Что такое децентрализованный автономный кооператив (DAC)?
      • Что такое Генезис Блок?
      • Что такое Веб3? Объяснение децентрализованного Интернета будущего
  • FAQ?
    • General
      • Getting Started
      • Claims
      • Redenomination of DOT
      • Grants
      • Polkadot Ambassador Programme
      • Research Pages
      • Community
      • Contributing
      • Contributors
      • Glossary
      • Adding accounts to an ENS domain
      • Ledger Application
      • How to Protect Yourself from Scams
      • How to Do Your Own Research
      • Thousand Validators Programme
      • Frequently Asked Questions (FAQs)
      • Miscellaneous
      • Programmes
        • Grants
        • Bug Bounty
        • Substrate Builders Program
        • Thousand Validators Programme
        • Thousand Contributors Programme
    • Learn
      • Basics
        • Token and Assets
          • Assets
          • DOT
          • NFTs
          • Statemint
          • Teleporting Assets
        • Components
          • Architecture
          • Collator
          • Consensus
          • Governance
          • Identity
          • Network Security
          • Nominator
          • Polkadot Host
          • PolkadotJS
          • W3F Registrar
          • Runtime Upgrades
          • Transaction Fees
          • Treasury
          • Validator
        • Staking
          • Staking Concepts
          • Staking FAQ
          • Nomination Pools
        • Account
          • Account Generation
          • Backing up and Restoring Accounts
          • Balance Transfers
      • Advanced
        • Availability and Validity
        • Cross-Consensus Message Format (XCM)
        • Sequential Phragmén Method
        • Proxy Accounts
        • Randomness
        • Simple Payouts
        • SPREE
        • WebAssembly (Wasm)
      • Cryptography
        • Cryptography Explainer
        • Keys
      • Paraobjects
        • Parachains
          • Common Good Parachains
          • Parachain Slots Auction
          • Parachain Crowdloans
          • Teleporting Assets
        • Parathreads
        • Bridges
      • Polkadot Comparisons
        • Polkadot and Kusama
        • Other Comparisons
        • Ethereum 2.0
        • Cosmos
      • Polkadot Lauch Phased
      • Video Tutorials
    • Build
      • Builder's Guides
      • Development Guide
        • Builders Starter's Guide
        • Parachain Development
        • Decentralized Storage Systems
        • Smart Contracts
        • Oracles
        • Data Analytics
        • Wallets
        • Substrate Connect
        • SS58 Registry
        • Opening HRMP Channels
      • Integration Guide
        • Polkadot Integration Guide
        • Polkadot Protocol Information
        • Integration Assets
        • Node Management
        • Node Interaction
        • Transaction Construction and Signing
      • Tool
      • Resources
    • Maintain
      • Network Maintainers
      • Parameters
      • Node Endpoints
      • Node And Dapps
        • Set up a Full Node
        • Networks
        • Set up Secure WebSocket for Remote Connections
        • Resolving Errors
      • Nominated Guides
        • Nominate
        • Unbonding and Rebonding
      • Validator Guides
        • How to run a Validator on Polkadot
        • Validator Payout Overview
        • Using systemd for a Validator Node
        • Secure Validator
        • How to use Polkadot Validator setup
        • Set Up a Validator with NGINX Reverse Proxy
        • How to Upgrade Your Validator
        • Monitor your node
        • How to Chill
        • How to Stop Validating
        • Validator Community Overview
      • Governance Guides
        • Participate in Democracy
        • Join the Council
        • Voting for Councillors
  • Agency policy
    • Information privacy policy
Powered by GitBook
On this page
  • Difference between developing a smart contract and a parachain​
  • Building a Smart Contract​
  • Smart Contract Environments are still Maturing​
  • Keep In Touch​
  1. FAQ?
  2. Build
  3. Development Guide

Smart Contracts

PreviousDecentralized Storage SystemsNextOracles

Last updated 2 years ago

The Polkadot Relay Chain will not natively support smart contracts, however, parachains on Polkadot will support smart contracts.

Difference between developing a smart contract and a parachain

Layer of Abstraction

When you write a smart contract, you are creating the instructions that associate with and deploy on a specific chain address.

In comparison, a runtime module is the entire logic of a chain's state transitions (what's called a state transition function).

Smart contracts must consciously implement upgradability while parachains will have the ability to swap out their code entirely through a root command or via the governance pallet.

When you build a smart contract, it will eventually be deployed to a target chain with its own environment. Parachains allow the developer to declare the environment of their own chain, even allowing others to write smart contracts for it.

Gas Fees

Smart contracts must find a way to limit their own execution, or else full nodes are vulnerable to DOS attacks. An infinite loop in a smart contract, for example, could consume the computational resources of an entire chain, preventing others from using it. The shows that with a powerful enough language, it is impossible to know ahead of time whether or not a program will ever cease execution. Some platforms, such as Bitcoin, get around this constraint by providing a very restricted scripting language. Others, such as Ethereum, "charge" the smart contract "gas" for the rights to execute their code. If a smart contract does get into a state where execution will never halt, it eventually runs out of gas, ceases execution, and any state transition that the smart contract would have made is rolled back. Polkadot uses a weight-fee model and not a gas-metering model.

Parachains can implement arbitrarily powerful programming languages and contain no gas notion for their own native logic. This means that some functionality is easier to implement for the developer, but some constructs, such as a loop without a terminating condition, should never be implemented. Leaving certain logic, such as complex loops that could run indefinitely, to a non-smart contract layer, or even trying to eliminate it, will often be a wiser choice. Parachains try to be proactive, while smart contract platforms are event-driven.

Building a Smart Contract

The Polkadot relay chain itself will not support smart contracts. However, since the parachains that connect to Polkadot can support arbitrary state transitions, they can support smart contracts.

Substrate presently supports smart contracts out-of-the-box in two ways:

  • The EVM pallet offered by .

  • The in the FRAME library for Wasm-based contracts.

Here is the list of current resources available to developers who want to get started writing smart contracts to deploy on parachains based on Substrate.

The experience of deploying to an EVM-based chain may be more familiar to developers that have written smart contracts before. However, the Contracts pallet makes some notable improvements to the design of the EVM:

  1. Rent. Contracts must pay rent or else hold a deposit suitably large enough in order to justify its existence on-chain. When a contract does not uphold this, it may create what's called a tombstone which is a reference to the contract. In some conditions, the contract will be deleted outright along with its storage if it does not maintain these requirements.

  2. Caching. Contracts are cached by default and therefore means they only need to be deployed once and afterward be instantiated as many times as you want. This helps to keep the storage load on the chain down to the minimum. On top of this, when a contract is no longer being used and the existential deposit is drained, the code will be erased from storage (known as reaping).

pallet_contracts was initially designed to combat unbounded state growth by charging contracts for the state they consume but has since been deprecated.

Web3 Foundation supports proposals for Polkadot that define a set standards to fit ecosystem needs. These standards go through several acceptance phases, where the engagement of the whole community is needed to build valuable and future-proof standards. All the teams who will benefit from a standard need to agree on its content.

Some of these PSPs are targeting Substrate's contracts pallet:

ink! has laid much of the groundwork for a new smart contract stack that is based on a Wasm virtual machine and compatible with Substrate chains.

Collected below are some community examples of smart contracts in ink!. Are you working on a smart contract example? Ask us to add it to this page!

It is still early for smart contracts on Polkadot and the development is only now stabilizing. We are actively producing content to help developers get up to speed and will maintain the Wiki with the latest resources. You should also keep up to date with the following links:

Even though the tooling is still maturing, the advantage of being early will be the familiarity and head start on your project, allowing you to innovate and create something truly new.

All the best.

Frontier EVM Contracts

is the suite of tools that enables a Substrate chain to run Ethereum contacts (EVM) natively with the same API/RPC interface, Ethereum exposes on Substrate. Ethereum Addresses can also be mapped directly to and from Substrate's SS58 scheme from existing accounts.

Substrate Contracts

Substrate offers a built-in ; as time goes on, more parachains will support smart contracts. Additionally, there is the , which allows a parachain to implement the Ethereum Virtual Machine, thereby supporting almost direct ports of Ethereum contracts.

A video version of the recap of the smart contract situation is available on the .

Resources

? This post answers the question more technically of when a developer might choose to develop a runtime versus a smart contract.

- Parity's ink to write smart contracts.

- Walks you through the basics of writing and deploying an ERC-20 token using ink!.

Contracts Pallet

Wasm. The Contracts pallet uses WebAssembly as its compilation target. Any language that compiles to Wasm can potentially be used to write smart contracts. Nevertheless, it is better to have a dedicated domain-specific language, and for that reason Parity offers the language.

Storage Rent: Deprecated

See the associated for more details.

Polkadot Standards Proposals (PSPs)

Please visit for more information.

Ink

is a domain specific language for writing smart contracts in Rust and compiles to Wasm code. As it states in its README, it is still in an experimental phase so brave developers should be aware that they might have a bumpy - but workable - development experience. There are some projects that have built projects in ink! with a decent level of complexity such as Plasm's , so it is mature enough to start building interesting things.

For interested developers, they can get started writing smart contracts using ink! by studying the that were already written. These can be used as guideposts to writing more complex logic that will be deployable on smart contract parachains.

Libraries for Smart Contracts in ink!

: an ink! library providing standard contracts based on with useful contracts and macros for building.

: a Wasm contract standard library, developed by .

Smart Contract Environments are still Maturing

Parity Tech

Parachains

Many smart contract platforms are building to become a parachain in the ecosystem. A community created and maintained list of different smart contract platforms building on Polkadot can be found at .

Moonbeam

is another project that is planning to deploy to Polkadot as a parachain and will support Ethereum compatible smart contracts. Since Moonbeam uses , an interoperability layer with existing Ethereum tooling, it will support all applications that are written to target the EVM environment with little friction.

, a companion network to Moonbeam, launched as a parachain on Kusama. Parachain functionality is live, and features are being incrementally released. The final phase of the launch will include EVM functionality and balance transfers.

Try deploying a smart contract to Moonbeam by following their .

Astar

(formerly Plasm) is built on Substrate as a smart contract platform and intends to integrate with Polkadot as a parachain. is the sister network to Astar, is currently live on Kusama, and supports EVM, WASM, and Layer 2 solutions. Astar aims to house all layer 2 scaling solutions and support all layer 2 protocols through the (Optimistic Virtual Machine).

Try deploying an Ethereum or ink! smart contract by following their .

Acala

is a decentralized finance consortium and DeFi infrastructure chain delivering a set of protocols to serve as the DeFi hub on Polkadot. , Acala's canary network is live as a parachain on Kusama. Interested teams are now able to deploy DApps and smart contracts on Karura's platform. Acala is also implementing the .

Try deploying an Acala EVM smart contract by following their .

Phala

is a privacy-preserving cloud compute platform and aims to provide strong guarantees of confidentiality as a cross-chain platform. As a smart contract platform, Phala will enable the use of confidential smart contracts on Polkadot. is Phala's canary network and is live as a parachain on Kusama.

Try deploying a confidential smart contract by following their .

Keep In Touch

If you have interesting ideas for smart contracts on Polkadot, feel free to drop into the to talk about them. Developers may be interested in joining the or to ask their questions. As always, keep up to date with Polkadot and Kusama by following the .

​
​
​
halting problem
​
Frontier
Contracts pallet
​
Frontier
​
contract pallet
WebAssembly
EVM Pallet
Polkadot YouTube channel
​
When should I build a Substrate runtime versus a Substrate smart contract
ink!
Substrate ink! Workshop
​
ink!
​
pull request
​
PSP22 - Fungible Token Standard
Polkadot Standards Proposals (PSPs) Github
​
ink!
Plasma contracts
examples
​
OpenBrush
PSP
Metis
Patract Labs
​
​
ink!
Substrate contracts pallet
​
Moonbeam
Astar
Acala
Phala
PolkaProjects
​
Moonbeam
Frontier
Moonriver
documentation
​
Astar
Shiden
OVM
documentation
​
Acala
Karura
Acala EVM
documentation
​
Phala
Khala
documentation
​
Polkadot Watercooler
Polkadot Beginners Lounge
Substrate Technical
social channels