Smart contracts vs Custom blockchains
Post Material after WASM conference 2022
No silver bullet
Fred Brooks, “No Silver Bullet — Essence and Accident in Software Engineering”
Despite all of you should already know what a smart contract and blockchain are, we still need to provide simple definitions of the smart contract and custom blockchain.
Ethereum’s definition of the smart contract sounds like this: a “smart contract” is simply a program that runs on the Ethereum blockchain. It’s a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. If we exclude Ethereum from here, we can get the most simple definition of smart contracts.
As for the definition of a custom blockchain, the situation is complicated, so I propose to rephrase the question of what is a custom blockchain into what do we call a custom blockchain?
Generally speaking, all blockchains are custom in some sense. Bitcoin aimed to be digital cash, Ethereum aimed to be an internet computer, and many other projects also tried to resolve different problems. We won’t exclude any blockchain from the term custom blockchain, but we think that the best examples of custom blockchain originate from Substrate-based blockchains or application-specific Cosmos blockchains. Both Substrate and Cosmos SDK provide us with different blockchain-specific modules, such as consensus mechanism, networking, cryptography, RPC module, tests, and benchmarks. So we can focus development on blockchain logic itself.
Let’s move to the goals of this article. We aim to answer the next questions:
What is a more secure smart contract or custom blockchain?
What limitations each approach has?
What technologies do we use, and is a development process convenient enough?
What is the image of smart contracts and custom blockchains from a business perspective?
When should we use smart contracts or custom blockchains?
Comparison
Smart contracts and custom blockchains are different entities, so there is no sense to compare them face to face, we can only try to measure the different properties of each approach. So we need to keep in mind that one term can mean different things for smart contracts and blockchains. We will try to highlight this difference where it’s possible. We will discuss our vision for the next topics:
Security. What is security for contracts and what is security for blockchains? What are the risks for both approaches? What does security consist of in our context?
Freedom. What is possible and what is not when using each of the approaches?
Development and Technologies. What do we need for the development process? Is it convenient from our point of view?
Business. There are no simple answers to the question of what approach is better in your case. We try to describe the status quo and express our thoughts.
Smart contracts. Security
Security can have different meanings depending on the context, but certainly, the whole blockchain industry tries to achieve the maximum level of security. We will talk about this in smart contracts and custom blockchain contexts.
So what is the definition of security in the context of a smart contract? We can separate two faces of smart contracts security:
- Security of smart contract per se.
- Smart contract safety in the broader context of the network where we deployed a smart contract.
By the smart contract per se, we mean any security issue which originates from the smart contract developer side, i.e. critical bugs, and backdoors, also we can mention here the smart contract level of decentralization, I mean how the rights are distributed among the users because if we have a super user with too many privileges we should trust in this authority and if this authority is a little bit malicious we may lose our funds and assets.
Can we say that smart contracts guarantee the safety of your funds and assets? Not and I think you can mention many real-life examples of such situations. But can we blame the idea of smart contracts itself? Of course not. The concrete implementation of smart contracts is the responsibility of the developer. We can only build some walls on hacker paths: security audits, high level of expertise, bounty programs, tests, etc. The final nail in the coffin of the contract’s security is that even the technologies we use to create them can have bugs and that the environment where execution takes place can be unsafe. But does this problem stop somebody from making a smart contract? The reality gives us an answer — no, we can live with such risks. In some cases, network authorities can fork the blockchain only to revert changes that malicious actors make by exploiting the vulnerabilities of a smart contract. Of course, I mean the history behind the Great DAO hack and Ethereum hard fork, and we should keep this in mind.
Regarding security in a network context, the picture looks much brighter. Generally speaking, the network is safe because it has a sandbox for smart contract execution. Also, the network can guarantee that nobody will abuse the contract because you should pay both for smart contract storage and execution. So, if fees in the networks are high enough, then malicious actors won’t have a cause to, for example, DDoS your contract if they have such intention.
But sometimes we can not separate smart contracts’ safety from protocol safety because smart contracts are pillars of interoperability between different networks, such as bridges. In this case, unsafe smart contracts can disrupt security. The PolyNetwork hack is an excellent example of this case.
Custom blockchain. Security
It’s hard to define security for the custom blockchains because we need to talk about the base level of blockchain:
- Cryptography
- Consensus & finality
- Networking
- Economic
The development of each of these topics has practical and theoretical problems.
Cryptography gives us a way to protect the information and preserve some privacy. But if you want to implement something new in this field, you need a team of Ph.D. to research the issue and prepare a theoretical base.
Consensus & finality is blockchain-related stuff. We have different consensus mechanisms with various properties: PoW, different kinds of PoS, Proof of Capacity, and others, and who knows what we will see in the future. Implementing your custom consensus or choosing parameters of an already existing consensus mechanism is complicated. Your choice can lead to security issues.
Networking: what network topology do we require? How will different nodes communicate with each other? Is it easy to try a Sybilla attack on your network? What data format will we use for network communication? It would help if you had the correct answers to all these questions to make your network safe.
Economy. Your economic model should incentivize good behavior and punish the bad actors somehow. But is your economy’s stimulus strict enough to enforce good behavior? For example, if your blockchain has very cheap transactions, DDoS attacks become possible, but we will have scalability problems if they are too expensive. The problem with a cheap transaction fee is only one side of the problem. Recently, one famous ecosystem fell due to a faulty economic model.
As you can see, custom blockchains are much more sophisticated than smart contracts security.
To sum up, the pros/cons of smart contracts are that we inherit security from the network, and the contract can not violate the network’s security. The pros/cons of the custom blockchain are that we are responsible for complete security. Let’s move on to the next topic, highlighting the above-mentioned issues.
Smart contracts. Freedom
The word freedom may look pathetic in this context, but why not. By freedom, we mean the level of project complexity we can achieve and the tradeoffs, which we should keep in mind when implementing your solution as smart contracts or as a custom blockchain.
What can we achieve by using smart contracts? Simple answer — anything, smart contracts themselves don’t limit you. Real answer:
- The last section mentioned a safe environment (sandbox) for smart contract execution. Sandbox is overhead. Also, both EVM and WASM can be inefficient depending on implementation details, so computational intensive logic can cost too much for you. For example, EVM 256 bits integers…
- Networks can limit the size of your contract. For example, Ethereum allows only 24 Kb smart contracts. Yes, we can use a diamond pattern, but the limitation is still a limitation.
- The network economy can limit you too because it should guarantee honesty and fairness for all actors, not only for you. So, the competition for the network resources can be very hard and cost too much.
- Currently, we have one main platform type for smart contracts — EVM. WASM for smart contracts only carving its path. Both of them limit you in some sense. There are no solutions that will guarantee that your smart contracts can be deployed in all networks. We don’t mean that we need only one platform for all, but we need compatibility between platforms.
- Smart Contracts would still need to be interpreted by a virtual machine, limiting performance compared to a native application.
- The contract can’t be self-executed, i.e., we can’t implement something like “Call this function each third block”.
- Of course, you can’t implement something related to the blockchain itself, for example, consensus and networking.
Custom blockchain. Freedom
The question of what we can achieve by implementing custom blockchain sounds dumb because the whole blockchain world proves that there is nothing impossible:
- Digital currency
- Internet computer
- Decentralized storage
- And all other fields, where we want to replace central ownership with decentralization
One unresolved issue worth mentioning is the interoperability problem between different blockchains. There are different approaches for this — bridges or a Polkadot sharding, but no standard solutions exist.
Nothing changed in this sense compared to when the first blockchains emerged, except for one thing — now we have convenient tools to develop our blockchain, but let’s discuss it in the following topic about the development process.
So, the main question here is to be or not to be. Do you need this level of freedom as custom blockchain provides?
The goal of smart contracts is to extend blockchain business logic level, not to replace it; thus, comparing the degree of freedom for these two technologies may look senseless. I’m sure that the most enlightened of you can tell me that we already have different ways to overcome smart contracts limitations, so I should mention several of them:
- Layer 2 solutions with off-chain computation can give us cheap network resources and make sandbox overhead and platform performance problems insignificant; this leads us to cheap and fast smart contracts.
- TEE or trusted execution environment. You can use Phala Network Fat Contract as a reference.
Both smart contracts and custom blockchains have problems with interoperability and interaction with the real world. For now, we have a hack called oracles to interact with the off-chain world safely. The interoperability problem for blockchains also has some solutions, such as Polkadot cross-chain messaging protocol and Cosmos hubs cross-bridging between different networks. However, we still don’t have a safe and scalable solution for this problem.
At the same time, the development of custom blockchain became much more straightforward; thus, competition in the common application field for smart contracts and custom blockchain, i.e., DApp, will become much more fierce. The main advantage of custom blockchain in the DApp case is independence from anything and everything and a higher level of performance.
Smart contracts. Development and Technologies
Unfortunately, we can’t just conjure a custom blockchain or smart contract — we need to develop it. For now, we need exceptional people to do this; thus, the development process has not only a technical dimension but also a social dimension.
First of all, people. The competition for professionals is a normal state of the labor market. The competition for IT specialists looks more fierce than in some abstract labor markets. At this moment, relatively new blockchain technology has become a point of interest for the world. I don’t think I’ll say something new right now, but the entire industry is experiencing a solid staff shortage, particularly the blockchain industry. So the common problem for both smart contracts and custom blockchains is to find the right people to do the right things.
Smart contracts development and technologies look more mature now, highlighting some obvious but important points. Despite new technology, we have
- Different languages for writing smart contracts: domain-specific languages for EVM (Solidity, Viper, Yul(+)) and potentially all general-purpose programming languages such as C++, Java, Rust, and others, for WASM technology.
- It is worth mentioning that detailed documentation and tutorials exist for smart contract development.
- It’s controversial, but we think that smart contracts development will be entirely separated from the underlayer network, which developers will interpret as a black box in the future.
- Smart contracts have a relatively lower bar to entry for development. RELATIVELY, I don’t want to offend the smart contract’s developer community.
- We think that technology is relatively mature because we have standards here. Standards are a language for software architecture.
- Deploying smart contracts is easy.
Custom blockchain. Development and Technologies
How can you develop your custom blockchain? There are several classic but always applicable options:
- We can create it from scratch
- Fork and modify the existing solution
- Use framework
Also, we can use different programming languages to develop blockchains, but a comprehensive guide on how to make a good blockchain for every application does not exist.
Regarding frameworks for building blockchains with needed properties. I cannot avoid mentioning the Substrate and Cosmos SDK. They have different architecture. For example, Substrate is potent in the broader context of Polkadot parachains, but it is not limited by it.
- But developing your custom blockchains will require a relatively higher level of expertise from developers.
- And deploying custom blockchains isn’t an easy task.
The main advantage of smart contracts here is the development speed, standards, and required expertise. As for the custom blockchains’ development, it is more sophisticated. This is the price of freedom that we get.
Smart contracts. Business
Smart contracts are relatively cheap:
- Time is money, so fast development will save your resources.
- If you want to integrate your business with existing smart contract solutions, it is better to do it with smart contracts.
- Cheap and fast deployment.
- It’s easier to gather a community around them.
- Limited opportunities.
- The development of smart contracts is more effortless than custom blockchains, but users will pay for it at a higher price.
Custom blockchain. Business
Custom blockchains are relatively expensive:
- The development takes more resources, even with the framework.
- You need to attract network validators.
- More research work is required because it’s complicated to anticipate the best network parameters.
- More security concerns.
- Total freedom.
- The development of custom blockchains costs much, but it’s cheaper for users.
- The interoperability problem is not solved yet. But existing solutions have some price. For example, you need to compete with others for parachain slots during the auction.
Custom blockchains are not for everyone, but they are better if you have the required resources.
Conclusions
To sum up, our thoughts about smart contracts and custom blockchains are contradictory. On the one hand, we can implement DApp using smart contracts, which will be faster and cheaper in development. On the other hand, custom blockchains look like a better solution in the long run because of their flexibility, performance, and independence. But this leads to another problem. While you are developing your great business idea as a custom blockchain, someone might already have gathered a community around smart contracts that had implemented it. But we can look at this from the other side, you can implement your idea as smart contracts as PoC and then start development of the custom blockchain, but this looks problematic in the world of limited resources.
What are our thoughts about smart contracts’ future? They will remain. Layer 2 solutions, adoption of WASM will support the steady growth of everything related to smart contracts.
What are our thoughts about the custom blockchains’ development? This approach will become more popular because of technologies for building your blockchains. Let’s compare the flexibility and performance of smart contracts and custom blockchains. The second is better but should keep in mind the required resources to develop, maintain and pay for it.
Examples
Let’s give simple answers to complicated questions.
When do we need smart contracts?
- When you require fast and relatively cheap development and easy deployment.
- When your logic is simple, for example, you require just a token.
- In cases of one-time events(ICOs, elections).
- When you already have a vast smart contract, you want to port it to a compatible network.
- When you want to be a part of a robust ecosystem based on smart contracts.
- When you want to test your business model in reality.
When do we require a custom blockchain?
- When you are unsatisfied with your current network capabilities: tps, fees, performance.
- When you want to leverage specific platform benefits (for example, being a Polkadot parachain). But even in this case, you can deploy your smart contracts on different parachains with smart contract support such as Acala, Moonbeam, and Astar.
- When you have a relatively long development time and have experts.
- If it’s impossible to implement your idea on smart contracts.
- Your goal is to implement something fundamentally different from existing blockchains, for example, a new consensus mechanism.
About Supercolony 🪐
Supercolony is a venture studio dedicated to converting business ideas into successful high-level companies, leading the development processes, improving and strengthening business models, and increasing market capitalization. Supercolony’s goal is ecosystem creation, taking leadership in moving the market forward, creating the vector of ecosystem development, and making the entrance points for businesses more accessible. Our main mission is to make blockchain usable for everyone.
LinkedIn | Website | Twitter |Telegram | GitHub | YouTube