Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What are smart contracts? Learn and deploy your first contract.

Posted on Jun 13 Congratulate and appreciate yourself because you choose to enter the web3 world, a technical underworld that has immense potential and opportunities for devs like us. Checkout more articles related to blockchain and web3 here on this article series and make a presence in web3 underworld 😎.Lets enter the web3 underworld: Smart contracts are simple programs or codes (written in the solidity programming language) stored in a blockchain that will be triggered upon certain conditions. As simple as that. Let me give a real-life example to better explain this.Remember the Espresso Machine in offices, You press Espresso and put the cup below the nozzle then it will serve you the freshly made hot coffee. Your friend Peter Parker wants Cappuccino, he presses that button and got one, woohoo.Yeah, smart contracts are that simple. They are a simple set of rules which are written in a coding language (Solidity) with the help of variables and functions similar to any other coding language.Anyone working on web3 projects needs to do some work with smart contracts. Now, some of us might not be so much familiar with web3 and blockchains, I advise reading this article to get a more clear understanding.Coming to smart contracts, if you have decided to build a dApp (Decentralized Application) upon any chain which supports EVM (Ethereum Virtual Machine), you will need to write a smart Contract.Smart contracts are basically the bridge between the decentralized application and the blockchain. Let's take the previous Espresso Machine example, here suppose Espresso Machine is a Blockchain and you as a user wants a freshly made cappuccino.What you will do is interact with the menu present on the espresso machine and press the Cappuccino button there. This menu is our smart contract, the bridge between the user and Blockchains (Espresso Machine here). Upon pressing the cappuccino button the smart contract will interact with the Ethereum Blockchain (or any other depending on the user) and transfer 30 wei( = 30* 10e-18 ETH) to the owner of the smart contract and serve you the coffee.The owner of the smart contract is the address who deploys it. Also, because smart contracts are deployed only once on the main-net, the owner can't be changed, any set of rules are also unchangeable after the deployment of the smart contract.So, since you have decided to enter the web3 world and are eager to write your first smart contract, let us discuss some of the homework which you have to do, Basic Understanding of Blockchain Technology - Follow this article series from the beginning.Learning Solidity - If you are good at any one programming language (c, cpp, python, etc. ) it will hardly take two-three weeks to learn solidity basics, and trust me basics are enough to start.Resources: Solidity Tutorial is a very helpful website for learning solidity. Other than that DEV also has some very good articles and Youtube is always our saviour.Follow me on DEV 😁After completing the necessary prerequisites, you are ready to start coding your first Smart Contract.Now when decide to start coding something, the first thing that crosses our mind is which IDE should prefer. Here, in case of solidity, since this language is still so young, we don't have many options for IDEs available. The one which is globally preferable at this time is Remix. Remix has a variety of test networks and each account in every network gives the user 100 free test ETHs which are more than sufficient for the developers. Remix also gives us the option to connect our MetaMask wallets.Once you have mastered smart contracts and want to start building dApps, you need both the front end of the web or mobile app along with the backend, then you will use the IDEs preferred for respective dApps. For example, if you want to create a web dApp, you might prefer VS Code Editor.Q1. How do I create a smart contract in blockchain?Learn about Blockchain Technology then learn the Solidity programming language, start building your first dApp, then deploy it on the mainnet (Ethereum) or any test networks (Georli, Roopsten, etc.). After deploying you have created your first smart contract in blockchain, woohoo, congrats. One thing is here that since your smart contract is stored inside the blockchain, therefore, if you deployed your smart contract to the mainnet then it is impossible to render that contract because blockchains are immutable and irreversible. But, you can do trial and error as many times as you want with the test network chains like Georli, Ropsten, etc. or with the advanced development environments like Truffle and Ganache, Hardfat, or Foundry.Q2. What is a smart contract vs blockchain?Smart contracts are simple codes or rules written in solidity programming language and Blockchains (Ethereum, Binance chain, polygon, etc.) are the decentralized databases where these contracts are stored so that no one can ever render these contracts.Q3. What is an NFT smart contract?Smart contracts which deal with minting, listing, buying, selling, collecting, and viewing NFTs are called NFT smart contracts. NFTs are non-fungible tokens, which means these are some digital art, music, photographs, etc. which are up for sale digitally and are unique in the world. The biggest digital art (NFTs) market is Opensea. I will also be posting an article where I will create an NFT marketplace dApp from scratch soon.Q4. Is Bitcoin a smart contract?No, Bitcoin is a blockchain and BTC is its cryptocurrency. Also, Bitcoin does not support storing smart contracts on it because the founder (Satoshi Nakamoto) is a ghost. No one in the world can contact him. To run smart contracts on any chain, the chain must support EVM (Ethereum Virtual Machine). Chains like Polygon, Binance chain, and Ethereum support EVM and hence we can store smart contracts on them.Q5. Read the article from the begginning to get all the answers thoroughly._____________________--End--_____________________ Templates let you quickly answer FAQs or store snippets for re-use.Covered all important topics to get started with the smart contracts. Hope readers will enjoy. Happy to read feedback comments. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Drew Womble - May 19 Marcelo Castellani - Jun 6 Eduard Krivanek - May 18 Fedor Bystrov - May 27 Once suspended, siddharthsing will not be able to comment or publish posts until their suspension is removed. Once unsuspended, siddharthsing will be able to comment and publish posts again. Once unpublished, all posts by siddharthsing will become hidden and only accessible to themselves. If siddharthsing is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Siddharth Singh Baghel . They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag siddharthsing: siddharthsing consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging siddharthsing will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

What are smart contracts? Learn and deploy your first contract.

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×