Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Solidity?

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "what is Solidity". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what Solidity is.

What is Solidity?

Solidity is a high-level language similar to Javascript. It is designed to generate the code of the Ethernet Square virtual machine in a compiled way.

A simple example contract SimpleStorage {uint storedData; function set (uint x) {storedData = x;} function get () constant returns (uint retVal) {return storedData;}}

This is the simplest Solidity contract, declaring a variable storedData and a set and a get to read and write. Access to variables in Solidity does not require the this keyword

Structure of the contract

The definition of contract in Solidity is somewhat similar to the definition of classes in object-oriented languages. Each contract includes state variables, functions, function modifiers, events, structure types, and enumeration types, and contracts can also be inherited from other contracts.

A state variable is a value permanently stored in the contract memory

A function is the code of an executable unit in a contract

Function modifiers can supplement the semantics of a function in a declaration

Events are a convenient interface to the evm logging facility

A structure type is a set of user-defined variables

Enumeration is a collection type used to create a specific value

Types

Solidity is a static language, which means that each variable must define a type at compile time. Solidity also supports building complex types by combining several simple types provided.

Boolean type

As in other languages, Boolean values are true or false, and the supported operators are!, &, |, =,! =

Integer type

The integer type is divided into int and uint, where the length is 8-256and the step size is 8, that is, there is uint8,uint16....uint256. The operators supported by int= int256 uint=uint8 are =, =,! =, &, |, ^, ~, +, -, *, /,%, *, +,-=

Address

The address is the Ethereum address, or you can have a member with a length of 20 bytes, which is the operator supported by base for all contracts =, >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report