Solidity is an
object-oriented programming language
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
for implementing
smart contract
A smart contract is a computer program or a transaction protocol that is intended to automatically execute, control or document events and actions according to the terms of a contract or an agreement. The objectives of smart contracts are the re ...
s
on various
blockchain
A blockchain is a type of distributed ledger technology (DLT) that consists of growing lists of records, called ''blocks'', that are securely linked together using cryptography. Each block contains a cryptographic hash of the previous block, ...
platforms, most notably,
Ethereum
Ethereum is a decentralized, open-source blockchain with smart contract functionality. Ether ( Abbreviation: ETH; sign: Ξ) is the native cryptocurrency of the platform. Among cryptocurrencies, ether is second only to bitcoin in market cap ...
. It was developed by Christian Reitwiessner, Alex Beregszaszi, and several former
Ethereum
Ethereum is a decentralized, open-source blockchain with smart contract functionality. Ether ( Abbreviation: ETH; sign: Ξ) is the native cryptocurrency of the platform. Among cryptocurrencies, ether is second only to bitcoin in market cap ...
core contributors. Programs in Solidity run on
Ethereum Virtual Machine.
History
Solidity was proposed in August 2014 by
Gavin Wood
Gavin James Wood (born 1980) is an English computer scientist, a founder of Ethereum and creator of Polkadot and Kusama.
Early life
Wood was born in Lancaster, England, United Kingdom. He attended the Lancaster Royal Grammar School. He graduat ...
; the language was later developed by the Ethereum project's Solidity team, led by Christian Reitwiessner.
Solidity is the primary language on
Ethereum
Ethereum is a decentralized, open-source blockchain with smart contract functionality. Ether ( Abbreviation: ETH; sign: Ξ) is the native cryptocurrency of the platform. Among cryptocurrencies, ether is second only to bitcoin in market cap ...
as well as on other private blockchains, such as the enterprise-oriented
Hyperledger
Hyperledger (or the Hyperledger Project) is an umbrella project of open source blockchains and related tools, started in December 2015 by the Linux Foundation, and has received contributions from IBM, Intel and SAP Ariba, to support the collab ...
Fabric blockchain.
SWIFT
Swift or SWIFT most commonly refers to:
* SWIFT, an international organization facilitating transactions between banks
** SWIFT code
* Swift (programming language)
* Swift (bird), a family of birds
It may also refer to:
Organizations
* SWIFT ...
deployed a proof of concept using Solidity running on Hyperledger Fabric.
Description
Solidity is a
statically typed programming language
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer program ...
designed for developing smart contracts that run on the
Ethereum Virtual Machine (EVM).
Solidity uses
ECMAScript
ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262
ECMAScript is commonly used for client-side scriptin ...
-like syntax which makes it familiar for existing web developers; however unlike ECMAScript it has static typing and
variadic In computer science, an operator or function is variadic if it can take a varying number of arguments; that is, if its arity is not fixed.
For specific articles, see:
* Variadic function
* Variadic macro in the C preprocessor
* Variadic template
* ...
return types. Solidity is different from other EVM-targeting languages such as Serpent and Mutan in some important ways. It supports complex member variables for contracts, including arbitrarily hierarchical mappings and
structs
In computer science, a record (also called a structure, struct, or compound data) is a basic data structure. Records in a database or spreadsheet are usually called "rows".
A record is a collection of ''fields'', possibly of different data types ...
. Solidity contracts support
inheritance
Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offici ...
, including
multiple inheritance
Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object o ...
with
C3 linearization. Solidity introduces an
application binary interface
In computer software, an application binary interface (ABI) is an interface between two binary program modules. Often, one of these modules is a library or operating system facility, and the other is a program that is being run by a user.
An ...
(ABI) that facilitates multiple
type-safe
In computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes alternatively considered to be a property of facilities of a computer language; that is ...
functions within a single contract (this was also later supported by Serpent). The Solidity proposal also includes "Natural Language Specification", a documentation system for specifying user-centric descriptions of the ramifications of method-calls.
Example of a Solidity program:
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract Coin
Development platform availability
*
JetBrains IntelliJ Plugin
JetBrains s.r.o. (formerly IntelliJ Software s.r.o.) is a Czech software development company which makes tools for software developers and project managers. , the company has offices in Prague; Munich; Berlin; Boston, Massachusetts; Amste ...
*
Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
*
Microsoft Visual Studio Code
Blockchain platforms
Solidity is available on:
*
Avalanche C-Chain
*
Binance Smart Chain
*
Counterparty
A counterparty (sometimes contraparty) is a legal entity, unincorporated entity, or collection of entities to which an exposure of financial risk may exist. The word became widely used in the 1980s, particularly at the time of the Basel I deliberat ...
(which runs on
Bitcoin
Bitcoin ( abbreviation: BTC; sign: ₿) is a decentralized digital currency that can be transferred on the peer-to-peer bitcoin network. Bitcoin transactions are verified by network nodes through cryptography and recorded in a public di ...
)
*
Ethereum
Ethereum is a decentralized, open-source blockchain with smart contract functionality. Ether ( Abbreviation: ETH; sign: Ξ) is the native cryptocurrency of the platform. Among cryptocurrencies, ether is second only to bitcoin in market cap ...
*
Ethereum Classic
Ethereum Classic is an open source, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It supports a modified version of Nakamoto consensus via transaction-based state transitions executed on a p ...
*
Tron
''Tron'' (stylized as ''TRON'') is a 1982 American science fiction action-adventure film written and directed by Steven Lisberger from a story by Lisberger and Bonnie MacBird. The film stars Jeff Bridges as Kevin Flynn, a computer programme ...
*
Hedera Hashgraph
Criticism
Many security properties of smart contracts are inherently difficult to reason about directly, and the
Turing-completeness
In computability theory, a system of data-manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be used to simulate any Tur ...
of Solidity means that verification of arbitrary properties cannot be
decidably automated. Current automated solutions for smart contract security analysis can miss critical violations, produce false positives, and fail to achieve sufficient code coverage on realistic contracts. Solidity has been blamed for the error-prone implementation of Ethereum smart contracts due to its counterintuitive nature, its lack of constructs to deal with blockchain domain-specific aspects, and its lack of centralized documentation of known vulnerabilities.
In 2016, a
Cornell University
Cornell University is a private statutory land-grant research university based in Ithaca, New York. It is a member of the Ivy League. Founded in 1865 by Ezra Cornell and Andrew Dickson White, Cornell was founded with the intention to ...
researcher stated that Solidity was partially to blame for
The DAO hack that took place that year. He stated: "this was actually not a flaw or exploit in the DAO contract itself: technically the Ethereum Virtual Machine (EVM) was operating as intended, but Solidity was introducing security flaws into contracts that were not only missed by the community, but missed by the designers of the language themselves."
References
{{Cryptocurrencies
Domain-specific programming languages
Statically typed programming languages
Ethereum