Smart contracts in Ethereum uncovered

Published by admin on

In what way are smart contracts and guinea pigs alike? Guinea pigs are not pigs, nor do they come from Guinea.

While contracts are words that describe what you and I agreed to do or not to do in our relationship, smart contracts are zeros and ones of a code written for a machine to fulfill specific terms of our agreement.

E.g. John’s written a book and agreed with his publisher, that they will sell it online and split 50/50. Every time somebody downloads the book from the publisher’s site, a smart contract automatically transfers half of the money to John’s account.

Mind you, those codes are actually not that smart. In fact, developers strive to keep them as simple as possible, because the less electronic brains it takes to run your program, the less it costs you. Artificial intelligence or self-learning software are completely different animals. If anything, smart contracts are more like self-spending money.

Remember vending machines we used back in old days to buy snacks and drinks? Put some coins into the slot, push button to select what you want, and the automat dispenses your M&M’s. Introducing his concept to the world in 1997, Nick Szabo called these machines the primitive ancestors of the smart contracts. The same if/when-than logic, yet… To understand the difference between ancestors and their offsprings, imagine a slot machine selling something more expensive than candies, say, diamonds or artwork. Isn’t it a bit dicey to feed a few thousand dollars into an automat? Who is there to say, that the bloody tin can won’t kill all the lights the moment it gobbles down your money?

In God we trust, all the rest goes to blockchain.

People have always needed a trusted third party to oversee high stake deals and guarantee that they proceed in good order. But now we have blockchain  Algorithms behind the technology make it virtually impossible for parties to cheat or tamper even if every single one of them wants to. The Economist called it ‘The Trust Machine’.

Technically, Bitcoin was the first blockchain-based network to run smart contracts in the sense that it moves values between people. Yet, the programming language of Bitcoin is too limited to reach beyond simple money transfers. That’s why Vitalik Buterin and team came up with a new blockchain, Ethereum, and a new language, Solidity. They allowed developers to write any conditionals and connect them into big ‘decentralized applications’ – cool and handy things like Uber or Airbnb, except now they found a way to go without a central server. How?


First, you write a code and deploy it into blockchain. All nodes of the network run your program, but, thanks to Ethereum Virtual Machine (EVM) installed on them, it is as though one central server does the job.

Since your code runs in other people’s computers and burns energy, those people (miners) should be rewarded somehow. For that purpose, there is GAS in Ethereum – a fuel you need to fill your smart contract with. Miners set the minimum GAS price in the local cryptocurrency, ether. But if you want your program to run faster, you can offer miners a higher price. Besides, since it is a public blockchain, there may be potential attackers in it. If running a program was free, such an attacker would burn all CPUs in the system, requesting contract execution all the time.


Blockchain is isolated from the outside world. That’s why when a smart contract needs to know, for example, who was the fastest bobsleigh pilot at PyeongChang, to settle a bet, it asks oracles – agents that find and verify info in real-world and submit it to the blockchain. Some oracles handle information available online. Others are sensors with anti-tampering protection, like RFIDs in supply chains.

To wrap it up, let’s see a few

Living examples

Golem utilizes an Ethereum-based transaction system to allow people to rent out their computing power.

At Augur users can forecast events and be rewarded for predicting them correctly.

The Jetcoin Institute invites sports fans to invest in their favorite athletes and benefit when a promising talent becomes a superstar.

The list goes on and on… As they say, if you can dream it, you can do it.