Solidity a complete guide to beginner

blog-image-coursementor-8-1 (1)-4cb6d06d

Today, blockchain technology is rapidly emerging. As a result, the market for blockchain developers is growing. If you want to work as a blockchain engineer, you have to become familiar with programming languages. Solidity is the language of the most common blockchain system, and we will go over some of the basics today.

 

History

 

Solidity is a contractual term for a targeted program. Used to make smart contracts on several blockchain networks, Ethereum is the most common. Gavin Wood proposed Solidity in August 2014, while Christian Reitwiessner led the Ethereum Solidity group, which later developed the language. Created by Alex Beregszaszi, Christian Reitwiessner and many other old Ethereum contributors to allow smart contract writing on blockchain platforms like Ethereum.

 

Definition of Strength

 

It is a language based on a high level of contracting to build smart contracts. Promoted by Python, c ++, and JavaScript and upgraded to EVM (Ethereum Virtual Machine).

 

Solidity helps you build voting contracts, multi-signature wallets, blind auctions, and multi-signature wallets, among other things.

 

 

 

Basic words in the language of Solidity

 

 

 

Description of ethereum?

 

Ethereum is a medium or high-end network that operates with smart contracts or applications that operate as planned without the possibility of failure, fraud, fraud, or third party intervention.

 

 

  1. What is EVM (Ethereum Virtual Machine)?

 

 It is the nature of Ethereum’s operating time for smart contracts. EVM focuses on providing protection and allowing computers around the world to generate unreliable code.

 

The Ethereum Virtual Machine is very focused on preventing Denial-of-Service attacks and ensures that systems cannot access each other’s status, allowing communication to take place without interruption.

 

The Ethereum Virtual Machine was created to serve as a working time framework for smart Ethereum contracts.

 

 

  1. What is a smart contract?

 

A smart contract is a computer program for digital authentication, simplification, or enforcing contract results and negotiations. Smart contracts allow for the performance of reliable services without the involvement of a third party. There is a transaction that can be tracked and permanent.

 

Nick Szabo introduced the concept of smart contracts for the first time in 1994. Szabo is a legal writer and author who is known for establishing a digital money base.

 

Don’t worry if you don’t understand the Wise Covenant now; we will discuss in more detail later.

 

  1. What is a primer?

 

The first line is a pragma indicator, indicating that the source code is written to Solidity 0.4.0 or another new version Comes but does not include version 0.6.0. This does not violate the features.

 

Since the pragma index is local only to the source file, it cannot be used anywhere. If you import another file, the pragma from the imported file will not work immediately.

 

 

The first line will be written as

 

Pragma Strength ^ 0.4.0;

 

 

  1. What is an agreement?

 

Solidity contract is a set of data (its status) and code (its functions) that resides in the Ethereum blockchain at a specific address.

 

  1. What is gas?

 

Gas is a metric used to measure and limit the amount of work required to complete transactions with smart contracts. Gas price is determined by the initiator of the transaction and paid from the shipping account.

 

 

What is Solidity used for?

 

Solidity is a high-level language, contract-oriented in writing intelligent contracts.

 

Scope of Sustainability

 

 Stability, the primary language distributed in the Ethereum blockchain, is one of the most popular. It’s similar to modern JavaScript-like programming language, and includes a curved bracket – selected functions, objects, assets, and almost everything else that makes the Java, C, or JavaScript code look like it.

 

The things you build work on blockchain’s nodes, store their internal information in the log, and continue to exist until the transaction destroys the final value. Your code can send and receive contracts from other smart contracts, which allows for complex transactions.

 

Most people consider the complete Turing language, meaning anything written in other major languages. Ethereum code can only work if you pay for time on nodes with “gas,” internal currency – and the amount of gas you can use is strictly limited.

 

 

 

 

Basic tutorial for beginners

 

Contract structure

 

pragma contract ^ 5.0.0

 

ContractName Contract

 

<dynamic declaration>

<dictures>

<constructor>

<jobs>

<corrections

 

}

 

 

  1. Performance syntax

 

FunctionName function (Arguments…)

<visibility> <state mutability> Returns

(<return types>)

 

  1. Appearance

 

in public – everything

private – only this agreement

within-only this contract and the contracts from which it arises

Outside – Can’t be accessed internally, externally only

 

 

4.State mutability

 

view –- it is not possible to change the status

paid – to get ether

pure –- not available for reading or conversion by state

 

 

 

 

  1. Hello world plan in solid language

 

 

 

     pragma stiffness ^ 0.5.0;

 

HelloWorld contract {

default threadName;

builder () community {

    defaultName = ‘Earth’;

}

getMessage () function public view (cables memory) {

    restore concert (“Hello”, defaultName);

}

}

 

 

 

Basic Names Explained

 

 

  1. Variables in the language of Solidity

 

 State variables are variables whose prices are kept in contract storage for the duration of the contract.

 

  1. Local variables are variables whose values ​​remain constant during operation.

 

    Special variations can be found in the global namespace, which is used to obtain blockchain information.

 

  1. Mapping with language intensity

 

 

Mapping, like parallel and solidity, is a reliable form. The syntax for declaring a mapping form is as follows.

 

mapping (_KeyType => _ValueType)

 

Where

_KeyType – can be any built-in type and bytes and cable. No reference type or complex objects are allowed.

_ValueType – can be of any type.

 

  1. Builder

  

Builder is a special function announced using the builder keyword. It is an optional function and is used for flexible state contract implementation.

 

  1. Tasks

 

A function is a collection of renewable code that can be accessed from any point in your system. You no longer need to write the same code over and over again. Assists editors in developing modular code. A programmer can use tasks to divide a large program into smaller, more accessible steps.

 

Like all other high-quality languages, Solidity has all the features needed to write modular code and functions. This section explains how to create your own Solidity jobs.

 

 

 

 

 

Scroll to Top