Why PSP22 Is Important to The Polkadot Ecosystem
Learn more about the first Polkadot standard, PSP22, developed by Supercolony, and its benefit to the whole Polkadot ecosystem.
Join the DZone community and get the full member experience.
Join For FreeStandards are critical to the successful development of emerging technologies, and Polkadot is no exception. It's important because the proper standard set at the right time can help improve interoperability and build trust within the technology ecosystem (opening the doors to mass adoption).
Benchmarks like these are crucial to enable token-based smart contracts that interact with each other. Without a standard, anyone can develop and deploy their own smart contract. The problem with this approach is that they would have to expose the same function signature to enable true interoperability.
This led to the Ethereum Improvement Proposals (EIPs) and, of course, Ethereum Request for Comments (ERC). It snowballed pretty quickly, and we saw the emergence of different types of standards, contracts, and protocols on the Ethereum network. For example, fungible, non-fungible, multi-tokens, and token contracts like ERC-20, ERC-721, ERC-777, and ERC-1155.
The most popular standard probably is ERC-20, a protocol used to issue tokens with 20 unique identification numbers that differentiate it from others. The development of ERC-20 helped ease the integration of wallets and decentralized exchanges as they could trust the standardized signature of the function they were calling.
Today, we use the ERC-20 token to create and distribute smart contracts on the Ethereum blockchain. We can also use smart contracts to create tokenized assets (for people to invest in) or build smart properties.
What Is PSP22?
Polkadot Standards Proposal 22 (PSP22) is an ERC-20 standard for the WASM part of the Polkadot ecosystem. It's essentially a standard for a fungible token interface for WASM smart contracts that run on Substrate's contracts pallet. Think of it this way: what ERC-20 is to Ethereum, PSP22 is to Polkadot.
For stack-based virtual machines, WASM or WebAssembly is a binary instruction format. Designed as a portable compilation target for high-level programming languages like C++ and Rust, WASM allows the web deployment of client and server applications.
According to Markian Ivanichok, co-founder and CEO of Supercolony, “The primary objective in developing PSP22 was defining a standard fungible token interface for WASM smart contracts like EIP-20 for the Ethereum ecosystem. We started working on PSP22 to overcome the challenges related to interoperability and drive innovation.”
As such, PSP22 was passed and adopted by the whole Polkadot community and Web3 Foundation Team as the first accepted standard in the Polkadot ecosystem.
Why Does It Matter?
Without standards like PSP22, each contract would have a different signature, making interoperability impossible. By defining an interface that shares the same contract Application Binary Interface (ABI) between all implementations, PSP22 resolves this problem.
Now, you can leverage the standard contract interface to allow tokens on Polkadot or Kusama to be implemented and re-used by other applications (for example, from wallets to decentralized exchanges).
“We needed a different standard from ERC-20 because of WASM smart contracts. It was also necessary as there's a difference between an EVM (Ethereum Virtual Machine) and the smart contract pallet in Substrate. In this scenario, PSP22 has specific rules and methods that differentiate it from ERC-20 in its implementation,” Ivanichok added.
PSP22 also defines an extensive list of methods in the interface and comprises increase_allowance and decrease_allowance, which is lacking in ERC-20. The standard also defines metadata fields as part of a separate interface. PSP22 also differs from ERC-20 because of the before_received method that's called at the end of the transfer if the recipient is a contract. The PSP22Receiver interface also sets it apart from ERC-20.
As the PSP22 standard is at an ABI level, the Substrate's contracts pallet can execute any WASM smart contract that implements its defined API. What’s more, PSP22 will not be restricted to Rust or ink! languages, and you will be able to implement it through any framework or language that compiles to WASM. For example, OpenBrush, a library for smart contract development, is a crucial implementation that’s coded in ink!.
PSP22 emerged at a critical time as parachains with WASM smart contract capabilities came out in Polkadot's Parachain Auctions. It's important because PSP22 targets every parachain that integrates with pallet contracts to enable WASM smart contracts. The standard also went through many acceptance phases and was supported by the entire Polkadot community, who also agreed to the necessity for such measures.
What Does the Future Hold for PSP22?
As we advance, PSP22 will have an impact at the parachain level and enable true interoperability. In a multi-chain future, PSP22 helps secure the interoperability of all token standards (present and future) between various parachains and other substrate-based chains.
PSP22 will also be at the heart of implementing exhaustive logic through a predefined interface for specific token standards. This approach will empower development teams and their high-performing secure implementations.
Ivanichok believes that PSP22 is just the beginning. “We expect many more standards to emerge as the ecosystem evolves and scales. As such, we at Supercolony will continue to contribute to the innovation and evolution of the protocol.”
Opinions expressed by DZone contributors are their own.
Comments