Solidity

from Wikipedia, the free encyclopedia

Solidity is an object-oriented, application-specific high-level programming language with a JavaScript- like syntax for developing smart contracts for blockchain platforms such as Ethereum or Tron .

history

Solidity's first specification was drawn up by Gavin Wood in August 2014 . The Ethereum Foundation under the direction of Christian Reitwiessner took over the further development. Solidity is the 4th language developed for the Ethereum Virtual Machine (EVM) - after the Go -like language Mutan, LLL - a Lisp -like language - and the Python -like language Serpent. Solidity is the most important and most developed of these languages. Mutan was discontinued in 2015 in favor of Solidity and LLL is also little used. Serpent will no longer be developed due to security problems and will be replaced by the successor Viper.

description

Solidity is a JavaScript-based statically typed programming language that was developed to program smart contracts for the Ethereum Virtual Machine (EVM). Solidity Contracts can be compiled in bytecode that can be executed by the EVM and then uploaded to the Ethereum blockchain (for example via the Ethereum Geth console). There are several methods of compiling Solidity code, for example using the online compiler, the command line Solidity compiler solc or the compiler built into the Ethereum IDE Mix.

The Solidity syntax is based heavily on the ECMAScript syntax to make it easier for web developers to get started with smart contract development; In contrast to ECMAScript, however, it is statically typed and supports variadic return values. Compared to the existing languages ​​(LLL, Serpent, Mutan), Solidity supports complex variable types such as hierarchical mappings and structs, which can also be nested, as well as inheritance for contracts. An Application Binary Interface (ABI) was also specified so that external applications and libraries ( e.g. Web3.js ) can interact with Ethereum contracts.

Example code for a contract written in Solidity:

contract TestCoin {
    // Das Schlüsselwort "public" erlaubt es auch anderen Smart Contracts, die Variable auszulesen.
    // Diese Variable hat den Typ "address" und steht für die Adresse eines Ethereum Accounts.
    address public minter;
    mapping (address => uint) public balances;

    // Events erlauben es Ethereum-Clients, auf Ereignisse des Contracts zu reagieren.
    event Sent(address from, address to, uint amount);

    // Die Funktion mit demselben Namen wie der Smart Contract ist der Konstruktor.
    // Diese Funktion wird ein einziges Mal bei der Erstellung des Contracts aufgerufen.
    function TestCoin() {
        minter = msg.sender;
    }

    // Mit dieser Funktion kann der "minter" Ethereum Account anderen Accounts einen beliebigen
    // Betrag des "TestCoin" überweisen.
    function mint(address receiver, uint amount) {
        if (msg.sender != minter) return;
        balances[receiver] += amount;
    }

    // Diese Funktion erlaubt es Ethereum-Accounts, sich gegenseitig TestCoin zu überweisen.
    function send(address receiver, uint amount) {
        if (balances[msg.sender] < amount) return;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        Sent(msg.sender, receiver, amount);
    }
}

criticism

Solidity came under criticism , especially after the hack by The DAO , which was heavily picked up in the media , but also due to the discovery of further exploits, because of serious security problems. It is criticized, among other things, that Solidity is too permissive and based on JavaScript-like concepts instead of building on scientific research on the subject of formal languages ​​for contracts.

Web links

Individual evidence

  1. a b Solidity - Solidity 0.2.0 documentation. In: solidity.readthedocs.io. Retrieved September 9, 2016 .
  2. Benoit Schweblin: stackedit viewer. In: stackedit.io. Retrieved September 9, 2016 .
  3. Mutan FAQ. Retrieved September 11, 2016 .
  4. Is LLL still used as language? In: ethereum.stackexchange.com. Retrieved September 11, 2016 .
  5. Serpent on Github. Retrieved September 19, 2018 .
  6. Solidity realtime compiler and runtime. In: ethereum.github.io. Retrieved September 12, 2016 .
  7. Mix IDE. Retrieved September 12, 2016 .
  8. Ethereum Contract ABI. Retrieved September 12, 2016 .
  9. Introduction to Smart Contracts. Retrieved September 12, 2016 .
  10. ^ The DAO's Community: The DAO - Home. In: daohub.org. Retrieved September 12, 2016 .
  11. heise online: After the DAO hack: Ethereum succeeds in the hard fork. In: heise online. Retrieved September 12, 2016 .
  12. Muneeb Ali: Solarstorm: A security exploit with Ethereum's Solidity language, not just the DAO. In: Blockstack Blog. June 20, 2016, accessed September 12, 2016 .  ( Page no longer available , search in web archives )@1@ 2Template: Dead Link / blog.blockstack.org
  13. Why Solidity isn't solid. In: Blockstack Blog. June 20, 2016, accessed September 12, 2016 .