Solidity
Template:Short description Script error: No such module "about".
Page Module:Message box/ambox.css has no content.
Page Module:Infobox/styles.css has no content.
| Solidity | |
|---|---|
| Lua error in package.lua at line 80: module 'Module:InfoboxImage/data' not found. The Solidity language logo | |
| Paradigm | imperative, object-oriented |
| Family | ECMAScript (original) C++ (later) |
| Designed by | Gavin Wood |
| Developer | Christian Reitwiessner,[1] Alex Beregszaszi,[1] and several former Ethereum core contributors |
| First appeared | August 2014 |
| Template:Infobox software/simple | |
| Typing discipline | static |
| Scope | lexical |
| Implementation language | C++[2] |
| Platform | blockchain platforms |
| OS | Cross-platform: Windows, macOS, Linux |
| License | GNU General Public License v3.0[3] |
| Filename extensions | .sol |
| Website | soliditylang |
| Influenced by | |
| JavaScript, C++, Python | |
Lua error in mw.title.lua at line 404: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal'). 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.[7] Solidity was designed by Gavin Wood[8][non-primary source needed] and developed by Christian Reitwiessner, Alex Beregszaszi, and several former Ethereum core contributors.[9] Programs in Solidity run on Ethereum Virtual Machine or on compatible virtual machines.[10]
History
Solidity was proposed in August 2014 by Gavin Wood[11][non-primary source needed] 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 and other private blockchains, such as the enterprise-oriented Hyperledger Fabric blockchain. SWIFT deployed a proof of concept using Solidity running on Hyperledger Fabric.[12][13]
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.[14]
Solidity uses ECMAScript-like syntax which makes it familiar for web developers;[15] 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 one 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.Lua error in package.lua at line 80: module 'Module:Footnotes/anchor_id_list' not found.[16][non-primary source needed]
Example of a Solidity program:[17][18]Template:R/superscript
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract Coin {
// The keyword "public" makes variables
// accessible from other contracts
address public minter;
mapping(address => uint) public balances;
// Events allow clients to react to specific
// contract changes you declare
event Sent(address from, address to, uint amount);
// Constructor code is only run when the contract
// is created
constructor() {
minter = msg.sender;
}
// Sends an amount of newly created coins to an address
// Can only be called by the contract creator
function mint(address receiver, uint amount) public {
require(msg.sender == minter);
balances[receiver] += amount;
}
// Errors allow you to provide information about
// why an operation failed. They are returned
// to the caller of the function.
error InsufficientBalance(uint requested, uint available);
// Sends an amount of extant coins
// from any caller to an address
function send(address receiver, uint amount) public {
if (amount > balances[msg.sender])
revert InsufficientBalance({
requested: amount,
available: balances[msg.sender]
});
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
}
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.[19] 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.[20]
In 2016, a Cornell University researcher stated that Solidity was partly to blame for The DAO hack that occurred 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."[21]
The developers community often cites Solidity requiring much of third party interfaces and APIs, and its inability to create critical information intensive smart contracts.
References
Page Template:Reflist/styles.css has no content.
- ^ a b Page Module:Citation/CS1/styles.css has no content."Contributors to ethereum/solidity". GitHub. Retrieved 30 March 2023.
- ^ Page Module:Citation/CS1/styles.css has no content."Build software better, together". GitHub. Retrieved 30 March 2023.
- ^ Page Module:Citation/CS1/styles.css has no content."The Solidity Contract-Oriented Programming Language", GitHub, Ethereum, 30 March 2023, retrieved 30 March 2023
- ^ Page Module:Citation/CS1/styles.css has no content.Afshar, Vala (17 July 2017). "Ethereum Is The Second Most Valuable Digital Currency, Behind Bitcoin". HuffPost. Retrieved 10 April 2019.
- ^ Page Module:Citation/CS1/styles.css has no content."SOFE Berlin: Swift unveils blockchain proof-of-concept". Finextra (News). 24 November 2016. Retrieved 24 November 2016.
- ^ Page Module:Citation/CS1/styles.css has no content.Finley, Klint (June 2016). "Someone Just Stole $50 Million from the Biggest Crowdfunded Project Ever (Humans Can't Be Trusted)". Wired.
- ^ Page Module:Citation/CS1/styles.css has no content.The Solidity Contract-Oriented Programming Language, ethereum, 30 March 2023, retrieved 30 March 2023
- ^ Page Module:Citation/CS1/styles.css has no content.Wood, Gavin (13 January 2015). "Created Solidity". Ethereum Wiki (Archived). Retrieved 23 March 2024.
- ^ Page Module:Citation/CS1/styles.css has no content."List of contributors". GitHub.
- ^ Page Module:Citation/CS1/styles.css has no content.College, A. M. C. (1 November 2022). Blockchain & Cryptocurrency Technology with Solidity Level 1. Advanced Micro Systems Sdn Bhd.
- ^ Page Module:Citation/CS1/styles.css has no content."Gavin Wood". gavwood.com. Archived from the original on 30 March 2023. Retrieved 30 March 2023.
- ^ Page Module:Citation/CS1/styles.css has no content.Nikolic, Ivica; Kolluri, Aashish; Sergey, Ilya; Saxena, Prateek; Hobor, Aquinas (14 March 2018). "Finding The Greedy, Prodigal, and Suicidal Contracts at Scale". arXiv:1802.06038 [cs.CR].
Different source languages compile to the EVM semantics, the predominant of them being Solidity
- ^ Page Module:Citation/CS1/styles.css has no content."Westpac joins SWIFT's blockchain proof of concept". ZDNet. Retrieved 13 July 2022.
- ^ Page Module:Citation/CS1/styles.css has no content."Hyperledger Fabric Tutorial - Create a blockchain app for loyalty points". IBM Developer. Retrieved 10 April 2019.
- ^ Page Module:Citation/CS1/styles.css has no content."Language Influences — Solidity 0.8.17 documentation". docs.soliditylang.org. Retrieved 30 March 2023.
- ^ Page Module:Citation/CS1/styles.css has no content.ethereum. "Ethereum Natural Specification Format". GitHub.
- ^ Page Module:Citation/CS1/styles.css has no content."Introduction to Smart Contracts — Solidity 0.8.19 documentation". docs.soliditylang.org. Retrieved 30 March 2023.
- ^
Page Module:Citation/CS1/styles.css has no content.Schneier, Karthikeyan; Schneier, Antoine; Bhargavan, Cedric; Delignat-Lavaud, Anitha; Fournet, Gollamudi; Schneier, Bruce; Rastogi, Nadim; Sibut-Pinote, Aseem; Rastogi1, Thomas; Swamy, Nikhil; Zanella-Beguelin, Santiago (27 August 2016). "Short Paper: Formal Verification of Smart Contracts" (PDF). Microsoft Research, French Institute for Research in Computer Science and Automation, Harvard University. Archived (PDF) from the original on 27 August 2016.
{{cite journal}}: CS1 maint: numeric names: authors list (link) - ^ Page Module:Citation/CS1/styles.css has no content.Tsankov, Petar; Dan, Andrei; Drachsler-Cohen, Dana; Gervais, Arthur; Bünzli, Florian; Vechev, Martin (15 October 2018). "Securify: Practical Security Analysis of Smart Contracts". Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security. Association for Computing Machinery. pp. 67–82. arXiv:1806.01143. doi:10.1145/3243734.3243780. hdl:10044/1/87935. ISBN 978-1-4503-5693-0. S2CID 46936025.
- ^ Page Module:Citation/CS1/styles.css has no content.Atzei, Nicola; Bartoletti, M.; Cimoli, Tiziana (2017). "A Survey of Attacks on Ethereum Smart Contracts (SoK)". Principles of Security and Trust, 6th International Conference, 2017, Proceedings. Lecture Notes in Computer Science. pp. 164–186. doi:10.1007/978-3-662-54455-6_8. ISBN 978-3-662-54454-9. S2CID 15494854.
- ^ Page Module:Citation/CS1/styles.css has no content.Finley, Klint (18 June 2016). "A $50 Million Hack Just Showed That the DAO Was All Too Human". Wired (News). Retrieved 18 February 2017.
External links
Template:Ethereum Lua error in package.lua at line 80: module 'Module:Navbox/configuration' not found.