Solidity

Print Print
Reading time 6:46

Solidity
Solidity logo.svg
The Solidity language logo
Websitegithub.com/ethereum/solidity
Influenced by
JavaScript, C++, Eiffel, Python

Solidity is an object-oriented programming language for writing smart contracts.[1] It is used for implementing smart contracts[2] on various blockchain platforms, most notably, Ethereum.[3] It was developed by Christian Reitwiessner, Alex Beregszaszi, and several former Ethereum core contributors to enable writing smart contracts on blockchain platforms such as Ethereum.[4] The programs compiled by the Solidity are intended to be run on Ethereum Virtual Machine.

History

Solidity was initially proposed in August 2014 by Gavin Wood;[5][non-primary source needed] the language was later developed by the Ethereum project's Solidity team, led by Christian Reitwiessner.

At present, Solidity is the primary language on Ethereum[6] as well as on other private blockchains running on platforms that compete with Ethereum, such as Monax and its Hyperledger Burrow blockchain, which uses Tendermint for consensus. SWIFT has deployed a proof of concept using Solidity running on Burrow.[2][non-primary source needed][7][unreliable source]

Description

Solidity is a statically-typed programming language designed for developing smart contracts that run on the Ethereum Virtual Machine, also known as EVM.[8]

As specified by Wood it is designed around the ECMAScript syntax to make it familiar for existing web developers;[citation needed] unlike ECMAScript it has static typing and variadic return types. Compared to other EVM-targeting languages of the time such as Serpent and Mutan, Solidity contained a number of important differences. Complex member variables for contracts including arbitrarily hierarchical mappings and structs were supported. Contracts support inheritance, including multiple inheritance with C3 linearization. An application binary interface (ABI) facilitating multiple type-safe functions within a single contract was also introduced (and later supported by Serpent). A documentation system for specifying a user-centric description of the ramifications of a method-call was also included in the proposal, known as "Natural Language Specification".[9][10][non-primary source needed]

Example of a Solidity program:[11][12]

pragma solidity >= 0.7.0 <0.8.0;

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() public {
        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);
        require(amount < 1e60);
        balances[receiver] += amount;
    }

    // Sends an amount of existing coins
    // from any caller to an address
    function send(address receiver, uint amount) public {
        require(amount <= balances[msg.sender], "Insufficient balance.");
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        emit Sent (msg.sender, receiver, amount);
    }
}

Development platform availability

  • ErisDB by AWS[citation needed]
  • Hardhat
  • Microsoft Visual Studio[13]
  • Microsoft Visual Studio Code[14]
  • Tendermint on Microsoft Azure[citation needed]
  • Remix by Ethereum[citation needed]

Blockchain platforms

Solidity is available on:

  • Ethereum
  • Binance Smart Chain[15]
  • Ethereum Classic
  • Tendermint and ErisDB (a version of Tendermint)[16][citation needed]
  • Counterparty (which runs on Bitcoin)[17][18][citation needed]
  • Tron
  • Hedera Hashgraph

Criticism

Many security properties of smart contracts are inherently difficult to reason about directly, and the Turing-completeness of Solidity renders automated verification of arbitrary properties undecidable. 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 named as a significant reason for the error-prone implementation of Ethereum smart contracts due to its counterintuitive nature, lack of constructs to deal with blockchain domain-specific aspects, and lack of centralized documentation of known vulnerabilities.[20]

In 2016, a Cornell University researcher stated that Solidity was partially to blame for The DAO hack that took place in 2016. 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]

References

  1. ^ Afshar, Vala; Evangelist, ContributorChief Digital; Salesforce (17 July 2017). "Ethereum Is The Second Most Valuable Digital Currency, Behind Bitcoin". HuffPost. Retrieved 10 April 2019.
  2. ^ a b "SOFE Berlin: Swift unveils blockchain proof-of-concept". Finextra (News). 24 November 2016. Retrieved 24 November 2016.
  3. ^ "Someone Just Stole $50 Million from the Biggest Crowdfunded Project Ever. (Humans Can't Be Trusted)". Wired.
  4. ^ "List of contributors".
  5. ^ Benoit Schweblin. "StackEdit Viewer". stackedit.io.
  6. ^ Nikolic, Ivica; Kolluri, Aashish; Sergey, Ilya; Saxena, Prateek; Hobor, Aquinas (14 March 2018). "Finding The Greedy, Prodigal, and Suicidal Contracts at Scale". arXiv: [cs.CR]. Different source languages compile to the EVM semantics, the predominant of them being Solidity
  7. ^ KENTOURIS, CHRIS (13 December 2016). "Blockchain's Smart Contracts: What's Smart, What's Not". Finops (News). Retrieved 14 December 2016.
  8. ^ "Hyperledger Fabric Tutorial - Create a blockchain app for loyalty points". IBM Developer. Retrieved 10 April 2019.
  9. ^ Kapetanios-2008-06-27, p. 309.
  10. ^ ethereum. "Ethereum Natural Specification Format". GitHub.
  11. ^ "Subcurrency Example from the Solidity documentation".
  12. ^ 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.
  13. ^ Teeter, Cale (1 April 2016). "Solidity Integration with Visual Studio". Medium (website). Archived from the original on 27 November 2016. Retrieved 10 June 2021.
  14. ^ PatAltimore. "Use Visual Studio Code to connect to Azure Blockchain Service - Azure Blockchain". docs.microsoft.com. Retrieved 27 March 2020.
  15. ^ "Binance Smart Chain".
  16. ^ "What is Tendermint | Tendermint Core". docs.tendermint.com. Retrieved 15 April 2021.
  17. ^ Vigna, Michael J. Casey and Paul (12 November 2014). "BitBeat: Bitcoin 2.0 Firm Counterparty Adopts Ethereum's Software". Wall Street Journal. ISSN 0099-9660. Retrieved 16 April 2021.
  18. ^ Swan, Melanie (2015). Blockchain : blueprint for a new economy (1st. ed.). [Sebastopol, Calif.] ISBN 978-1-4919-2047-3. OCLC 900781291.
  19. ^ Tsankov, Petar; Dan, Andrei; Drachsler-Cohen, Dana; Gervais, Arthur; Bünzli, Florian; Vechev, Martin (15 October 2018). "Securify: Practical Security Analysis of Smart Contracts" (PDF). Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security. Association for Computing Machinery: 67–82. arXiv:. doi:10.1145/3243734.3243780. S2CID 46936025.
  20. ^ Atzei, Nicola; Bartoletti, M.; Cimoli, Tiziana (2017). "A Survey of Attacks on Ethereum Smart Contracts (SoK)". POST. Lecture Notes in Computer Science. 10204: 164–186. doi:10.1007/978-3-662-54455-6_8. ISBN 978-3-662-54454-9. S2CID 15494854.
  21. ^ Finley, Klint (18 June 2016). "A $50 Million Hack Just Showed That the DAO Was All Too Human". Wired (News). Retrieved 18 February 2017.

By: Wikipedia.org
Edited: 2021-06-18 18:19:24
Source: Wikipedia.org