Ethereum Blockchain platform: What are the restrictions of Smart Contracts and how to bypass them?
Tags: ethereum, blockchain, technology, tech
Published: 2017-08-08 12:03:32

---
layout: post
title: "Ethereum Blockchain platform: What are the restrictions of Smart Contracts and how to bypass them?"
published: true
tags: ethereum, blockchain, technology, tech
cover_image: "https://thepracticaldev.s3.amazonaws.com/i/5ame3numov30f30h7f75.jpeg"
---

Smart contracts are an essential part of Ethereum network and its key peculiarity. Ethereum is a distributed Blockchain platform, for which programmers can create any computable function.
 
</span><a href="https://github.com/ethereum/solidity"><span style="font-weight: 400;">Solidity programming language</span></a><span style="font-weight: 400;"> was released exactly for that purpose. Like Java, PHP, Python and other popular programming languages, Solidity refers to the Turing-complete group. Also, its syntax is similar to one of JavaScript.
 
Thus, a smart contract is a program, compiled and recorded in Blockchain, with its own network address. With the help of this address, we can call smart contract code, while a smart contract will be run on one of the nodes, a part of Ethereum network. 

Unlike traditional programs, smart contracts run in a distributed Ethereum network and have some distinctive peculiarities and restrictions
 
While </span><a href="https://smartym.pro/blog/how-will-blockchain-innovate-a-business-world-8-industries-for-blockchain-implementation/"><span style="font-weight: 400;">Blockchain</span></a><span style="font-weight: 400;"> and </span><a href="https://smartym.pro/blog/ethereum-blockchain-platform-how-will-ethereum-change-the-business-environment/"><span style="font-weight: 400;">Ethereum are at their peak</span></a><span style="font-weight: 400;">, one can get somewhat of wrong expectations of what they’re supposed to do. Here are some cases that cannot be resolved with smart contracts.


<b>1).Transaction initiated after a certain time</b>
 

The main idea is that once initiated and recorded in Blockchain, a smart contract receives an address (along with the account’s one), and by using it we can call its code (public methods), as well as a smart contract, can perform certain actions. 

Thus, to run a smart contract we always need an external impact, a call from a network member who has the appropriate launch rights.
 
We can set up a time check in a smart contract when we can call the method initiating the payment, but here the following problem arises: we can’t attach to the block timestamp within the contract, as it can be changed by the miner, and thus disrupt the contract or make its completion result unpredictable. 

Also, this peculiarity can be used for intentional manipulation of smart contract behavior.

The only guaranteed way to make a deferred call of a smart contract is to link current time check to the number of generated blocks. 

We know an average block generation speed and we can get the exact number of generated blocks (but an average block generation speed can vary).
 
We need to periodically run a smart contract: when the number of blocks is greater or equal to the specified value – the code will be executed. 

Anyway, a smart contract can’t be launched on its own – for that we need a third-party service that will perform this operation at certain intervals.


<b>Security note:</b>

A smart contract must not send Ether during the activities completion as sending Ether can call another smart contract, which in turn may fail (for example, in the case of an incorrect address of Ether sending).
 

We will only record the number of Ether, which will take an address and implement a function, which translates the recorded amount of Ether to the address of the person who requested it. This pattern for smart contracts is called Pull Payment.


<b>2). Transactions that occur at certain intervals</b>
 
Here we face the same problem as in the previous example. A smart contract can’t be launched on its own, therefore, for the operation of periodic transactions we need an external service which will periodically run the smart contract code. 

When the payment terms are met, a smart contract will transfer the funds to the previously written address.
 
For example, we want to create a smart contract that would do employees payroll once a month. We want to keep payout addresses, payment amount, and frequency within the smart contract. We will store payment periodicity in the number of blocks that must be created before wages. 

The main goal of the smart contract is to keep the account of the created blocks from the beginning of smart contract work to the last payment, that will be updated once a day thanks to the launch of a third-party service.


Find out </span><a href="https://smartym.pro/blog/ethereum-network-what-are-the-restrictions-of-smart-contracts-and-how-to-bypass-them/"><span style="font-weight: 400;">other effective ways to avoid smart contract restrictions, with intelligent schemes and illustrations</span></a><span style="font-weight: 400;">.