# Solidity 课程 1: 概述

By [Novar](https://paragraph.com/@novar) · 2022-05-10

---

`Solidity` Web3之旅，欢迎一起学习交流：

*   WeChat: naf707
    
*   Twitter: [@wab\_hsu](https://twitter.com/wab_hsu)
    
*   Github: [luca-hsu](https://github.com/Luca-Hsu)
    

### 一、简介：

`Solidity` 是一门实现以太坊智能合约的静态编程语言，可以在以太坊虚拟机上部署运行(EVM)，代码风格参考了`C++`, `Python` 和 `JavaScript`，具体可以参考 [官方介绍文档](https://solidity-cn.readthedocs.io/zh/develop/index.html) 。

### 二、开发工具：Remix

[Remix](https://remix.ethereum.org/) 可以在线开发简单合约和快速学习 Solidity。

### 三、部署第一个合约：

*   创建 `HelloWeb3.sol` 文件
    
*   编写第一个合约
    
        // SPDX-License-Identifier: MIT
        pragma solidity ^0.8.4;
        
        contract HellowWeb3{
            string public _string = "Hellow Web3!";
        }
        
    

解析代码：

`// SPDX-License-Identifier: MIT`：需要声明许可标识才可以编译通过，否则会输出报错，是否开源都需要标识；

`pragma solidity ^0.8.4`：声明solidity版本，源文件将不允许在低于 0.8.4 版本的编译器编译；

`contract HellowWeb3` ：声明合约名为 `HellowWeb3`

*   **compile** → **deploy**
    

![部署日志](https://storage.googleapis.com/papyrus_images/ae6a1a026a0ca04625b6c2732d0ffc0c377b4fac6a0a04fd079a246e99d94768.png)

部署日志

部署成功后输出合约详细信息。

### 总结：

这节我们简单介绍了`Solidity`语言和开发工具，部署第一个合约，下节我们将学习基本的数据类型。

**全部代码**：

[https://github.com/Luca-Hsu/SuperSolidity/blob/main/01\_HelloWeb3/HelloWeb3.sol](https://github.com/Luca-Hsu/SuperSolidity/blob/main/01_HelloWeb3/HelloWeb3.sol)

### 参考文档：

官方文档：

[https://docs.soliditylang.org/en/v0.8.4/](https://docs.soliditylang.org/en/v0.8.4/)

中文文档：

[https://solidity-cn.readthedocs.io/zh/develop/index.html](https://solidity-cn.readthedocs.io/zh/develop/index.html)

参考 AA 老师的教学课程，强推他的 mirror 课程：

[https://mirror.xyz/ninjak.eth](https://mirror.xyz/ninjak.eth)

---

*Originally published on [Novar](https://paragraph.com/@novar/solidity-1)*
