Solidity Blockchain for Business – web3devs Development Company

Blockchain for Businesses: What is Solidity?

The challenge with understanding the blockchain is that it is a new and evolving technology. A lot of talks are happening online. But few resources offer a succinct overview of the blockchain’s key features and processes beyond the crypto-space.

In this post, we’ll dive into the concept of smart contracts and the main programming languages used to code them – Solidity. This post may get a bit technical and assumes that you already somewhat familiar with the blockchain technology.

Solidity as a Language for Smart Contracts

To recap, a smart contract is a set of programmable instructions, intended to automatically facilitate, enforce and verify the execution of an agreement. Unlike traditional paper contracts that only record the agreement details, smart contracts guarantee the execution of recorded obligations.

For example, you want to rent a car from a friend abroad during your vacation. Instead of formalizing the deal through a lawyer or another third-party, you can manage it with the help of blockchain. You can create a smart contract, and pay the rental fee in your currency (USD). The contract can be programmed to convert the funds to a cryptocurrency and afterward convert the payment to your friend’s currency (EURO) for a low fee. You will receive a “virtual receipt” and a “digital key” to use the car when you arrive.

If you do not receive the “key” on time, the smart contract will automatically refund you. If the “key” arrives earlier than the rental date, the smart contract will release the “key” and the payment on the due date only. If the payment does not go through, the car will remain digitally locked. Smart contracts are based on the premises that “code is law” – both parties are guaranteed to receive the described service.

The particular appeal of smart contracts for businesses can be summed up in the following points:

  • Smart contracts allow two parties to organize a secure value exchange without a need for a middleman. You don’t need to be in the same place or use the same currency to sign a secure deal.
  • Smart contracts are immutable – they are witnessed by hundreds of other blockchain users. The coded agreement cannot be altered by either party without the community being notified.
  • The recorded agreements are easy-to-audit.
  • Smart contracts are time-sensitive and can be programmed to cover a very specific time frame. They start and end automatically.

Solidity is the most popular functional scripting language for developing smart contracts. Proposed by Gavin Wood (former CTO of Ethereum), and developed by a dedicated team of blockchain developers, it is the main language used to program smart contracts on Ethereum Virtual Machines. Solidity can be compiled into EVM bytecode with the help of respective tools. The generated EVM machine-level bytecode can function on the Ethereum nodes to process various operations such as payment exchanges.

Ethereum Virtual Machine & Dapps

Ethereum Virtual Machine is a runtime environment for smart contracts. It is sandboxed, meaning that the code deployed inside an EVM has no access to the network, other processes, or file systems. One smart contract can have a limited or no access to another smart contract.

EVM is a Turing-complete system, meaning it can be programed to run any type of application. It’s important to understand, though, that smart contracts do not equal a blockchain application. A high-performance blockchain application can consist of several smart contracts, governing different processes, not just one.

Using Solidity, to compile EVM machine-level bytecode, developers can create decentralized applications that exist on the blockchain network and fully rely on the network’s resources e.g. computing power and bandwidth.

Dapps (decentralized applications) typically have frontend code and graphic user interfaces written in any language similar to a web application or mobile app, while the backend is powered by smart contracts running on a decentralized peer-to-peer network like Ethereum.

  • Traditional app = Frontend/GUI + centralized servers.
  • Dapp = Frontend/GUI + smart contracts (decentralized platform).

Let’s illustrate this further. Using WordPress plugin development as an example case; most users now store their files (e.g. media) either on WordPress itself or in an off-site cloud service like Amazon S3. There are a lot of S3 plugins available in the WordPress repository and they are in-demand.

But what if, instead of renting space from a commercial provider, WordPress users could rent space from other users?

Blockchain programming made that possible. Storj, a Dapp, enables users to sell/buy storage from one another. Data storage terms are negotiated and governed by a smart contract, signed between the two parties. The platform also offers a blockchain API that developers can leverage for their applications or plugins.

The benefits of such product are as follows:

  • Low costs: Dapps’ operational costs are low as they run on “shared” resources. The costs of usage are low, too. Storj charges just $0.015 per GB of stored data. For comparison, Dropbox pricing starts at $9,99/month.
  • Increased Security: Data stored on the blockchain is encrypted with the state-of-art cryptography; reducing the chances of data theft to a bare minimum.
  • No Single Point of Failure: Unlike traditional cloud service providers, decentralized networks are immune to on-site outrages or technical failures that can hamper the service’s performance.

A similar WordPress plugin or another decentralized application can be written in Solidity – the flagship programming language on the Ethereum platform.


Ethereum Solidity: Key Features

  • Solidity functions on the basis of “If-This-Then-That” logic. It takes high-level, human-readable code and breaks it down into specific instructions, more understandable for machines.
  • Solidity is compiled to bytecode that is executable on the EVM.
  • It has a similar syntax to JavaScript and C++, making it easier to learn blockchain development basics for those with respective skills. The source code for Solidity  is even written in C++.
  • Solidity is statically typed, supports inheritance, libraries and complex user-defined types.
  • Apart from Ethereum, Solidity can be used for programming smart contracts on other platforms such as Monax and its Hyperledger; Burrow blockchain; Tendermint, Counterparty, and Zeppelin by Digital Currency Group.
  • At the moment, Solidity is supported by several integrated development environments – Remix, the official Solidity IDE; Microsoft Visual Studio; Tendermint on Microsoft Azure by PWC, and Hyperledger Burrow (formerly eris-db).
  • Solidity Dapp development is often done within the Truffle Framework which allows developers to combine popular JavaScript libraries with the web3.js Ethereum JavaScript API and a local EVM called Ganache into a workflow that is identical to MEAN or MERN stack web development.
  • Ethereum also used to support two other languages – Serpent and Mutan (both deprecated). The alternative programming languages to Solidity are – LLL (Low-level Lisp-like Language) and Viper (in development).


Solidity vs. Viper vs. LLL – What is a Better Choice for a Smart Contract?

Brian Wentzloff, our CTO, points out that the Ethereum/Solidity community is the largest and best established in the space. Working with the available tools allows you to draw on the collective experience and best practices of that large community – there’s a lot of documentation, best practices and open-source code bases already available.

Basically, by choosing Ethereum and Solidity there’s a lot less wheel inventing and more focusing on meeting the goals of your project.

Viper, a newer addition to the Ethereum platform, is a largely experimental language. While it appears promising for a lot of developers, it is still in pre-alpha stage, lacks proper documentation, and is not completely functional-friendly as Vitalik Buterin points out in his release notes.

“Viper is NOT meant to be one-language-to-rule-them-all and is not meant to replace Serpent, Solidity and LLL. The reasoning behind starting fresh was to provide greater freedom for initial experimentation without stepping on anyone’s toes, to provide different properties and tradeoffs compared to existing languages, and to increase choice.”

Vitalik Buterin, Founder of Ethereum & Viper

LLL (Low-level Lisp-like Language) so far has received more support in the blockchain development community. Daniel Ellison, one of the avid LLL enthusiasts, provides a great list of reasons for choosing this language over Solidity:

  • LLL gives developers direct access to memory and storage. This enables you to arrange the contract data in an optimized manner and ensure the most efficient access to it.
  • LLL provides complete access to all EVM opcodes. This, in turn, gives your contracts power and brevity.
  • LLL contracts tend to compile down to shorter binaries. Daniel managed to achieve a LLL binary 70% smaller than the Solidity equivalent.

However, LLL smart contracts still lack easy verification mechanisms and have a relatively small user base, making it a less solid choice for business applications on the blockchain.


Smart Contract Development Challenges on Public Blockchains

Ethereum may be the prime smart contract platform, yet it’s not without certain drawbacks. Blockchain technology is relatively new and still needs to establish better scaling mechanisms.

Transaction processing times and costs on the Ethereum blockchain are highly volatile. The network’s participants are incentivized with block rewards and transaction fees to validate newly recorded information and maintain the network’s security.

The transaction volume growth positively correlates with the coin’s transaction fees. For businesses, it may be hard to estimate the ongoing costs of a decentralized application based on a public blockchain.

Image Source:

Ethereum’s founding team has already addressed this issue and announced the move to a hybrid “proof of stake”/ “proof-of work” protocol that should reduce the energy consumption associated with mining; address mining pool centralization issues; and ultimately lead to a more stable and effective functioning of the network and more predictable transaction fees.

Ethereum network can only process 20 transactions per second. Litecoin blockchain has a maximum capacity of 56 tx/second and the Bitcoin blockchain is limited to just 7 tx/second. For comparison, PayPal averages with 190 tx/second and Visa is capable to manage approximately 1,600 transactions per second.

Here’s where this limit comes from. The Ethereum system is fueled by “gas” – a metric used for evaluating the cost of a certain computation. For example, Jane and Lisa create a smart contract with a number of clauses. The Ethereum network estimates that executing the entire agreement will require a certain amount of computational power (gas). Lisa agrees to pay the gas fee used up by this contract.

The problem is that each new Ethereum block can include only 6.7 million gas.

Image Source: Hackernoon

Whenever the network becomes congested, it takes more time for miners to package transactions into new blocks and thus the transaction processing time increases. Additionally, it takes time for the community to reach consensus on the validity of a certain transaction.

All the participants (nodes) follow a trustless system, meaning that they need to independently perform the calculations to verify one transaction. Each node must have their personal copy of the blockchain in order to do so. Considering the current Ethereum blockchain size, you can imagine why the process is rather slow.

Developers are proposing different solutions to the described scalability issues. For example, the Monero blockchain introduced a dynamic block size and aims to process 1,000 tx/second with a varying degree of success.

EOS blockchain plans to process over 1,000 tx/per second with a new distributed proof-of-stake consensus mechanism that is still largely in works.

In general, all public blockchains engage in a “balancing act” of affordable and fast transaction fees versus a higher level of decentralization. The increasing popularity of the blockchain leads to higher requirements for storage, bandwidth and computing power by the participants. To keep the costs at bay, it makes sense to require only certain nodes to validate a transaction, but the tradeoff is the increased network’s centralization.

Instead of relying on a public blockchain, businesses can choose to create custom forks of the Ethereum blockchain – permissioned blockchains with a varying level of centralization that do not require a large pool of external validators to review and record transactions.  

To learn more about smart contract development and business use cases of blockchain technology you can schedule a consultation with our expert team.

Unsure about a blockchain solution?

Schedule a discovery call, today!