have you ever heard the expression code is law where technologies used to enforce rules in that case do you need lawyers or maybe we can live in a fully automated world where code dictates what we can and cannot do with the current development of smart contracts this futuristic scenario may be closer than we think a smart contract is a piece of code that can be executed automatically an in a deterministic way the smart contract code is usually stored and executed on the blockchain to make it trustless and secure smart contracts also have capabilities of receiving
storing and sending funds and even calling other smart contracts they follow if-then semantics which makes them fairly easy to program smart contracts aim at removing the human factor from decision making the human factor is often proven to be the most error-prone and unreliable element of the standard traditional contracts a vending machine comes very often as a good analogy to a smart contract as it shares some of the similarities a typical vending machine is programmed in a way that allows certain actions and state transitions based on the input it also works in a fully deterministic way
for example if you want to buy a can of coke that costs two dollars and you only have one dollar no matter how many times you try you won't be able to get the drink on the other hand if you insert three dollars the machine will give you a can of coke an appropriate change even the change that is given is selected in a predefined and programmed way based on which coins are available and which coins the Machine wants to get rid of first a smart contract can rely purely on the information available on the
blockchain for example if you give me ten tokens a I'll give you ten tokens B or it can rely on an external data source for example on the etherium or S&P 500 price the latter example make smart contracts more difficult as they have to trust real-world data the needed trust can be minimized by using Oracle services but even the Oracle services have to be trusted there are already a few projects that by using certain incentives make Oracle's more likely to provide correct data chain link is a project that clearly stands out in this category each
hiriam is a good example of a block chain that supports smart contracts and make it possible for a programmer to implement their own smart contracts a smart contract can be written in a programming language called solidity which was created specifically for that purpose in etherium all the deployed smart contracts are immutable this means that once deployed they cannot be modified which creates certain risks that we're going to discuss later smart contracts on aetherium are also decentralized which means there is no single machine controlling the contract in fact all the nodes on the etherium network store
the same contract with exactly the same state although it's room is currently the most popular general-purpose smart contract platform this is not the only one and it has a few competitors some of them are Cardano teases gos and Truong but not all of them share the same characteristics the term smart contract was coined by a well-known cryptographer Nick Szabo in the early 1990s the name although not the most self-explanatory stuck and it's commonly used especially in the blockchain industry to see the benefits of smart contracts let's compare a hypothetical smart contract to its equivalent in
the traditional space let's say we want to write the following contract if Alice sends X number of tokens a and Bob since the same number of tokens be the tokens will be swapped and Alice we receive Bob's tokens and Bob will receive Alice's tokens in a non-smart contract world one way of achieving that without Alice having to trust Bob and Bob having to trust Alice would be to create an escrow contract with a third party the third party would collect tokens a from Alice wait for the same number of tokens B from Bob and send
Alice and Bob the respective swapped tokens this approach already shows a few problems that Alice and Bob may be facing trusting intermediaries there is no guarantee that the third party will not run away with the tokens after receiving funds from Alice and Bob we have to rely on the reputation of the intermediary and potential insurance this approach is not deterministic and if something goes wrong it may have different outputs depending on multiple factors including the jurisdiction where a potential case would be settled in on the other hand the smart contract would work in a fully
automated and deterministic way making sure that both of the parties receive funds when they meet the initial criteria of depositing coins smart tracts can also hold funds within themselves which is just not possible to achieve in the traditional world speed depending on the intermediary Alice and Bob may have to wait even up to a few days or weeks to settle the transition of tokens what if they want to swap tokens on Sunday is the intermediary is an operating with smart contracts these kinds of problems go away and the contract can be fulfilled seconds after the
initial criteria are met cost traditional contracts are not only expensive because of the intermediary that have to make the profit there is also a huge risk of hidden costs for things like arbitration and enforcement is there are any problems with the contract reusability the same smart contract that is responsible for swapping Alice's and Bob's tokens could be used by anyone else who wants to swap tokens in the traditional world they would all have to sign separate contracts and pay the respective fees to the intermediary fraud this is yet another hidden cost this time for the
intermediary itself the intermediary would have to make sure that both Alice's and Bob's tokens are legitimate before initializing a swap fraud is a very common in traditional finance and most companies have huge teams working purely on preventing fraud with smart contracts the tokens can be verified on the blockchain and with digital signatures it's clear straight away if both Alice and Bob are eligible for spending their tokens smart contracts has a growing number of use cases ranging from payments and decentralized finance to supply chain and crowdfunding smart contracts are also the basic building blocks for decentralized
applications or dabs let's talk about a few examples of smart contracts decentralized finance or defy is one of the new industries that rely heavily on smart contracts some of the things that have been already built in this space include decentralized stable coin with a clever use of smart contracts and certain incentives we can create a stable coin that is pegged to the u.s. dollar without having to store dollars in the real world maker Dow is one of the companies that makes it possible automated liquidity provisioning a set of smart contracts can allow users to provide
liquidity and swap tokens in a complete permissionless and decentralized fashion uni swap or khyber network are good examples of such protocols another use case is providing more transparency to the supply chains where protocols like origin trail comes to play when it comes to crowdfunding you can imagine a contract that unlocks funds as soon as certain goals are met and verified by the community this doesn't stop here time for a bit more futuristic examples what is smart contracts could facilitate things like ride-sharing apartment rentals and much more how about charity you can imagine a fully automated
fund that would send money directly to the people who need them the most without any intermediaries for example the fund could determine that certain region was struck by a hurricane and redirect funds to part of the world for now it sounds quite impossible but all the necessary elements to make something like this happen are being built while we speak the use cases for smart contracts are almost infinite but before we can achieve all of that we have to tackle a few problems one of the main risks when it comes to smart contracts is something that
haunts every other software bugs the best example of a bug in a smart contract is the dowel hack that resulted in millions of dollars worth of eater lost as the attacker was able to drain funds from the smart contract this cause et reham to hurt fork and created a lot of disagreement in the etherium community since the dowel hack the etherium community came up with a lot of extra security measures these days pretty much all popular smart contracts have gone through a security audit often by multiple teams besides that there is a trend for using
formal verification methods to prove that certain contracts will always behave in an expected way protocol changes even if a smart contract doesn't have any bugs and has been audited we still cannot guarantee that the change on the platform level will not cause any problems we can imagine a situation where an upgrade to the material itself may cause certain smart contracts to start behaving differently the world was expected before real-world issues that cannot be easily communicated by Oracle services it's true that Oracle services can provide a reliable way of getting information from the real world into
the blockchain for example as we mentioned earlier they can provide a neat or S&P 500 price now imagine that you rented an apartment or a car and made some accidental damage how would a smart contract without any human intervention possibly know about it there are multiple examples like that when it's hard to imagine how something unexpected that happens in the real world can be visible to a smart contract besides all the above there are also other risks involved in things like regulation or tax but I believe that they can all be eventually solved so can
we actually replace lawyers with code humm not quite at least not right now in the future I can certainly see more and more contracts being automated especially when it comes to finance but even in a fully automated world lawyers can provide valuable knowledge that can be translated into code besides that there is a lot of regulatory challenges when it comes to laws around the crypto industry itself that will keep lawyers at very busy for a while nevertheless if I was a lawyer I would start thinking about learning a little bit more about smart contracts and
coding as I believe they will play a big role in the future let's quickly summarize both the pros and cons of smart contracts pros fully automated deterministic results trustless fast precise secure cost efficient and transparent cons software bugs protocol changes and clearer regulation and clear tax even though smart contracts carry certain risks we have to remember that we are still very early and most of the current problems are solvable if you have any questions about smart contracts or any suggestions for the next videos please comment down below if you find this video helpful hit the
like button subscribe to my channel and click on the Bell icon to be notified when the next video comes out thanks for watching