Introduction to the solidity language and preparation of the development environment


Solidity is a contract-oriented, high-level programming language created to implement smart contracts. This language is influenced by C++, Python and Javascript languages and is designed to run on the Ether Virtual Machine (EVM).

Solidity is a statically typed language that supports features such as inheritance, libraries, and complex user-defined types.

Its syntax is close to that of Javascript, an object-oriented language. But as a truly decentralized contract running on the web, it differs in a number of ways, some of which are listed below.

  • The ethereum underlay is account-based, not UTXO, so there is a specialAddressThe type of. Used to locate the user, locate the contract, and locate the code for the contract (the contract itself is also an account).
  • Since the language inline framework is payment-enabled, some keywords are provided, such aspayable , can support payments directly at the language level, and is super easy.
  • Storage is using a blockchain on the network, where every state of the data can be stored permanently, so it needs to be determined whether the variables use memory, or the blockchain.
  • The operating environment is on a decentralized network and will place more emphasis on the way contracts or function executions are called. Because what was a simple function call becomes a code execution in a node on a network, the distributed feel.
  • The last very significant difference is the exception mechanism, where all executions are rolled back in the event of an exception, mainly to ensure atomicity in contract execution and to avoid data inconsistencies in intermediate states.

Code example.

pragma solidity ^0.4.20;

contract HelloWorld{
    uint balance;
    function HelloWorld() {
        balance = **;    
    }
    
    function update(uint amount) returns (address, uint){
        balance += amount;
        return (msg.sender, balance);
    }
}

The following IDEs for development and environment building are described below.

Available Solidity Integrations

  • Remix Browser-based IDE with integrated compiler and Solidity runtime environment, no server-side components required.
  • IntelliJ IDEA plugin Solidity plug-in for IntelliJ IDEA (available for all other JetBrains IDEs)
  • Visual Studio Extension Solidity plug-in for Microsoft Visual Studio, including the Solidity compiler.
  • Package for SublimeText — Solidity language syntax Syntax highlighting package for the SublimeText editor.
  • Etheratom Plug-in for the Atom editor with support for highlighting, compilation and runtime environments (compatible with back-end nodes and virtual machines).
  • Atom Solidity Linter A plugin for the Atom editor that provides Lint checking (static checking) for the Solidity language.
  • Atom Solium Linter Atom's configurable Solidty static checker, based on Solium.
  • Solium A static checker that identifies and fixes style as well as security issues in Solidity.
  • Solhint A static checker that provides security and style guidelines as well as best practice rules for smart contract validation.
  • Visual Studio Code extension Microsoft Visual Studio Code plug-in, including syntax highlighting and Solidity compiler.
  • Emacs Solidity Plug-in for the Emacs editor that provides syntax highlighting and compile error reporting.
  • Vim Solidity Plugin for the Vim editor that provides syntax highlighting.
  • Vim Syntastic Plugin for the Vim editor that provides compilation checks.

No longer maintained:

  • Mix IDE Qt-based IDE to design, debug and test Solidity smart contracts.
  • Ethereum Studio A dedicated web IDE that also provides scripted access to a full Etherium environment.

Solidity Tools List

  • Dapp Build tools, package manager, and deployment assistant for the Solidity language.
  • Solidity REPL A command line console that lets you try out the Solidity language right away.
  • solgraph Visualization of Solidity control flow with the ability to flag potential security vulnerabilities.
  • evmdis EVM disassemblers, which perform static analysis of bytecode, can provide a higher level of abstraction than EVM operations.
  • Doxity Documentation generator for the Solidity language.

Third-party Solidity parser and syntax

Personally, my main atom fits Remix developed, described belowRemix usage

functionalities

Here we use the online compiler and open the URL

https://remix.ethereum.org/

image

Folder Management

On the far left is the folder manager, which lists the files in the current workspace. remix can support reading files from local folders.

work area

Right in the middle is the workspace, and the top half of the workspace is the code editing area, where you can write solidity contracts. The lower half is the logging area, which displays transaction-related information as the smart contract is executed. Details and Debug information can also be viewed when exporting logs.

functional area

On the far right is functional area, It's compiled inside., movement, Setup and analysis and debugger and support。

Click Details in the compiler to see the compilation details, which have some relevant information such as NAME,METADATA,BYTECODE,ABI and so on.

image

Inside the settings you can choose our compiler version, and some IDE usage settings. Nothing else is described, it is very simple to use.


Recommended>>
1、1 billion IoT devices may be targeted by botnet MiraiOkiru
2、The top 10 technology trends of the year in the communications industry for 2018 are out
3、Photoelectric flood sensors can last over 10 years
4、Deep6DPose Recovering the 6degreeoffreedom pose of an object from a single RGB image
5、An article that takes you through the history of the hottest artificial intelligence of the moment

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号