A series of articles on getting started with blockchain—HelloWord in solidity

A series of articles on getting started with blockchain—HelloWord in solidity



foreword

This series of tutorials will record the author's process of learning blockchain from scratch, and welcome criticism and correction.


1. What is solidity?

Solidity codes are covered in smart contracts. A smart contract is the smallest unit of an Ethereum application. All variables and functions belong to a smart contract, which is the starting point of all your applications.

2. HelloWorld of Smart Contract

1. Introduce solidity version

The code is as follows (example):
pragma solidity ^0.4.19;
0.4.19 represents the version number of solidity you use, and some grammatical rules in the corresponding code writing process may be different for each version, so when writing smart contracts, The version number of solidity must be specified on the first line.

2. Write an empty contract

The code is as follows (example):

contract HelloWorld {
    
    

}

The contract modifier means that you have defined a smart contract at this time, and its name is HellWorld, so is the blockchain technology also very simple? Such a line of code has completed the writing of a smart contract.


practice time

Try to define a smart contract, the name of the contract is transfer, and the version number of solidity used is 0.5.9.
Readers are welcome to write your answers in the comment area.

Guess you like

Origin blog.csdn.net/weixin_45186363/article/details/125259260