Smart ContractsSmart Contracts are how things get done in the Ethereum ecosystem and when someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people. Smart contracts are a series of instructions, written using the programming language solidity. They work on the basis of the IFTTT logic aka the IF-THIS-THEN-THAT logic, which means that if the first set of instructions are done then execute the next function and after that the next and keep on repeating until you reach the end of the contract. This is a bit complicated and the best way to understand that is by imagining a vending machine. It is kinda like the domino effect because each and every step that you take acts like a trigger for the next step to execute itself. Now, I will examine the steps that you will take while interacting with the vending machine:
- Step 1: You insert some money in a vending machine.
- Step 2: You press the button corresponding to the item that you want.
- Step 3: The item comes out and you take it.
- You give the vending machine some money
- This gets recorded by all the nodes in the Ethereum network
- The transaction gets updated in the ledger
- You punch in the button corresponding to the item that you want
- Record of that gets updated in the Ethereum network and ledger
- The item comes out
- You collect it
- This gets recorded by all the nodes and the ledger.
EtherEvery single step in a smart contract is a transaction or a complex computation. It would have a cost that is measured in “gas” and the price of this gas is paid by the requester in “Ether”. Ether is the currency used on the Ethereum platform and when people talk about ETH and ETC they are actually talking about the value of the Ether in their respective blockchain. Every command has a specific gas limit. This ensures that a buggy piece of code doesn’t end up depleting your entire ether wallet. So basically, people are incentivized to collect Ether and that is the main reason why they fulfil their end of the bargain in a contract. What happens when your ether supply gets depleted in the middle of the smart contract? All the transactions that have already taken place during the course will go back to the original state if you do not have the ether required for all the gas payments. However, it is important to note that all transactions made in the blockchain are irreversible, which means that your ether wallet will still reflect the change in balance. When we talk about Ether, it is very important that you have two things absolutely clear:
- Ether is the currency with which everything runs in the Ethereum.
- Smart contracts are how things get done in Ethereum.
Join Our Telegram Channel or Follow @CaptainAltcoin