Back in 2015, when Ethereum was initially released, blockchain technology was no longer new to the world, but it was the successful implementation of smart contracts that put this blockchain platform ahead of the game.
The concept of smart contracts was first proposed by Nick Szabo in the early 1990s. This American computer scientist and cryptographer described smart contracts as “a set of promises, specified in digital form, including protocols within which the parties perform on these promises”.
His idea was brought to life almost 20 years later when blockchain technology came onto the stage. Nowadays, most people interested in blockchain technology associate smart contracts with the Ethereum blockchain platform.
The innovation is so successful that the smart contracts market is growing by leaps and bounds. It is expected to reach $300 million by 2023 with a 32% CAGR. But what stands behind this term, and what makes many world-renowned companies and developers implement Ethereum-built solutions and exploit smart contracts? Let’s find out.
What are smart contracts?
A smart contract is a kind of contract of the future: the terms of the agreement between the parties to the transaction are written in lines of code, and the smart contract is executed automatically if all the conditions embedded in the code are met.
Let’s say you were going to sell an apartment. A relatively convenient way would be to contact a real estate agency, which would act as an intermediary between you and the potential buyer. However, this procedure would still involve tons of paperwork, phone calls, meetings at the office, and, not surprisingly, nerve cells.
Imagine that all this work can be delegated to smart contracts. In the case of the sale of an apartment, the smart contract will execute the terms of agreement automatically and the ownership will pass to the buyer immediately after the agreed amount of money is sent to the seller.
This example is not hypothetical: smart contracts are already used in the real estate industry. For instance, Propy completed the world’s first real estate transaction using Ethereum smart contracts back in 2017. With their help, Michael Arrington, founder of TechCrunch, bought an apartment in Kiev for $60,000 without actually coming to Ukraine.
In addition to real estate, smart contracts can be applied in absolutely any domain where there are contracts and transactions: banking, finance, legislation, insurance, retail, and so on. The world is gradually moving towards digitalization, and smart contracts are already an integral part of the process.
Smart contract use cases
Smart contracts promote a new transparent way of doing business and bring many benefits in a variety of areas. Our smart contract audit company prepared a list with specific industries and companies that have already successfully implemented smart contracts in their work.
Governments
According to the survey “Blockchain and smart contract technology in government agencies”, at least 17 countries are implementing blockchain and smart contract related projects at the governmental level. In the US, for example, an online exchange of personal health data is being developed, while in the UK, the Department for Work and Pensions is testing a social benefit system based on blockchain technology.
There are other options for using smart contracts in government agencies. For example, they can be implemented in digital currency projects and electronic voting systems.
In addition, thanks to blockchain solutions with smart contracts, voting systems can become much more transparent and secure. FollowMyVote is an existing application utilizing blockchain and smart contracts to protect the voting process from fraudulent activities. This voting software can also be used in government elections around the world.
Insurance
The insurance industry needs transparent and reliable systems to help reduce the growing number of fraudulent insurance claims. A number of firms are already introducing blockchain and smart contracts to address many industry issues.
A recent report says that the global blockchain in the insurance market is expected to grow from $64.5 million in 2018 to $1,393.8 million by 2023 at a CAGR of 84.9%. However, the uncertain regulatory status and lack of common standards might slow down overall market growth.
However, despite some limitations, there are companies that are trying, and have launched, blockchain-based insurance solutions.
French insurance giant AXA has launched Fizzy, a new Ethereum-based flight delay insurance product. The purpose of the platform is to store and process payments using smart contracts. AXA has said that through smart contracts, they can simplify the compensation process for both suppliers and claimants, as well as improve the relationship between the insurer and the customer.
How exactly does it work? When an AXA customer purchases flight delay insurance on the Fizzy platform, the purchase is automatically registered in an immutable ledger, and a smart contract is created on the blockchain. The smart contract is linked to global air traffic databases, so as soon as a flight delay of more than two hours is registered in the system, compensation is automatically paid.
Healthcare
Healthcare systems around the world can turn to smart contracts to record and safely transfer data. Clinics, doctors, and patients – all parties can benefit from the implementation of blockchain technology. Storage and secure monitoring of electronic health records (EHR), more efficient and transparent drug supply management, and even helping scientists with research are just some of the possibilities Ethereum-based solutions offer.
EncrypGen, for example, uses smart contracts to receive and transfer patient data in a secure manner, preventing third parties from accessing the information. The platform became the first and is so far the only blockchain-based free market for genomic data in the world. The company says they are committed to democratizing and decentralizing science, allowing people to make choices and reap the monetary benefits of their contributions to research.
ICOs
If you have an idea for your own blockchain project, but can’t afford to implement it yet, you can launch your ICO campaign. ICO, short for Initial Coin Offering, is a crowdfunding system for new applications using blockchain technology.
Let’s take a look at a real-world example – the KickICO platform. The idea is simple: innovative and promising blockchain startups launch their campaign through the platform, issue tokens, and invite investors to buy them and thus invest in their new company.
This online reward and donation crowdfunding platform is built on Ethereum smart contracts and offers its own KickCoin token. After launching in 2017, the platform received the title of “ICO of the Year”. To date, more than $500 million and 800,000 ETH has been raised with the help of KickICO.
In addition to the listed industries and solutions, blockchain and smart contracts are also applicable in digital identity management, education, property ownership, agriculture, business management, games, and other fields.
PixelPlex is always here to help you develop your own enterprise blockchain applications
Ethereum as a leading blockchain platform for building dApps
There are many blockchain platforms that allow developers to create new decentralized applications with smart contracts, but so far Ethereum is widely considered one of the most well-known and useful. Here are some facts about this decentralized software platform:
- Ethereum was proposed in 2013 by a Russian-Canadian programmer Vitalik Buterin. In the summer of 2014, Buterin and other Ethereum founders launched a crowdfunding campaign, in which new participants were invited to purchase Ethereum tokens as shares in the project. In this way, the founders raised more than $18 million and launched the platform a year later.
- The Ethereum developers realized that the capabilities of blockchain technology go far beyond cryptocurrency transactions. By introducing smart contracts and opening up new opportunities and applications, the platform pioneered the second generation of blockchain (the first generation is represented by Bitcoin and cryptocurrencies).
- Ethereum is powered by its own native cryptocurrency called Ether (ETH), the next popular currency after Bitcoin. These days, it is valued at $4,269 per ETH and the Ethereum market cap has grown to over $505 billion.
- Ethereum became the first blockchain platform to facilitate asset tokenization. This process involves digitizing real assets and converting them into tokens, which can then be sold or transferred to subsequent owners.
What is Ethereum capable of?
Ethereum is constantly evolving and improving. In just 6 years of its existence, the platform has turned from an idea outlined on white paper into a real working platform with a wide range of features and capabilities. Let’s take a closer look at some of them.
Creating your own tokens
By using Ethereum smart contracts and blockchain, it is possible to create tradable tokens that can be used as a new cryptocurrency. While there are already many ways to issue tokens these days, the vast majority of them are still created using the Ethereum smart contract template called the ERC-20 token standard. As of March 2021, there are over 370,000 ERC-20 token contracts deployed on the Ethereum network.
The other two major standards are ERC-721 and ERC-1155. The popularity of the ERC-721 standard can be attributed to the recent boom in NFTs (non-fungible tokens). It is this standard that allows you to create tokens of this type. As for ERC-1155, this token standard is used to create both utility tokens and NFTs.
Developing decentralized applications
The basic idea behind Ethereum is that developers are given the ability to create and run code in a distributed system that can’t be tampered with from outside in any way. That means you can build secure dApps and interact with applications created by other users on the Ethereum blockchain.
Fundraising
Startups, companies, and individuals can use Ethereum to build crowdfunding platforms. Through Ethereum-based platforms, you can access a wide range of investors and sell shares in your company in the form of tokens, raising money for future projects.
Building online organizations
Using the Ethereum blockchain, you can create an online organization to which you can later add new members and give them the right to vote. When voting starts and members of your organization gain the number of votes specified in the smart contract, the contract is executed automatically.
With Ethereum, developers can also create gaming platforms with integrated payments in ETH, art marketplaces, DeFi solutions, token exchanges, tokenized communities, and so on.
Ethereum smart contracts explained
Blockchain technology has advanced significantly and has become widespread in various industries thanks to the introduction of smart contracts. The Ethereum platform has played an invaluable role in this process because its smart contracts have greatly expanded the capabilities of technology and ensured convenience, efficiency, and greater security for applications developed with them.
It is a fact that since the launch of Ethereum, most developers have chosen Ethereum to write their smart contracts. But how exactly does Ethereum run smart contracts?
Ethereum Virtual Machine
Ethereum Virtual Machine (EVM) is the execution environment for smart contracts in Ethereum. So, for the platform, the EVM is the fundamental consensus mechanism.
Smart contracts are usually written in higher-level programming languages such as Solidity and then compiled into EVM bytecode, which means that the machine code is completely isolated from any processes on the host computer. Every node on the Ethereum network launches an EVM instance, which allows the nodes to agree on the execution of the same instructions.
EVMs have been successfully implemented in various programming languages such as JavaScript, Python, C++, Go, Ruby, Rust, and others.
Solidity
While Solidity is not the only programming language used for writing smart contracts on Ethereum, most programmers still choose it. Solidity was originally proposed in 2014 and then developed by the Ethereum project team specifically to create smart contracts on the Ethereum blockchain platform. Those programmers who have been following the project from the very beginning and have been using the platform for many years are simply accustomed to using Ethereum Solidity.
So these days Solidity remains the primary language on Ethereum. Moreover, Solidity is used in other private blockchains running on platforms that are rivals to Ethereum.
If you are a beginner programmer planning to work with Ethereum and blockchain in general, it’s a good idea to start learning Solidity right now.
Learn more about Solidity and see how it differs from the Cadence programming language
Gas
Let’s remember how a regular car works – it simply won’t go without gas. Smart contracts work in the same way: contracts set the amount of gas that users must pay in order for them to work, and if there is not enough gas, the contract will be suspended.
The price of gas can vary depending on the complexity of the contract and the congestion of the network: if the network is congested and many users send transactions, the average gas price rises, and if activity is low, it falls. Another important benefit of gas is to protect the EVM from potential attacks that can slow down the entire system.
Deploying Ethereum smart contracts with Solidity (example with Kovan testnet)
For a smart contract to be available to users of the Ethereum network, it must be deployed. We have prepared a step-to-step guide that will help developers deploy Ethereum smart contracts in the easiest way.
1. Set up Truffle
npm install -g truffle
Make an empty repository, cd into it, then
truffle init
Install HDWalletProvider
npm install --save @truffle/hdwallet-provider
2. Create your contract
In ./contracts create a new contract called Example.sol with the following code:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Example {
function getString() public pure returns (string memory) {
return "string";
}
}
3. Deploy your contract
In ./migrations, create a deployment script specifically named 2_deploy_contracts.js with the following code:
const Example = artifacts.require("HelloWorld");
module.exports = (deployer) => {
deployer.deploy(Example, "hello");
};
4. Configure the Kovan network and the provider
In truffle-config.js, add the following snippet inside module.exports:
var HDWalletProvider = require("@truffle/hdwallet-provider");
const MNEMONIC = 'YOUR WALLET KEY';
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
},
kovan: {
provider: () => new HDWalletProvider(MNEMONIC, "wss://kovan.infura.io/ws/v3/YOUR_API_KEY")
},
network_id: 42,
gas: 4000000,
skipDryRun: true,
}
}
};
Make sure to replace MNEMONIC and API_KEY with your own.
Security note: remember to .gitignore the file containing your wallet mnemonic!
Now deploy (or migrate) your contract to Kovan as follows. By default, Truffle only deploys to the local developer network.
truffle migrate --network kovan
You should see a console log as follows:
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name: 'kovan'
> Network id: 42
> Block gas limit: 12500000 (0xbebc20)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x1d26ddbcbebdc975e0d25f68f6f960b2c02ff00f8d2209aa864d7ef60431be89
> Blocks: 1 Seconds: 8
> contract address: 0xDb9A2EBD346d5727Cd62D122b1b81852674Ba44e
> block number: 24123719
> block timestamp: 1617280548
> account: 0x7c7CBF06b87a8e349f45dAB1FE7bb813E3bDe849
> balance: 1.193820117095346919
> gas used: 191931 (0x2edbb)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.00383862 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.00383862 ETH
2_deploy_contracts.js
=====================
Deploying 'Example'
-------------------
> transaction hash: 0x65f54c156d5f10e6b140fa99bda7dc3b1de4327c894667805e9d54175734b04d
> Blocks: 2 Seconds: 12
> contract address: 0xB82262a6a26a1a64C31D1ddbEd75d66B96f6d6Ea
> block number: 24123722
> block timestamp: 1617280572
> account: 0x7c7CBF06b87a8e349f45dAB1FE7bb813E3bDe849
> balance: 1.190678937095346919
> gas used: 114721 (0x1c021)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.00229442 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.00229442 ETH
Summary
=======
> Total deployments: 2
> Final cost: 0.00613304 ETH
5. Access your deployed contract
Set up your Truffle console to Kovan network:
truffle console --network kovan
Access your deployed contract instance via:
Example.deployed();
Or you can retrieve the instance by its public address via:
web3.eth.contract(Example.abi, contractAddress);
where Example.abi is the locally compiled abi, and contractAddress is your publicly deployed contract instance.
6. Finally, invoke the contract function and say hello!
Example.deployed().then(instance => instance.getString());
And now the job is done!
Have questions about Ethereum and smart contracts? Reach out to our blockchain consultants any time
Conclusion
Ethereum has become an indispensable platform for tech-savvy companies and developers in a very short time. Today, an immense number of decentralized applications are created on the basis of the Ethereum blockchain, where smart contracts are a key feature.
Ethereum-based applications have an open, transparent, and accountable environment and can completely eliminate the need to turn to intermediaries. These dApps are used in various industries, from finance and crowdfunding to insurance, real estate, and healthcare.
The successful implementation of numerous projects proves that Ethereum and its smart contracts are not a temporary innovation, but they will continue to evolve and become the new norm in most areas of our life. So let’s not put blockchain innovation on the back burner. Instead, make a contribution to the development of this technology and start a positive transformation of your business right now.
We at PixelPlex have years of experience in developing blockchain solutions, including Ethereum-based platforms. Contact our smart contract developers who will advise you on your future project and develop the most secure and efficient decentralized application that will perfectly suit your business needs.