Solidity

Solidity is a domain-specific language[1] for the Ethereum public blockchain and programmable transaction platform.[2][3][4]

History

Solidity was initially proposed in August 2014 by Dr. Gavin Wood;[5] the language was later developed by the Ethereum project's Solidity team, lead by Dr. Christian Reitweissner. It is one of two languages (the other being Serpent) designed to target the Ethereum Virtual Machine. Since the rise of blockchain technology and in particular Ethereum-derived architectures, it has found substantial usage[6][7][8] for authoring on-chain software programs known as "smart contracts".

Description

As specified by Wood it is designed around the ECMAScript syntax to make it familiar for existing web developers; 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. An 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, and later became known as "Natural Language Specification".[9]

Additional parts of the proposal which remain works in progress include a formal verification and correctness proof system. Features added after the initial proposal include function modifiers, a means of allowing functions to declare their subroutine to be wrapped in some parameterisable outer logic, and the ABI was extended from supporting only "in-bound" function calls to include "out-bound" events as a means of making external systems aware of particular activity.

Example of a Solidity program:

contract GavCoin
{
  /// 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[message.caller] >= valueInmGAV) {
      balances[to] += valueInmGAV;
      balances[message.caller] -= valueInmGAV;
    }
  }

  /// $((balanceInmGAV / 1000).fixed(0,3)) GAV is the total funds available to $(who.address()).
  function balance(address who) constant returns (uint256 balanceInmGAV) {
    balanceInmGAV = balances[who];
  }

invariants:
  /// The sum total amount of GAV in the system is 1 million.
  reduce(0, add, map(valueOf, balances)) == 100000000000;

construction:
  /// Endows $(message.caller.address()) with 1m GAV.
  balances[message.caller] = 100000000000;

state:
  mapping balances(address) returns uint256 with function(address a) returns uint256 { return a; };
};

Through the specialised documentation system, function modifiers and the focus on formal analysis, Solidity may arguably be considered the first "contract-oriented" programming language, having a feature-set quite specific to that of blockchain software.

Development platform availability

External links

References

  1. "Solidity — Solidity 0.2.0 documentation". readthedocs.io.
  2. Popper, Nathaniel (2016-03-27). "Ethereum, a Virtual Currency, Enables Transactions That Rival Bitcoin’s". New York Times. Retrieved 2016-05-01.
  3. Gray, Jeff (7 April 2014). "Bitcoin believers: Why digital currency backers are keeping the faith". The Globe and Mail (Phillip Crawley). Retrieved 17 February 2016.
  4. Vigna, Paul (28 October 2015). "BitBeat: Microsoft to Offer Ethereum-Based Services on Azure". The Wall Street Journal (Blog) (News Corp). Retrieved 17 February 2016.
  5. Benoit Schweblin. "StackEdit Viewer". stackedit.io.
  6. "Blockchain Technology and Applications from a Financial Perspective". Scribd.
  7. slockit. "GitHub - slockit/DAO: The Standard DAO Framework, inc. Whitepaper". GitHub.
  8. "Augur documentation". augur.net.
  9. ethereum. "Ethereum Natural Specification Format". GitHub.
  10. "Ethereum's Solidity Now Available in Microsoft Visual Studio". CCN: Financial Bitcoin & Cryptocurrency News. Retrieved 1 May 2016.
  11. http://rethink-iot.com/2016/04/01/hyperledger-blockchain-code-almost-comes-together-for-iot/, accessed 23 April 2016.
  12. "Microsoft Adds Ethereum to Windows Platform For Over 3 Million Developers". CoinDesk. Retrieved 1 May 2016.
This article is issued from Wikipedia - version of the Sunday, May 01, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.