Whether you’ve looked into recent VC reports or were catching up on technology trends, you’ve heard about smart contracts. After blockchain became a phenomenon in 2017, smart contracts have been attracting the attention of investors and average customers alike. Even people who aren’t normally following tech trends became more aware of blockchain and its impact.
Smart contracts aren’t something abstract, distant from your business. This technology can be implemented in your company regardless of the industry – as soon as you have to deal with agreements and transactions. What are smart contracts and how they work, and most importantly, how can you get tangible profits? So, here and now – Ethereum contracts explained.
What is blockchain?
Blockchain is a system of decentralized nodes, comprised of a network’s resources of each connected device where transaction data is distributed and stored.
Blockchain and safety
All transactions are performed via computations. Firstly, a user requests a transaction. The block with the data for the transaction is created automatically. This block is sent to every network device (node), and all nodes have to validate the request.
Because blockchain enables such transparent access to the history of transactions, transfer participants can always take a step back and examine these records to determine the validity of a transaction. It doesn’t require additional documents, IDs, confirmation – all the confirmation data is the blockchain.
What is a smart contract?
The concept of verification of the transaction, crucial to the blockchain, leads us to the concept of smart contracts. The definition goes: it’s a self-executing agreement where the terms and conditions are specified by code algorithms. Blockchain transactions are based on computing, and smart contracts use it to their advantage by creating systems that either promote or block the transfers.
How do smart contracts work? The code is distributed among all members of the network – there is no centralized authority that holds all the documents along with the control over the process. There is no human factor: the transaction is overseen by code automatically.
Because transactions are inevitably documented in each block, it’s easy to track every transfer. Both parties can take a look at the condition at any time and receive full data on the transaction after it was completed.
The role of smart contracts
Smart contracts have a wide purpose. With their transparency and secure data storage, many industries are ready to adapt the innovation – let’s take a look at just some examples.
Insurance
Traditional institutions don’t have automated algorithms for reviewing and approving the insurance claim. It takes months to prepare all the documents, undergoes consults, and settle with another party. Both insurance companies and their clients would profit from speeding up the process – providers could accomplish more during work hours, and customers would receive better service.
Smart contracts would automatically create the set of conditions accepted by two parties and assemble them in a contract. Both parties have real-time access to their progress. Whenever an insured item was damaged, the smart contract would recognize the event and immediately send the claim to the company.
Supply chain management
Supply chain management involves a lot of transactions – goods production, transportation, storage, delivery all need to be assessed and paid for. Smart contracts can store ownership rights with unique owner keys and keep a real-time database of the product’s progress.
Controlling the product at any given stage of the supply chain would become much easier. With the Internet of Things and wireless sensors, an Ethereum developer can automate the process of negotiation and execution of a contract.
The main value of smart contracts is that they can execute previously determined conditions, with no way for parties to change their minds. All conditions are recorded in an immutable ledger, where it can’t be edited or deleted. Blockchain data can’t be tampered, and therefore, can be trusted.
Employment agreements
Specifying the requirements between an employer and employee is tedious work. At the end of the day, the contract isn’t clear to both parties, and they don’t know how to oversee if the expectations were met or not.
Smart contracts make these conditions objective and tangible – employees would have to meet certain results or log at a certain time for the financial transaction (their salary) to be transferred to the accounts. Any changes of the contract would be stored in the node – both parties have real-time access to the latest version of the agreement.
Copyright protection
Tracking the usage of a piece of content manually is nearly impossible, especially given international-wide access to resources. Owners can’t monitor markets in different countries to check if their creative work isn’t illegally used. Ethereum programming and AI, on the other hand, can perform smart search and detect the cases of illegal material usage.
Also, smart contracts are helpful in the process of settling the entitlement. Some parties can get a hold of other people’s royalties, leaving some contributors underpaid. Smart contracts will make sure that the transaction corresponds to the condition and treats every participant equally.
How does Ethereum work?
This is achieved with the Ethereum network – each network participant can execute the computation, relying on all other connected devices to analyze and approve the code. It’s done automatically, so there is no chance of human error.
Ether is the transaction currency
Smart contracts use cryptocurrency to power up transactions. Ethereum uses its coin – Ether, to work with transactions on the platform. However, it’s quite common to see “Ethereum” instead of “Ether” as a coin name – for instance, Coinbase offers its users to buy Ethereum.
Ether tokens are used for Ethereum transactions, and their conditions are specified by smart contracts. Developers can create Ethereum-based smart contracts – that means that the users have to use Ethereum to sell and acquire services or goods. On some services, Ethereum is used as an intermediary coin – it can be exchanged on Bitcoin or other cryptocurrencies.
How do Ethereum smart contracts work?
Ethereum provides network members with access to the Ethereum Virtual Machine (EVM) – a decentralized blockchain computer where developers can build smart contracts and embed them into the application. It’s a virtual computer where all Ethereum contracts are executed.
Because it’s decentralized, the execution doesn’t really take place on one device, but instead uses the resources of all connected members – there is no single computer that can be targeted.
The contracts are built with Solidity – a language for writing smart contracts, similar to JavaScript, as well as other frameworks and tools. Contract owners can create their own arbitrary rules for transaction formats, functions, and ownership.
Ethereum smart contract tutorial
To get a deeper understanding of getting started with Ethereum, you need to understand the main stages of the process. We won’t get too much into detail – which tabs to open or what code lines to write – we’ll link educational resources below – rather, give you a general idea of how to write a smart contract.
Stage 1 – Getting Ethereum nodes ready
Ethereum nodes are devices that use protocols for Ethereum mining. Whenever you or a user of your application connects to the Ethereum protocol, you are running a node.
Some developers prefer to create custom nodes while others connect to the interface that already works with ready nodes – developers can connect their projects to the existing blockchain. An example of such an interface is MyEtherWallet – a client-side interface for Ethereum development and management.
To get your device recognized as a node, you need to write an appropriate code with Go, Python, or C++. Also, you’ll need additional files like ENTIRE Ethereum blockchain and Geth. Also, be sure to free up 35 GBs of storage before you start preparing a node.
Stage 2 – Learning Solidity
Understanding Solidity, Ethereum smart contract language, will be easy for developers that are already familiar with Javascript. Languages are very similar by their syntax and purpose – it’s a contract oriented language that will be used to communicate with the Ethereum Virtual Machine.
Similarly to all languages, you need to program a “Hello World” contract, where you will create a state variable and assign it a function – the action that renders the contract active, as well as the function that blocks the contract. We recommend taking a look at the official Solidity tutorial for more details.
Stage 3 – It’s time to deploy the contract in Ethereum
To deploy the final contract, developers usually use additional tools and frameworks. Let’s take a look at the most popular ones.
- Truffle and Embark. The software allows you to build, test, and deploy your smart contract in a single software. It’s simple, equipped with detailed guidelines, and has a clear interface. Even people who didn’t work in Ethereum development or JS before will easily understand the logic of writing the first contract. Also, the software has a built-in organization system that manages existing contracts – this will get important once your contracts accommodate more than one function or condition.
- Meteor. A web app that allows writing testing, and executing a smart contract in the browser via web3 js. This one has a lot of great integrations and extensions, and most of them are open source. You can use code libraries, automate simple writing processes, and download a debugger – among many other things.
- Ethereum Studio – a popular web IDE, developed by Ether.Camp. IDE provides access with testing sandbox as well as generates GUI for contract execution. Developers and testers don’t have to test Ethereum code manually – all it takes is pressing buttons in customized interface, which is both faster and easier.
- MyEtherWallet – a free interface for interacting with Ethereum networks. You can work with open-source software to create wallets and work with smart contracts. The service is used by businesses to host their wallets and manage ETH.
Examples of successful Ethereum contracts
Before getting started with coding Ethereum smart contracts, it’s always helpful to take a look at successful solutions on the market. Let’s take a look at the most prominent software, based on Ethereum smart contracts.
1. CryptoKitties
This is one of the best-known applications of an Ethereum contract – the app effectively became the first game that uses blockchain and smart contracts in its functionality.
The concept of the game is simple – users have access to collectible kitties that can be purchased and exchanged with Ethereum. It’s a form of crypto investment, combined with fun internet and gamification functionality.
Each user has a right to “breed” a CryptoKitty by acquiring two Kitties and running a smart contract to create a new one, based on characteristics of these two. The more advanced are the original Kitties, the more expensive the “newborn” ones will be.
These Kitties can later be traded for more advanced individuals – basically, natural selection in action, only it’s powered by Ethereum smart contracts and Ether. In the end, users who have the most upgraded Kitties have the highest chances of getting a huge deal.
What makes CryptoKitties fundamentally different from similar non-blockchain collectible games? Usually, games have a centralized server where all data is stored. Even if you buy an in-game collectible, it belongs to you only “on paper” – you don’t access the files on the centralized server.
Blockchain, on the other hand, allows users to truly own their kitties – all the data is stored on their server, and the information about the Kitties’ rightful owner and transaction history are deeply embedded in code.
The application faced its peak in December 2017, when the overall cost of all purchased Ether amounted to $12 million on CryptoKitties – the most expensive one cost as much as $120,000.
2. AXA’s flight insurance
Another Ethereum contract example – AXA, a French insurer, reported to have started exploring blockchain for simplifying the insurance deals. Their smart-contract platform aims to solve a common problem – clients often struggle to receive compensation for delayed flights – even those who have flight insurance.
The problem is, many conditions specify the sum and the condition of receiving the insurance money – and it takes a long time to process this information. It creates an issue for the end customer – a client needs the compensation immediately to be able to buy a new ticket.
Fizzy, AXA’s custom smart contract platform has access to all flight schedules and passenger data. As soon as it detects that the customer’s flight was delayed for more than two hours, the platform offers a compensation choice. The customer only has to select the most comfortable way for receiving the money, confirm card data – and the amount is automatically sent to the card.
3. Authenteq
Another European startup that uses smart contracts to identify personal data left online – passwords, codes, contact information, fingerprints, photos. The software protects users’ privacy but also has a practical application – it allows verifying on any site automatically, connecting the personal information that has already been used on another site.
All this personal data is stored on the decentralized network, which is a great solution for data security – hackers don’t have a single point for targeting.
The startup offers the fastest identity verification solution on the market – the whole process takes up as much as 60 seconds – and it recently raised 4.4 million euros in Series A from Draper Associates and Capital 300.
The company tapped into a growing niche – as online transactions are getting more common, users have to verify their identities all the time, and it’s a time-consuming and potentially dangerous activity – if data isn’t stored and encrypted safely. In such conditions, it doesn’t come off as a surprise that the verification-as a service market now amounts to $10 billion worth.
Let's discuss which IT outsourcing trends will change the industry.
FAQ
Is a smart contract a contract?
Yes, it is a contract. Such an agreement has all features of a legal document – conditions for execution and termination – but also provides full access to the transaction history and cuts off intermediaries by allowing both parties to participate in the process directly. Such contracts can specify any kind of transaction or data exchange – from legal employment or copyright contracts to banking operations.
What is meant by a smart contract?
A smart contract is an automated agreement that’s fully executed with code. The computer specifies and stores the conditions for the enforcement and termination and makes sure that both parties receive equal outcomes – or the ones that respond to particular conditions.
The contracts can be enforced either legally or with tamper-proof execution (tamper-proof algorithms require the approval of all participants of the network). It’s decentralized – the execution isn’t controlled by a single authority, and there is no intermediate person who has access to changing the contract.
What is the difference between Bitcoin and Ether?
Bitcoin and Ether (also often known as Ethereum) are both blockchain currencies, powered by disturbed ledgers and crypto algorithms. However, they have different block times with Ethereum being much faster, and key algorithm differences – Blockchain is powered by SA-256, whereas Ethereum applies ethash. Both currencies allow performing transactions, but Ether also allows token creation and provides smart contract support.
Is Ethereum a currency?
Еther is the native currency of Ethereum, a decentralized platform for building smart contracts. The currency is used to execute smart contracts in Ethereum-based platforms and allow users to exchange goods and services online, without being tied to a particular country.
The bottom line
Smart contracts represent a universal technology that holds promising perspectives for multiple industries. It is already widely used in fintech, investment, insurance, real estate, but really, smart contracts can be used to substitute all other forms of agreements in different industries.
It may already be happening – even if not on a large scale yet. In almost any industry, from healthcare to entertainment – you can find promising startups that offer social contracts instead of traditional documentation methods.
The benefits of smart contracts are obvious. It’s a secure way of specifying agreements’ conditions, providing all involved parties control over contract negotiation and execution. Most importantly, it cuts off the middlemen and unnecessary centralized authority, making the process of contract creation much cheaper and faster.
If you have decided that your business is ready for smart contracts, contact us to dive into some more details and start creating one.
Need a qualified team?
Boost your business capacity with the dedicated development team.