No one seems to actually know what a smart contract is, yet are trying to explain them. Here’s the actual explanation of what they are.

Share:

Smart contracts do not ensure payments went through, and they do not create decentralized casinos or banks. In fact, they offer no guarantees about decentralization whatsoever.

They CAN be used for these things, but what they really are is much simpler.

Smart contracts are immutable scripts that exist on the blockchain. They maintain a state (i.e. they store data) and they have functions that can be called. That’s it.

The only way to interact with a smart contract is to call one of it’s functions. There are read-only functions that can be called on any Ethereum node to read some data out of the contract, and then there are functions you can call that modify data in some way, but those require sending a transaction and paying gas.

You can use this functionality to do many things, but it is important to note that they do NOT ensure anything. You can write backdoors into smart contracts. Smart contracts can have admins that have the ability to yoink all the funds out of it. There are categories of bugs that allow a malicious smart contract to attack other smart contracts if they can get that contract to call one of their functions.

Like all code, smart contracts can be written poorly or well. The guarantees come from the implementation, not the nature of smart contracts themselves. The same is true for banking software or other non-blockchain apps.

The key difference is that the code for smart contracts is (mostly) immutable. Once they are deployed, the code cannot be changed. However, there are some exceptions to note:

Smart contracts can be written so that they are destroyed by calling a destructor function. After that, the contract becomes invalid and can’t be interacted with A smart contract can be modular and call other smart contracts. You can “upgrade” one smart contract by deploying a new modular component and pointing the old contract to the new one with updated functionality.

Don’t get caught up thinking that smart contracts are some amazing thing that solves all of our problems when it comes to creating safe, verified transactions. They are just code, that’s it. People can still write shitty code.

submitted by /u/neomatrix248
[link] [comments]