Ethereum Smart Contracts

Date:

June 21, 2018

Ethereum Smart Contracts

How to make our world better? Some developers have found a special platform making it possible to create applications and run your ICOs in a very easy way. This is a real catch for all developers and people who want to improve the quality of life. Everybody can earn money, but don’t forget that the most valuable gold is always with you, and this reservoir is without limits. This is a way to help other people’s dreams come true. That’s exactly why this platform was created. Today, everybody can manufacture digital products and offer it to their customers without intermediaries and charging fees. Other people can purchase digital products and services for the cryptocurrency on the platform.

New technologies are widely used by different companies implementing it in their products. It has a wild range of advantages including a fast speed, high level of security, anonymity, transparency, cheapness, and others. All these pros make people refuse from the bank system and use innovative technology.

How does Ethereum work?

Vitalik Buterin is a 22-year-old developer, who explains, how this platform works and which benefits it offers its users. The platform is run by the EVM providing a complete language for building smart contracts. This EVM is a distributed ledger, where every smart contract is implemented. Every action run in the Ethereum Virtual Machine is executed in every separate node of the network.

Every user is transferring assets into the system, and the process is run by the platform automatically. Due to the smart contracts, on the platform, it’s determined, if the funds go to the account of the receiver or return to the sender.

Imagine that you have a vehicle, and somebody wants to rent it. This person, who wants to rent your car for the determined period, pays Ether, and you send the digital key to this person. It has to come to them by a specified date. If this doesn’t happen on time, funds come back to the owner. If you sent the key before the rental date, the platform store the key and money till the target date. All the actions go transparently, so this platform ensures an exchange without defaults. If the participant of the deal sends Eth, they receive the key; but if the owner of the car sends the key, they receive money.

What are smart contracts?

The platform allows users to develop their smart contracts. To understand how smart contracts work you should imagine, how a vending machine works – when you interact with a vending machine, you give it some money and get a product that you need. Any provider doesn’t take part in this process. If the Ethereum network were a vending machine, then the process of developing smart contract would look in this way.

You use some cash to purchase a product from the vending machine, and the nodes of the network record this transaction. Then you push a button fitting the product you want to get. At the end of this process, the item comes out from the vending machine and this is recorded in the decentralized ledger. Due to such principles used for thean> Ethereum smart contract, every transaction gets recorded and transparent for participants.

Ethereum smart contracts make it possible to exchange assets, shares, or other things transparently without middlemen participation. When you use this platform, you pay Ether and get that you want.

How does Ether work?

Every operation executed in the network is paid in “gas”; each gas unit used for the transaction is equaled to Ether. This value depends on the gas/ETH price being changed in a very dynamic way. This cost is charged from the account by sending a transaction – if you want to buy something on the platform, you should pay a fixed sum of the cryptocurrency. Every command has a gas limit. This ensures users that in spite of the bug in the code, your Ether wallet doesn’t suffer. That’s why the main reason, why participants want to fulfill the contract to the end, they want to collect cryptocurrency.

If you don’t have enough cryptocurrency, all the transactions are withdrawn come back to the original state. You can see all the changes in balance in your Ether wallet since all transactions become irreversible.

Which availabilities do smart contracts provide?

Ethereum contract offers users a lot of benefits, among them:

  • It works as a ‘multi-signature,’ so the assets are wasted when enough percentage of people agree;
  • It offers utility for the implementation of other contracts;
  • It stores data about DAPPs and plays a role in the domain registration data;
  • It manages agreements between customers.

Ethereum and how it works

You have caught on, what smart contract is and how it works. Now, I’ll tell you what ETH means and which benefits it offers.

The first you should know about Ethereum, that this is not just a cryptocurrency, this is an environment allowing everybody to build their DAPP on the platform due to the smart contracts.

Ethereum resembles the Internet, and DAPPs resemble websites developed in it. Their owners are not individuals, they are owned by people. Everybody can run the ICO on this platform. This is a way of fundraising when everybody can purchase tokens for the digital assets and become the investor in the project.

Tokens of the platform divide into two types:

  • Usage ones. They are used as a cryptocurrency. For instance, Golem. This is DAPP, where everybody can apply services for GNT. These tokens have a monetary value and don’t give any privileges to users in the DAPP;
  • Work ones. If you purchase the work tokens, you become a shareholder in the DAPP. DAO tokens are such kind of tokens. If you had these tokens, you could vote on whether the DAO finances a particular DAPP or not.

DAPPs are decentralized applications based on the blockchain. To use them, you must use an Ethereum browser. Due to the special browser, DAPP is connecting with the Ethereum Mainnet. You can also download MetaMask extension if you have Google Chrome used as a bridge between the traditional browser and Ethereum blockchain.

For understanding, what the DAPP means, lets try to provide several examples.

One of the most popular DAPPs is Golem. This is a platform making it possible to combine the power of separate computers and laptops and join them to entire datacenters. This is a network, where economy of computing power is available. Everybody, who has joined this network, can rent their computer out or use rented computers for developing software and other purposes.

Another one is DNN. The website is run by users, but not the central authority making it possible for users to get more truthful news. Every new is checked by users, who get tokens for this, and readers reward writers of articles. That’s why they are encouraged to provide high-quality content.

One more perfect instance is uPort. It provides the users with unique digital identities and can become a good replacement for the passport and be used for voting via gadgets. In one Swiss town, this DAPP was applied for the determination of the citizen’s identity.

You will ask why we can’t use Ether within all these DAPPs, why do we need tokens. I’ll answer you using a perfect example. Remember that time, when you went to the cinema. You go to the cinema and buy a ticket. This ticket includes not only watching the film but also coca-cola and popcorn. At the entrance of the cinema hall, you show your ticket for the film, then, when you want to purchase coca-cola and pop-corn, you show again your movie ticket. This situation illustrates the assignment of the tokens.

One more perfect example to understand, why we need tokens, you should remember how you visited the amusement park. Remember, how you bought a ticket to go to the park and to gain the assets to all the amusements. Then when you are going on the roller coaster or buy some food or coca-cola, you show your entrance ticket. In this case, the amusement park is DAPP, and your ticket is a token.

Due to the tokens, the implementation of the DAPPs smart contracts is much easier. Also, they play the role of the overall value of Ether. To understand smart contracts deeper, let’s get to know, how to create tokens and a DAPP issues tokens for ETH.

What is an Ethereum contract?

To issue a token, you can go to Token Factory offering a user-friendly system for creating tokens. If you have decided to create it, you must be great at Solidity. This is a language used for building smart contracts on the Ethereum platform.

This contract can be divided into several parts including the mapping, giving the create tokens and transferring tokens to the sender. The first part of the contract, named “The mapping” has a goal to create a database showing the balance of the tokens. The balance of the tokens and transactions is open for everybody. In the second part of the code, named “Giving the creator all the tokens,” that, who issues the smart contract and tokens, becomes the owner of all tokes. And the last part of the code provides a person who invests Ether into the DAPP, receives a relevant sum of tokens.

The code is easy-understandable. It checks, whether there is a fixed quantity of tokens on the account. After that, this sum of tokens is charged from the balance of the tokens creator, and comes to the balance of the recipient.

You have caught on, what is a smart contract, but it looks perfect on the surface. If to dig deeper, you will understand, that it would be weird for wallets, exchanges and other smart contracts to interact with different DAPPs. For instance, every time, when the wallet wanted to interact with different DAPPs, it would have to re-launch the system to make it compatible with the tokens of the DAPP.

To solve this problem, Vitalik Buterin introduced a cross-functional standard. Then another developer, who found the Mist Wallet, improved this standard, added new features to it and issued ERC20 standard.

What is the ERC20 standard?

This is a list of rules, which creator of DAPPs must follow to make their token compatible with ERC20. Developers of DAPPs are encouraged to follow these rules to make their tokens compatible with different smart contracts, wallets, and exchanges. This allows interacting different DAPPs without any problems. Most DAPPs created on the Ethereum platform are based on the ERC20 standard.

To make smart contracts ERC20 compatible, there are six functions that must be used for the seamless interaction with other smart contracts. Now, I’ll bring you a list of activities required by the standard:

  • Getting a total number of tokens.
  • Getting the balance of the account.
  • Transferring tokens from the sender to the recipient.
  • The last one is proof of the token as the monetary asset.

We have caught on a lot of new about tokens, how to create tokens on the Ethereum platform, how do smart contracts work, and so on.