Solidity Explained

Solidity
Logo Caption:The Solidity language logo
Logo Size:80px
Paradigm:Imperative
File Ext:.sol
Released:August 2014
Designer:Gavin Wood
Developer:Christian Reitwiessner,[1] Alex Beregszaszi,[2] and several former Ethereum core contributors.
Programming Language:C++[3]
Influenced By:JavaScript, C++, Python
License:GNU General Public License v3.0

Solidity is a programming language for implementing smart contracts[4] [5] on various blockchain platforms, most notably, Ethereum.[6] Solidity is licensed under GNU General Public License v3.0. Solidity was designed by Gavin Wood[7] and developed by Christian Reitwiessner, Alex Beregszaszi, and several former Ethereum core contributors.[8] Programs in Solidity run on Ethereum Virtual Machine or on compatible virtual machines.[9]

History

Solidity was proposed in August 2014 by Gavin Wood[10] The language was later developed by the Ethereum project's Solidity team, led by Christian Reitwiessner.

Solidity is the primary language used to develop smart contracts for Ethereum as well as other private blockchains, such as the enterprise-oriented Hyperledger Fabric blockchain. SWIFT deployed a proof of concept using Solidity running on Hyperledger Fabric.[11] [12]

Description

Solidity is a statically typed programming language designed for developing smart contracts that run on the Ethereum Virtual Machine (EVM) or compatible virtual machines.[13]

Solidity uses ECMAScript-like syntax which makes it familiar for existing web developers;[14] however unlike ECMAScript it has static typing and variadic 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 smart contracts, including arbitrarily hierarchical mappings and structs. Solidity smart contract support inheritance, including multiple inheritance with C3 linearization. Solidity introduces an application binary interface (ABI) that facilitates multiple type-safe functions within a single smart 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.[15]

Example of a Solidity program:[16] // SPDX-License-Identifier: GPL-3.0pragma solidity ^0.8.4;

contract Coin

Development IDEs

Editor extensions

Blockchain platforms

Solidity is available on:

Criticism

Many security properties of smart contracts are inherently difficult to reason about directly, and the Turing-completeness 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.[24] 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.[25]

In 2016, a Cornell University 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."[26]

The developers community often cites Solidity requiring much of third party interfaces and APIs, and its inability to create critical information intensive smart contracts.

Comparison with Other Smart Contract Languages

Solidity vs. Rust

Solidity is the primary programming language for developing smart contracts on the Ethereum Virtual Machine (EVM).[27] However, Rust has emerged as a strong alternative in the blockchain ecosystem, especially for blockchains that support WebAssembly (Wasm), such as Polkadot, Klever and Solana.

Memory Safety

Rust offers built-in memory safety features that prevent common programming errors, such as null pointer dereferencing and buffer overflows, which are not as rigorously enforced in Solidity. This makes Rust contracts potentially less prone to security vulnerabilities that could be exploited in smart contract environments.

Concurrency

Rust supports concurrent programming, which allows developers to write highly performant code that can handle multiple tasks simultaneously. This is particularly beneficial for high-performance blockchains like Solana,[28] which need to process thousands of transactions per second. Solidity, on the other hand, does not natively support concurrency, which can limit its performance in certain applications.[29]

Ecosystem Integration

While Solidity is deeply integrated with the Ethereum ecosystem and its numerous development tools,[30] Rust is versatile and can be used across various blockchain platforms that leverage Wasm. Rust’s growing popularity is reflected in its adoption by new blockchain projects that prioritize performance and security.

Notes and References

  1. Web site: Contributors to ethereum/solidity . 2023-03-30 . GitHub . en.
  2. Web site: Contributors to ethereum/solidity . 2023-03-30 . GitHub . en.
  3. Web site: Build software better, together . 2023-03-30 . GitHub . en.
  4. Web site: Ethereum Is The Second Most Valuable Digital Currency, Behind Bitcoin. Afshar. Vala. 2017-07-17. HuffPost. en. 2019-04-10.
  5. News: 24 November 2016 . SOFE Berlin: Swift unveils blockchain proof-of-concept . Finextra . News. 24 November 2016.
  6. Someone Just Stole $50 Million from the Biggest Crowdfunded Project Ever. (Humans Can't Be Trusted) . Wired . en-us. Finley . Klint .
  7. Web site: Wood . Gavin . January 13, 2015 . Created Solidity . 2024-03-23 . Ethereum Wiki (Archived).
  8. Web site: List of contributors. GitHub.
  9. Book: College, A. M. C. . Blockchain & Cryptocurrency Technology with Solidity Level 1 . 2022-11-01 . Advanced Micro Systems Sdn Bhd . en.
  10. Web site: Gavin Wood . dead . https://web.archive.org/web/20230330221513/https://gavwood.com/ . 30 March 2023 . 2023-03-30 . gavwood.com.
  11. 1802.06038 . cs.CR . Ivica . Nikolic . Aashish . Kolluri . Finding The Greedy, Prodigal, and Suicidal Contracts at Scale . 14 March 2018 . Sergey . Ilya . Saxena . Prateek . Hobor . Aquinas . Different source languages compile to the EVM semantics, the predominant of them being Solidity.
  12. Web site: Westpac joins SWIFT's blockchain proof of concept . 2022-07-13 . ZDNet . en.
  13. Web site: Hyperledger Fabric Tutorial - Create a blockchain app for loyalty points. IBM Developer. en-US. 2019-04-10.
  14. Web site: Language Influences — Solidity 0.8.17 documentation . 2023-03-30 . docs.soliditylang.org.
  15. Web site: Ethereum Natural Specification Format. ethereum. GitHub.
  16. Web site: Introduction to Smart Contracts — Solidity 0.8.19 documentation . 2023-03-30 . docs.soliditylang.org.
  17. Web site: Remix - Ethereum IDE . 2023-03-30 . remix.ethereum.org.
  18. Web site: EthFiddle - Solidity in the Browser. Powered By Loom Network . 2023-03-30 . ethfiddle.com.
  19. Web site: solidity - Visual Studio Marketplace . 2023-03-30 . marketplace.visualstudio.com . en-us.
  20. Web site: Solidity - IntelliJ IDEs Plugin Marketplace . 2023-03-30 . JetBrains Marketplace.
  21. Web site: Binance Smart Chain. GitHub. 26 October 2021.
  22. News: Vigna. Michael J. Casey and Paul. 2014-11-12. BitBeat: Bitcoin 2.0 Firm Counterparty Adopts Ethereum's Software. en-US. Wall Street Journal. 2021-04-16. 0099-9660.
  23. Book: Swan, Melanie. Blockchain : blueprint for a new economy. 2015. 978-1-4919-2047-3. 1st.. [Sebastopol, Calif.]. 900781291.
  24. Book: Tsankov . Petar . Dan . Andrei . Drachsler-Cohen . Dana . Gervais . Arthur . Bünzli . Florian . Vechev . Martin . Securify: Practical Security Analysis of Smart Contracts . Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security . Association for Computing Machinery . 67–82 . 10.1145/3243734.3243780 . 15 October 2018. 1806.01143 . 10044/1/87935 . 978-1-4503-5693-0 . 46936025 .
  25. Book: Atzei . Nicola . Bartoletti . M. . Cimoli . Tiziana . Principles of Security and Trust, 6th International Conference, 2017, Proceedings . A Survey of Attacks on Ethereum Smart Contracts (SoK) . Lecture Notes in Computer Science . 2017 . 164–186 . 10.1007/978-3-662-54455-6_8 . 978-3-662-54454-9 . 15494854 .
  26. Klint . Finley . 18 June 2016 . A $50 Million Hack Just Showed That the DAO Was All Too Human . Wired . News . 18 February 2017.
  27. Book: Zheng, Gavin . Ethereum Smart Contract Development in Solidity . Gao . Longxiang . Huang . Liqun . Guan . Jian . 2020-08-31 . Springer Nature . 978-981-15-6218-1 . en.
  28. Web site: Developing with Rust Solana . 2024-08-16 . solana.com . en.
  29. Web site: Rust Official Documentation .
  30. Web site: Solidity Lang .