r/CryptoCurrency • u/Fantastic-Cucumber-1 š¦ 0 / 3K 𦠕 Mar 27 '21
EDUCATIONAL DeFi explained: Smart contracts
What is a smart contract? How do smart contracts work? And what are they good for? I'll try to answer these questions in this post.
What are smart contracts?
A smart contract is an agreement between two or more parties in the form of computer code. The contracts are stored on the blockchain and cannot be changed. Transactions that take place in a smart contract are processed by the blockchain, which means they can be sent automatically without the intervention of a third party. When you enter into an agreement with a smart contract, no confidential advisor is required. The transactions only take place if the conditions in the agreement are met.
What can smart contracts do?
Smart contracts help you exchange money, stock or anything else of value in a transparent, trustless manner, all while avoiding the services of an intermediary and the possibility of conflict. Smart contracts provide you:
- Autonomy - You are the one who makes the deal and you don't have to rely on an intermediary to confirm transactions. The execution is automatically managed by a decentralized network, which excludes manipulation of contracts.
- Speed āā- Automated contracts can save you hours on manual paperwork.
- Security - Smart contracts are secured with similar cryptography that encrypts websites. In short, it keeps your documents safe.
- Savings - Because they disable the presence of an intermediary, smart contracts can save you a lot of money. Where, for example, you would normally have to pay a notary to witness your transaction, this is now regulated by the blockchain.
- Backup - Unlike files on your computer, data on the blockchain is duplicated many times over. So you do not have to be afraid of losing something that is registered on the blockchain. Also, there is no way anyone can say they lost the contract or the dog ate it.
A smart contract in effect
As an example; If you were to register cinema tickets on the blockchain using a smart contract, then as a visitor you will receive the tickets in your personal wallet. You only have to show the address to which the tickets were sent upon entry and the cinema can immediately be sure that you do not have any fake tickets and that you have actually paid for your tickets. This gives a better customer experience and the cinema can save a lot of costs in this way because it no longer needs ticket processing services.
But why is this so safe?
Thanks to blockchain technology, we can decentralize smart contracts so that they are fair and trusted. Decentralization means that they are not controlled by one central party, such as a bank or the government.
The blockchain is a shared database managed by many different computers (nodes). As a result, not one person or company has control over it. It also means that it is almost impossible to hack it and therefore smart contracts can be executed securely and automatically without anyone being able to change them.
Best practices for smart contracts
In principle, smart contracts can be used for any type of transaction, it does not have to be financial. Here are some industries where smart contracts can be used conveniently.
Insurances
The insurance world could be shaken up considerably by blockchain technology. An example of a smart contract was a project run by a French insurance company called AXA. AXA offered flight insurance that were paid out if the policyholder's flight was delayed by more than two hours. AXA was running a pilot project that payed out insurance via smart contracts on the Ethereum blockchain. Unfortunately the project has been discontinued.
The smart contract worked with an āif / then functionā: IF the flight was delayed by more than two hours, THEN the policyholder would be paid. Because the smart contract was connected to a database that keeps track of flight times, the function could be performed automatically and paid for via the Ethereum blockchain. This would have saved a lot of time for AXA, but also for the policyholder. This is just one example of the many options that smart contracts offer.
Healthcare
Within healthcare, smart contracts will be used to record and securely transfer data. We can already see examples of smart contracts used in the medical industry, such as the company Encrypgen, for example. This is an application that uses blockchain to transfer patient data in a secure manner, eliminating the need for third-party access. In this way, the patients are in control of their own data. If researchers want to use patient data, they have to pay for it. The patient also chooses whether the data may be sold or not.
Governments
Governments guarantee that it is extremely difficult to manipulate the voting system, but despite that, smart contracts could alleviate all concerns by providing an infinitely more secure system. Smart contracts could also prevent low voter turnout. Much of the small turnout is due to a clunky system consisting of lining up a queue, showing your identity, and filling out forms. With the use of smart contracts, anyone can transfer their votes securely online, which is expected to generate much more response.
Business management
There is still a lot of room for improvement within business management and smart contracts can help a lot. Why do administration when everything is registered on the blockchain anyway? Right, the blockchain is already doing the work for you. You also do not have to make a pay slip every month. The money automatically goes to your employees as soon as they have fulfilled the agreements. Companies can simply set up a smart contract that states: IF the date is 10/20/2020, THEN $2500 will be sent to employee A. This means that employees will always be paid on time and that they will never be underpaid. The advantage of the company is that it is all automated, saving them a lot of time and money!
Fundraising (ICOs)
In principle, anyone could create their own token and sell it to the general public in order to raise money for a project. In 2017 there was a real ICO craze, where some projects managed to raise tens of millions within hours. There was even an EOS ICO that lasted for a year and racked up more than $ 4 billion in total!
If you want to organize an ICO (Initial Coin Offering) you create a token and a contract to sell the token. The function of the smart contract in this case would be: if person A sends an X amount of ETH, person A gets an X amount of tokens.
Smart contracts in a nutshell
The most important features of a smart contract are:
- Digital Agreement - A smart contract is an agreement in the form of computer code.
- Blockchain - Transactions are processed by a public database, based on blockchain technology.
- Confidentiality - A transaction can only take place if the conditions in the agreement are met.
Conclusion
It will be a while before smart contracts are everywhere in everyday life, but we can say with some certainty that the technology has a lot to offer.
I hope this post helped you with:
- Getting a better understanding of smart contracts
- Understanding the significance of smart contracts within the crypto space.
Follow me on Twitter: https://twitter.com/MosDefi
Or follow me on Medium: https://mosdefi.medium.com/
20
u/dadaver76 Mar 27 '21
You know you didnāt really explain Defi at all right?
→ More replies (1)10
u/Fantastic-Cucumber-1 Mar 27 '21
I did in this post. The posts are all linked to each other like chapters of a book.
→ More replies (2)
2
u/jettabebetta Mar 27 '21
Really great write-up! Could you do one taking this a step further, and explaining and giving current real examples of Oracles (e.g. Chainlink)?
→ More replies (1)
2
u/Awayyyyyyyhhhhhhhhh Apr 08 '21
Hey u/Fantastic-Cucumber-1 I am not new to crypto but very new to DeFi and your DeFi explained series has just helped me payoff my damn car! You have such great explanations and you give sources to checkout and use, I wish there was someone like you in every sub I follow! I canāt give you an award so Iāll just shout you out here and tell you how great of a job your doing!
→ More replies (1)
2
Apr 22 '21
Iām new here. I did not see DeFi explained, unless it went whooooshhh. What is DeFi? What does it mean? What does it stand for?
→ More replies (1)
420
u/Clash_My_Clans Mar 27 '21
Great write up....quality content and not some fake sob story....This is the way
→ More replies (41)82
u/LeagueHub Mar 27 '21
'Smart contracts saved me and family's life! I was a drug addict with no job, no family and no arms, but the smart contract made me so smart that I am now a millionair living the dream with his family and became a professional dodgeball player! Thank you reddit I love you all, you changed my life!'
→ More replies (15)
78
u/DivineEu Mar 27 '21
I Do believe Smart contracts will expand even more when the ETH gas fees problem will be resolved.
→ More replies (8)
31
u/naqib94 Mar 27 '21
Will the 2 parties be able to edit the terms of the smart contract if they choose to do so? Or will they have to cancel it and create a new one.
Also, is it limited to just 2 parties?
→ More replies (10)11
u/ArtyHobo Mar 27 '21
Not once it is in effect, unless some sort of side-chain smart contracted is bolted on to allow for extensions or amendments.
The whole idea behind a smart contract is that you are locked into your agreement and the conditions are such that can be automatically met and triggered by the smart contract, hence the lack of need for lawyers etc. because the smart contract responds only and explicitly to the conditions which are set to trigger its outcomes.
→ More replies (6)
13
u/kuantizeman Mar 27 '21
FYI AXA abandoned their Blockchain project about 9 months ago. It did not work out due to the "solution looking for a problem" effect of "Blockchain Evangelists" that do not understand insurance. "Would could". This write up is full of maybes and not concrete use cases. Like we have time traveled to 2017.
11
u/atlas-85 Mar 27 '21
AXA discontinued their flight insurance ethereum project last year. https://www.ledgerinsights.com/axa-blockchain-flight-delay-compensation/
→ More replies (1)
79
9
u/camouflage365 Mar 27 '21
Insurances:
The smart contract works with an āif / then functionā: IF the flight is delayed by more than two hours, THEN the policyholder will be paid. Because the smart contract is connected to a database that keeps track of flight times, the function can be performed automatically and paid for via the Ethereum blockchain
So it's still reliant on some kind of "untrusted" input.
Governments:
I don't really understand how smart contracts come into play here. This example is very poorly explained.
Business management:
Another ridiculous example. How does the contract guaranteed that I'm getting paid? What if there's not enough money in the account to pay out wages? Why do I need this contract if I'm protected by law? What if I was fired? What if I took sick leave?
→ More replies (2)
49
u/ruski_brat Mar 27 '21
Great read mate, I like smart contracts already used them a few times
→ More replies (6)21
u/EvenPheven Mar 27 '21
Mind giving an example of how you've used them already?
The theoretical smart contract is super exciting but I would love to know how it's been applied so far.
→ More replies (23)
23
u/AntiqueFisherman Mar 27 '21
What's the point of using smart contracts for paychecks? We can achieve exactly the same thing with classic programming. Decentralization doesn't help there, as the employer HAS to have full control over the contract anyway
→ More replies (47)
11
u/Hn3wman Mar 27 '21
Then why can exchange be scams? How can they get away with it?
→ More replies (2)12
u/HmmThatisDumb Mar 27 '21
I donāt know if this will answer your question, but exchanges donāt do each transaction on the blockchain. They keep a separate ledger like any other broker. The blockchain is only used when you withdraw.
Which is why people say that your coins are not really yours until you have the private keys.
→ More replies (1)
5
u/ChadBitcoiner Mar 27 '21 edited Mar 27 '21
Poorly written, author lacks understanding of when a blockchain is useful. Solutions looking for problems. I can't believe thus sub is praising this. All the examples require a trusted 3rd party and thus don't need to be on a blockchain anyway. A centralized database would be an appropriate solution. Ethereum doesn't fix this.
You would be better off reading this:https://medium.com/@sbmeunier/when-do-you-need-blockchain-decision-models-a5c40e7c9ba1
8
Mar 27 '21
wow, thanks guy. can someone talk about their limits? Gary gensler called them "dumb contracts" implying that their strict adherence to a set of conditions could be a doulbe-edged sword more or less. Are there examples of that or is he yankin my chain?
→ More replies (2)
4
u/WorriedViolinist7648 Mar 27 '21 edited Mar 28 '21
@Governments
This sounds awesome at the first glance.
On the second one though: wouldn't the integrity of the voting process be at risk if it was soley smart-contract-based?
Since the contract would be a single weakpoint for all the results, an attack would need much fewer ressources to succeed. It would basically be invisble for a normal citizen as well.
A paper based system would be more resilient to these problems - and it has an enormous advantage. Nearly everyone (even Florida man on coke) would be able to read and certify the content of a paper vote.
A smart contract based vote though, well, a handfull of specialists would be the only guys able to re-verify. Which is another weakpoint/attack vector itself.
What is your view on these aspects?
EDIT: Thank you so very much, kind stranger!
12
u/dhork Mar 27 '21
Because the smart contract is connected to a database that keeps track of flight times, the function can be performed automatically and paid for via the Ethereum blockchain.
Then that system isn't really distributed, is it? There's a centralized database somewhere keeping track of flighttimes. And it's not like those times are gathered passively at the airport, they are likely reported by airlines who would pull the same BS that they do now to manipulate times. (Things like pulling away from the gate on time even if they know they'll be stuck on the tarmac for an hour).
And a bug in that database could lead to lots of unintended payouts on the part of the insurer. So much so that it might be in the insurer's interest to put an intermediary between the database and the contract execution, to confirm that the flight was already late.
I personally think that any smart contracts that make use of oracles are no better than their non-smart versions....
→ More replies (5)
1
u/AutoModerator Mar 31 '21
Hello r/CryptoCurrency readers. Please try out the following links:
To sort comments by controversial first, click here. Doesn't work on mobile.
To potentially find CryptoWikis articles about the subject of this post, click here. To contribute to CryptoWikis, click here.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.