Skip to main content

11 Ways to Earn Bitcoin & Make Money with Bitcoin in 2021

 11 Ways to Earn Bitcoin & Make Money with Bitcoin in 2021

Complete Solidity Tutorial | Smart Contract | Ethereum Solidity | Solidity Blockchain Development |

  Complete Solidity Tutorial | Ethereum Solidity | Solidity Blockchain Development | Smart Contract 






 What is Solidity?

Solidity is a contract-oriented, high-level programming language for implementing smart contracts. Solidity is highly influenced by C++, Python and JavaScript and has been designed to target the Ethereum Virtual Machine (EVM).

What is Ethereum?



Ethereum is a decentralized ie. blockchain platform that runs smart contracts i.e. applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.

The Ethereum Virtual Machine (EVM)

The Ethereum Virtual Machine, also known as EVM, is the runtime environment for smart contracts in Ethereum. The Ethereum Virtual Machine focuses on providing security and executing untrusted code by computers all over the world.

The EVM specialised in preventing Denial-of-service attacks and ensures that programs do not have access to each other's state, ensuring communication can be established without any potential interference.

The Ethereum Virtual Machine has been designed to serve as a runtime environment for smart contracts based on Ethereum.

What is Smart Contract?

A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contracts allow the performance of credible transactions without third parties. These transactions are trackable and irreversible.

The concept of smart contracts was first proposed by Nick Szabo in 1994. Szabo is a legal scholar and cryptographer known for laying the groundwork for digital currency.

It is fine if you do not understand Smart Contract right now, we will go into more detail later.


Environment Setup for Smart Contract Development

For Beginners who are new to blockchain development and writing their first smart contract code, it is suggested to write it on browser-based IDE .it is much easy to use which comes with the compiler and there you can test your smart contract. the name of the online IDE is Remix

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.

 
Solidity Basic Syntax


 

A Solidity source files can contain any number of contract definitions, import directives and pragma directives.

Let's start with a simple source file of Solidity. Following is an example of a Solidity file −

pragma solidity >=0.4.0 <0.6.0;
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}

Pragma

The first line is a pragma directive which tells that the source code is written for Solidity version 0.4.0 or anything newer that does not break functionality up to, but not including, version 0.6.0.

A pragma directive is always local to a source file and if you import another file, the pragma from that file will not automatically apply to the importing file.

So a pragma for a file which will not compile earlier than version 0.4.0 and it will also not work on a compiler starting from version 0.5.0 will be written as follows −

pragma solidity ^0.4.0;

Here the second condition is added by using ^.

Contract

A Solidity contract is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereumblockchain.

The line uintstoredData declares a state variable called stored data of type uint and the functions set and get can be used to modify or retrieve the value of the variable.

Importing Files

Though the above example does not have an import statement Solidity supports import statements that are very similar to those available in JavaScript.

The following statement imports all global symbols from "filename".

import "filename";

The following example creates a new global symbol symbolName whose members are all the global symbols from "filename".

import * as symbolName from "filename";

To import a file x from the same directory as the current file, use import "./x" as x;. If you use import "x" as x; instead, a different file could be referenced in a global "include directory".


Basic Application 

Solidity - First Application

We're using Remix IDE to Compile and Run our Solidity Codebase.

Step 1 − Copy the given code in Remix IDE Code Section.

Example

pragma solidity ^0.5.0;
contract SolidityTest {
constructor() public{
}
function getResult() public view returns(uint){
uint a = 1;
uint b = 2;
uint result = a + b;
return result;
}
}

Step 2 − Under Compile Tab, click Start to Compile button.

Step 3 − Under Run Tab, click Deploy button.

Step 4 − Under Run Tab, Select SolidityTest at 0x... in drop-down.

Step 5 − Click getResult Button to display the result.

Output

0: uint256: 3



Comments

Popular posts from this blog

How to Become a Blockchain Developer in 2021? Step-by-step Plan (10 steps) - Ultimate guide for beginners

  How to Become a Blockchain Developer in 2021 ? Step-by-step Plan (10 steps) - Ultimate guide for beginners Do you want to become a blockchain developer ? with higher salaries and reports of Ethereum Dapps becoming successful overnight and new interesting technical challenges the blockchain is very attractive for developers however it has some pain points that might be difficult for newcomers, for example, one of the questions you might have is where do I get started to get into blockchain what do I need to learn to become a blockchain developer or do I need to be a cryptography expert to make it into the blockchain. In this blog, Blockchain developers are responsible for developing and designing APIs. Want to become one Start with the Academics. Get Proficient with required Tec  I will answer these questions and I will lay out a step-by-step plan so you can become a blockchain developer. If you follow this plan you can become a blockchain developer in three to six months and you c

How to mine Cryptocurrencies on Android smartphone in 2021? Minergate

How to mine Cryptocurrencies on Android smartphone in 2021? Minergate  

11 Ways to Earn Bitcoin & Make Money with Bitcoin in 2021

 11 Ways to Earn Bitcoin & Make Money with Bitcoin in 2021