November 21, 2019

Stellar vs Ethereum smart contracts: what’s the difference?

Did you know that Stellar also has smart contracts? That’s true: Ethereum isn’t the only blockchain that has this functionality. But Stellar smart contracts work in a completely different way — not better or worse, just differently. Let’s see why!

First, let’s revisit the notion of a smart contract. Nick Szabo was the first to describe the concept back in 1997. A smart contract is a piece of code that executes by itself when some predetermined conditions are met. You don’t have to click on the Execute button or anything: the contract will launch all by itself and do whatever you program it to do. It can be something basic, like sending tokens, or a very complicated sequence of transactions.

A smart contract can be (or not be) Turing-complete. You’ll often find this term, and many people think that Turing-completeness is always good, while being incomplete is always worse. But the reality is more complicated. Turing-completeness means that you can plug any calculation (absolutely any) into a program, and it will carry out this calculation. Incompleteness in the Turing sense means that a program or device has limitations: you can come up with a task that it won’t be able to perform.

Ethereum smart contracts are Turing-complete, but there is a catch — even two. First of all, the more complex the contract, the more gas you’ll have to pay. You can in theory design a contract for any computational task imaginable, but the gas costs would be so high that nobody would ever pay them. The second catch is that such contracts are very vulnerable to bugs. They allow any code, as long as it’s in Solidity language. So a developer can easily make a mistake when writing code, and this will create a vulnerability. Hackers will be able to steal users’ money and so on. That’s why projects built on Ethereum have to pay thousands of dollars for smart contract audit.

Stellar smart contracts (SSC) are very different. Some people even think they shouldn’t be called smart contracts at all. But it’s not fair, because they can do what such a contract should do by definition. When the conditions are met, the contract executes. It’s just that people are so used to the way Ethereum contracts work that they think that anything else is somehow illegitimate or wrong.

SSC’s have a limited number of transactions types — 13, to be exact. There are also so-called constraints, which you can use to specify how the contracts work. We’ll look at the constraints next time.

SSC’s have limitations compared to Ethereum smart contracts, it’s true. But these limitations are there by design. The two blockchains have different aims. Ethereum is promoted as a universal decentralized computer — a gigantic computational machine that can cover the whole planet. But on the other hand, it’s not so great for making payments in crypto. It’s slow, the fees are high, it often lags, and so on.

Stellar is fantastic for making crypto payments. It’s super-fast and almost free. And its contracts are geared at people who need to make payments. Such transactions can be complex, include multi-sig, escrow, and so forth. You don’t need to know a special language — you can use any programming language of your choice. There’s very little risk of critical bugs. Stellar is not a universal computer — and it doesn’t want to be one.

In our next post, we’ll look at constraints and different use cases for Stellar smart contracts. Don’t forget to subscribe to our Twitter channel to get updates on XLM wallet and all things Stellar!

https://xlmwallet.co/

Web site - https://xlmwallet.co/

Medium - https://medium.com/@XLMwalletCo

Teletype - https://teletype.in/@XLMwalletCo

Twitter - https://twitter.com/XLMwalletCo

Reddit - https://www.reddit.com/user/Stellar__wallet