Solidity

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Solidity
Solidity logo.svg
The Solidity language logo
Websitegithub.com/ethereum/solidity
Influenced by
JavaScript, C++, Python, PowerShell

Solidity is a contract-oriented programming language for writing smart contracts.[1] It is used for implementing smart contracts[2] on various blockchain platforms.[3][4][5] It was developed by Gavin Wood, Christian Reitwiessner, Alex Beregszaszi, Liana Husikyan, Yoichi Hirai and several former Ethereum core contributors to enable writing smart contracts on blockchain platforms such as Ethereum.[6][7]

History[edit]

Solidity was initially proposed in August 2014 by Gavin Wood;[8][9] the language was later developed by the Ethereum project's Solidity team, led by Christian Reitwiessner. It is one of four languages (the others being Serpent, LLL, Viper (experimental) and Mutan (deprecated)) designed to target the Ethereum Virtual Machine (EVM).[7] For more information on these languages see Ethereum programming languages.

At present, Solidity is the primary language on Ethereum 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][10]

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 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."[11][12]

Description[edit]

Solidity is a statically-typed programming language designed for developing smart contracts that run on the EVM.[13][14] Solidity is compiled to bytecode that is executable on the EVM. With Solidity, developers are able to write applications that implement self-enforcing business logic embodied in smart contracts, leaving a non-repudiable and authoritative record of transactions.[15][16] Writing smart contracts in smart contract specific languages such as Solidity is referred to as easy (ostensibly for those who already have programming skills).[17]

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".[18][19]

Example of a Solidity program:[20][21]

contract GavCoin
{
  mapping(address=>uint) balances;
  uint constant totalCoins = 100000000000;

  /// Endows creator of contract with 1m GAV.
  function GavCoin(){
      balances[msg.sender] = totalCoins;
  }

  /// Send $((valueInmGAV / 1000).fixed(0,3)) GAV from the account of $(message.caller.address()), to an account accessible only by $(to.address()).
  function send(address to, uint256 valueInmGAV) {
    if (balances[msg.sender] >= valueInmGAV) {
      balances[to] += valueInmGAV;
      balances[msg.sender] -= valueInmGAV;
    }
  }

  /// getter function for the balance
  function balance(address who) constant returns (uint256 balanceInmGAV) {
    balanceInmGAV = balances[who];
  }

}

Development platform availability[edit]

Blockchain platforms[edit]

Solidity is available on:

References[edit]

  1. ^ Allison, Ian (12 August 2016). "PwC blockchain expert pinpoints sources of ambiguity in smart contracts". IBTimes (News). Retrieved 14 December 2016.
  2. ^ a b "SOFE Berlin: Swift unveils blockchain proof-of-concept". Finextra (News). 24 November 2016. Retrieved 24 November 2016.
  3. ^ a b c d e Hans Lombardo (11 March 2016). "Tendermint CEO on Powering Blockchains with Speed, Security, Scalability". AllCoinNews. Retrieved 12 December 2016.
  4. ^ Alyssa Hertig (15 September 2016). "Blockchain Veterans Unveil Secure Smart Contracts Framework". CoinDesk. Retrieved 14 December 2016.
  5. ^ a b Rebecca Campbell (6 September 2016). "Counterparty Brings Ethereum Smart Contracts to the Bitcoin Blockchain". CCN. Retrieved 14 December 2016.
  6. ^ "In Formal Verification Push, Ethereum Seeks Smart Contract Certainty". CoinDesk (News). 28 September 2016. Retrieved 12 December 2016.
  7. ^ a b Browning, David (May 2016). Digital Siege: Why Young Entrepreneurs Are Winning. ISBN 978-1628652963. Retrieved 2017-01-08.
  8. ^ Benoit Schweblin. "StackEdit Viewer". stackedit.io.
  9. ^ a b "Blockchain and big data worth watching in the coming year". Business. International Business Times. 20 December 2016. Retrieved 2017-09-28.
  10. ^ KENTOURIS, CHRIS (13 December 2016). "Blockchain's Smart Contracts: What's Smart, What's Not". Finops (News). Retrieved 14 December 2016.
  11. ^ Quentson, Andrew (19 June 2016). "Ethereum's Solidity Flaw Exploited in DAO Attack Says Cornell Researcher". CryptocoinNews (News). Retrieved 14 December 2016.
  12. ^ Finley, Klint (18 June 2016). "A $50 MILLION HACK JUST SHOWED THAT THE DAO WAS ALL TOO HUMAN". Wired (News). Retrieved 18 February 2017.
  13. ^ Mougayar, William (2016-04-26). The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology. Wiley Publishing. ISBN 978-1119300311.
  14. ^ a b Allison, Ian (2016-03-30). "Microsoft adds Ethereum language Solidity to Visual Studio". International Business Times. Retrieved 2016-05-11.
  15. ^ Bradley, Joseph (2016-05-04). "Ethereum's Solidity Now Available in Microsoft Visual Studio". Cryptocoinnews. Retrieved 2016-05-11.
  16. ^ Allison, Ian (30 March 2016). "Microsoft adds Ethereum language Solidity to Visual Studio". International Business Times. Retrieved 11 May 2016.
  17. ^ Mougayar, William (9 May 2016). The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology Hardcover. Wiley Publishing. ISBN 978-1119300311. Retrieved 2017-01-09.
  18. ^ Kapetanios-2008-06-27 & p.309.
  19. ^ ethereum. "Ethereum Natural Specification Format". GitHub.
  20. ^ RJ Catalano, one of the core developers, see VoR0220 on github
  21. ^ a b 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 23 August 2017.
  22. ^ "Ethereum's Solidity Now Available in Microsoft Visual Studio". CCN: Financial Bitcoin & Cryptocurrency News. Retrieved 1 May 2016.
  23. ^ "Microsoft Adds Ethereum to Windows Platform For Over 3 Million Developers". CoinDesk. Retrieved 1 May 2016.

External links[edit]