Ethereum Smart contracts explained…

What is a smart contract? Ethereum Smart contract explained…

New to the blockchain world? A lot of things can sound confusing. I was once there too… You might be thinking of what a smart contract is. Is it like a real-life contract? Well… Let’s see what it is then!

A smart contract is just a digital representation of a real-world contract. (So, you were right. It is like a real-life contract in a digital form). They are the building blocks of decentralized applications, DApps that run on the blockchain. A smart contract is a self-executing contract in which the conditions of the buyer-seller agreement are put directly into lines of code. It allows us to write programs that sore, transfer and do stuff.

Now, let’s say Alice wants to send money from her ethereum account to Bob’s account. For this to work, they both need an account connected to the ethereum network. The accounts will have addresses. If Alice has 10 eths in her account and she sends 5 eths to bob, her balance will be down to 5. If bob had 0 eth before the transaction, his account will go up to 5 eths. Now, blockchain keeps a record of all these transactions in a ledger and it doesn't need any centralized intermediary (middle man) to complete the transaction. It is decentralized. this is a simple transaction.

Now, what if I want to sell you my estate? I would need a place to store the deal to my house and I would need a way for someone to buy it and to transfer it. This is where smart contracts come in. this is what it does. A program that would accept the deal would be written, and it will give room for you to purchase it, then will transfer the deal from the smart contract to you and will release all the funds once it is sold from your account to my account provided there is enough value in your account.

Smart contracts in ethereum are written in solidity which looks a lot like JavaScript is is very different from javascript. Solidity helps us to model ownership, transfer value, and handle advanced transactions that were written in the blockchain. It is a contract-oriented language. It allows us to encapsulate data and behavior in our decentralized applications. They support inheritance and can talk to one another. Now, you can say smart contracts allow us to create an internet of value.

What can smart contracts do and how do they work?

Let’s take a look at crowdfunding…

This is a platform where people try to fund the creation of their products by allowing supporters to pledge funds towards the product. It’s effectively preselling the products. In many cases, there are other rewards besides the product itself. People pledge money and if it’s funded, their funds are paid out to the creators. If the product isn’t funded, the money goes back to the pledgers.

Now, imagine you create a product and you need it to be funded and you decide to you preselling. You look for investors and people who want to buy your product and they pledge money to your product by helping you fund it. If it is fully funded, they get the product and other rewards too and you get the funds. If it is not fully funded, they get their funds back. A smart contract can be used for this purpose. Using a smart contract, the fund is paid into the smart contract by the pledgers. The funds are stored there. If the product is funded before the agreed time limit set for it, the money is released to the creator and the product to the pledgers and if not, the fund goes back to the pledgers.

Smart contracts can also be applied in real estate, insurance, supply chain, digital identity, and other areas.

What do you think about smart contracts? You can add yours in the comment box. Did you learn something new today?

Thanks for reading. It’s actually nice to meet you :)

Don’t forget to follow me for all your blockchain news and solidity tips….

image: https://unsplash.com/@peiobty?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText

--

--

--

favorite blockchain developer, writer, blockchain and cryptocurrency enthusiast and your lady!… ‘I love anything emerging tech!’

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

ConsenSys to Acquire JPMorgan's Enterprise Blockchain Quorum

Orbofi Partners with Polygon Studios and deploys its full-blown social metaverse on Polygon

ToyoVerse Airdrop Event Distributed

TheOoL Network: The Easiest Way To Make Your Own Cloud Computing And Hosting Company!

About the letsHodl contract

[RECAP] AMA: Kommunitas x UniLend

Decentralized ID for Vulnerable Children and Households in Brazil

Vexchange Enables Liquidity Staking in Preperation for Mainnet Launch

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Favorite_blockchain_lady

Favorite_blockchain_lady

favorite blockchain developer, writer, blockchain and cryptocurrency enthusiast and your lady!… ‘I love anything emerging tech!’

More from Medium

What is Solidity ?

Web 3.0 and the Blockchain: Allies in Arms

From Web 1.0 to Web 3.0: A Brief History of the Evolution of the Web