Smart Contracts: Things they don’t teach you in Web3 schools
As with dApps, there’s a ton of information on smart contracts. Ethereum documentation has one of the best introductions to smart contracts, which is not surprising since it’s built on top of this concept. Here we’ll try to close some gaps and provide a list of things you should know about one of the core Web3 concepts.
First, let’s take a look at the original definition that inspired Ethereum creators:
A smart contract is a computerised transaction protocol that executes the terms of a contract.
That’s not so far from the traditional pre-internet idea of a contract: a set of transactions that occur when certain conditions are met. Indeed, the early web contracts were just digitised copies of their paper counterparts. That was until another concept, a permissionless trustless network or blockchain, had been brought to life.
Combined together, it created a whole new universe: now anyone can create a smart contract and fulfill it without the involvement of an intermediary authority that has some legal right to tell which contracts are valid, how they should work, or what kinds of entities they could be applied to.
Basically, when you transfer Ether from one wallet to another — a contract is fulfilled. Since smart contracts had been decoupled from the central authority part (or any entity that would control how they should look like and what kind of legal formula they should use for that matter) and turned into programs — now you can work with all kinds of entities: tokens, NFTs, coins, cryptokitties, even make your own (if you’re good at programming).
This works best with digital assets (money, derivatives, NFTs), but might still be tricky when an attempt to combine smart contracts and real-world objects is made. A digital contract could control what happens inside the ecosystem, yet you’d still need a way to ensure that its terms are fulfilled in the real world.
The cool thing is that smart contracts can embody a more sophisticated logic than just transactions. As we’ve talked about in the dApps notes — some people think only a set of contracts stored and executed on the blockchain could be called a true dApp.
However, there’s a hidden catch: if anyone can create a contract and there’s no way to reverse it (since it’s on a blockchain) — there’s absolutely no guarantee that all contracts you encounter are ‘friendly’. Some might use this with malicious intent. Since the contract is a program, the only thing that concerns the network is if it is valid in terms of programming.
Remember, it is always a good practice to double-check the address of a contract, if you have not encountered it before, and what it can do. We encourage you to educate yourself and have at least basic literacy that would allow you to read smart contracts. This is the way Web3 works — you’ve got the freedom, but the responsibility for your actions is on you.
Another tricky thing is while a contract can be a valid program and mean no harm by itself, it could be tempered with at the time of execution. For example, a malicious actor could change the destination address to reroute all the funds to their account. This requires a way to protect the execution environment.
Fortunately, we’ve got one! Super Protocol utilises Intel SGX technology that creates a protected execution environment at the hardware level — even if the hacker has control over the machine, there’s no way they could get access into the protected part of the processor. Meaning, that any smart contract executed there is safe (the same is true for any sensitive data that the contract might be working with).
Written by Artemy Domozhakov-Liarskii especially for Super Protocol