There are multiple ways to build projects that share the security and interoperability features of the Polkadot relay chain. However, developers may sometimes run into a dilemma as to which path to take in implementing their ideas.
To benefit (directly or indirectly) from the Polkadot relay chain, there are three ways in which projects can be implemented. This could be via;
- Parachains,
- Parathreads,
- Or smart contracts
Each of these paths has use cases for which they are more suitable, and those for which they are not.
In this article, I’ll explore each of these paths and talk about which may be better for your project.
What are parachains
Parachains are blockchain implementations connected to Polkadot (or Kusama) relay chain, which benefit from the security and interoperability features of the relay chain, but has the autonomy and flexibility to perform every other thing a blockchain can do (Consensus mechanisms, governance rule, runtime upgrades, etc).
Essentially, a Parachain is a full-fledge blockchain, but with the added advantage of not having to worry about securing the blockchain, as well as being interoperable with other Parachains (thanks to the relay network) and outside chains (via bridges).
New Parachains are connected to Polkadot or Kusama by participating in (and winning) auctions. Winners are then given slots for a certain lease period, after which they have to renew their slots. you can find out more here.
Pros
- Developers are in full control of the kind of logic they want to implement in the runtime. they’re able to work on a low level, which gives them the flexibility to make designs tailored to specific use cases, without the restrictions that smart contracts have.
- Parachains can undergo forkless upgrades. Nodes need not decide on which network to support after a network/protocol upgrade, because there would be no fork anyway.
- Parachains are way more scalable than smart contracts because of the low-level customization and flexibility that they offer
Cons
- Because you’ll have to write a lot of low-level logic by yourself, it takes a much longer time to develop a para chain than it takes for smart contracts.
- Parachains are harder and more tedious to deploy than smart contracts.
- Parachains are harder to maintain over time, because a lot of low-level code needs to be reviewed.
- Because developers have direct access to the runtime. there are lesser restrictions. These restrictions usually serve as a security measure when developing smart contracts. The absence of these restrictions in developing parachains could predispose them to some bugs which may be impossible to run into when developing smart contracts.
What types of projects are parachains suitable for
Parachains are more suitable for projects that’ll serve a very large user-base, will require complex logic, have enough resources and support or require their own custom economics. these projects could be,
- Financial blockchains
- blockchain bridges
- large DAO blockchains
- Decentralized market places (that need to be built to scale)
- Decentralized exchanges
What are parathreads
Parathreads are very similar to Parachains, except that, unlike Parachains, they produce blocks on a pay-as-you-go basis. this prevents wastage of resources, as threads will only pay for blocks when they actually need to create one.
Unlike Parachains in which slots are allocated via auctions, Parathreads have to pay a one-time fee in order to connect to the relay chain. A certain percentage of available slots are dedicated to all Parathreads. Because of limited resources available for Parathreads, they’ll have to compete with each other in the production of blocks. So, if there’s a backlog of transactions in a thread that needs to be added to blocks, the transactions have to wait in line until a thread can make a block.
The pros and cons of parathreads are basically similar to that of parachains, except that parathreads will be at a disadvantage of becoming congested as transactions pile up (since not all parathreads will have the chance to make a block at a point in time). In some situations, this may lead to delays in transaction confirmation.
What are parathreads suitable for?
Parathreads are better suited for blockchains who do not have enough support yet to participate in parachain auctions, have been dropped from auctions, or want to test their projects before opting in for parachain slots, but still want to benefit from the features of a parachain.
How about smart contracts
Smart contracts aren’t written in the runtime. instead, they’re pieces of codes that are sent as transactions ( deployed) to an address of a specific blockchain. It means a blockchain has to exist before a smart contract can be deployed to it.
Since these smart contracts could contain callable functions. they can be called externally and used to build dApps.
Of course, deploying smart contracts to the blockchain and calling them isn’t free. Various blockchains are different fee structures for these activities. This could be via gas fees, staking, subscriptions, etc.
Polkadot (Kusama) relay chain doesn’t allow any smart contract to be deployed directly to it. however, Parachains and Parathreads can implement smart contract capabilities if they want. This allows projects to build applications that will still benefit from interoperability and security features of polkadot, without having to worry about all the hassles that parachains and parathreads need to go through before launch.
Pros
- Since smart contract developers don’t have to bother about things like running a node, deciding on consensus mechanisms, writing governance rules, connecting pallets to the runtime, or writing complex runtime logic, they’re a lot easier (and faster) to develop.
- Smart contracts are a lot easier to deploy than parachains and parathreads. All they need is to send the codes to a smart contract address on the blockchain (the hard work has already been done by the main chain).
- Because smart contracts aren’t written in the runtime, they don’t have to bother about complex maintenance and runtime upgrades.
- There are certain security limitations that are set to ensure that smart contracts write secure code. These limitations aren’t available for parachains/threads whose developers have full autonomy as to what they write on the runtime.
Cons
- Smart contracts are limited by the complexity of their codes.
- Because smart contracts have to follow a lot of rules set by the blockchain to which it’s being deployed. they have a lot of restrictions regarding the flexibility of their codes.
- Smart contracts are a lot less scalable than parachains and parathreads.
When should I use smart contracts?
Smart contracts are suitable for simple projects which aren’t expected to have an explosive user-base in the future, don’t require complex runtime logic, and don’t require a large degree of customization. It’s also suitable when developers don’t have enough resources yet to launch a Parachain/thread but would want to get an MVP out to users in the meantime.
A fourth option
As a matter of fact, the options above can be used together. developers will have to decide on which parts of their logic should be launched on either a Parachain, a Parathread, or a smart contract address.
In conclusion
The path of development that you take in the Polkadot ecosystem depends on the complexity of your project, how much scalability will be needed in the future, the need for the unique rules in your project, community support, and the number of resources you have at hand. In most cases, the choices you make aren’t written in stone. you could always switch between individual paths, depending on which path will be most favorable to your project at a particular point in time.