Everything You Need to Know About Smart Contracts!
Greetings amazing ReadCasheros!
In today’s blog, we will be breaking down smart contracts, from their history, and composition to their working. Everything you need to know as a beginner trying to understand smart contracts.
Intro
To understand smart contracts you need to first understand what a blockchain is (check out one of my previous blogs on blog chain for more information on it ).In short think of it as multiple blocks that store Data and a hash (for each block). The blocks are connected so that the hash of a certain block depends on the previous block. This “Blockchain “acts as a public ledger of transactions that occur on a particular network. The idiosyncratic part of the blockchain is that it is decentralized hence a lot of issues that arise due to middlemen are eliminated.
Breaking it down
Smart Contracts is one of the most utilized applications of the blockchain. According to Google, the concept of smart contract was first introduced in 1994 by Nick Szabo (who was a cryptographer). In simple terms smart contract is a contract (composed of a code [Solidity in terms of Ethereum network]) that can be converted to code and run within a blockchain. Ethereum is the most used network/platform used for deploying smart contracts. Like I mentioned above its code is concealed within a contract, This code checks if a condition of the contract is met or not (if statement…..if condition ‘a’ is met then action ‘A’ is performed. eg if crypto is transferred then send money to this address), If the condition is satisfied then can exchange crypto (any asset) or perform a function within the network.
When we all create accounts on Meta mask, we can perform transactions on a particular chain using that account. A smart account is entities (account) that can be automatically executed based on the predetermined rules are in the contract. Smart contacts are used in places where we need the consent of a few parties……usually in a crypto lottery ( to choose a random no. once all the crypto is locked),nfts minting, games, etc. This makes the entire process much more trustworthy.
Composition
Finally, before we break down the smart contract completely let’s understand, what a transaction is? Transaction on a chain has 4 main components
Nounce : it’s a serial number
To: to whom is the amount is being sent to
Value: it’s the value being sent
V/R/S: This is a complex concept; here your private key generates v, r and s values which in turn produce an intermediate code. This intermediate code can derive your account number but not reproduce your private key/
A smart contract is similar to a transaction but it is controlled by a code as mentioned above. The components of the smart contract are:
CODE (the condition for it to execute)
Balance: the amount of money present in the contract
Storage: any type of data the application uses
Also, there’s one major difference between a smart contract and a transaction. The transaction with the same account can be made on multiple networks but a smart contract can only be used on one network once it’s deployed.
Hope you learned something new from this blog. Lemme know your thoughts on this topic in the comments :^)