Solidity programming

in PussFi 🐈11 days ago
Assalamualaikum

Greetings to you all!

network-6731186_1280.webpPixabay

Solidity is basically defined as contract which is oriented in programming language that's why it is utilise writing of smart contracts which operating at Ethereum blockchain and it is one of the most diverse utilising language for the development of blockchain.

It is always important to know features of solidity so solidity syntax is just like Java script, C++, python which makes it more accessible and easy for developers learning. But there are more unique features and nuances that solidity have.


I have talked many times about smart contract that these are basically self executing which have terms of agreement written into lines of codes in a direct way. These are deployed at blockchain and are the executing in an automatic way after meeting of certain conditions are criteriae.


Solidity programs are also combined with bytecode which can be easily executed at Ethereum virtual machine. This machine is basically useful for providing and environment just like sandbox which ensures that smart contract will execute in a safe and secure manner.


For writing solidity program first of all you should define a contract which is using "contract" as keyword while in a contract you should also define variable, functions as well as other events. This is all about structure. Now I would like to talk about variable functions and events that what are these in a brief way.


Variables in solidity can be of two types in which first type is state variable and other type is local variable. State variables are those that are stored at blockchain permanently but local variables are something else.


In solidity functions are again of two type. One is internal and other is external so internal functions are those which are within contract and external functions are those that are not within contract. When I move forward and talk about events then in solidity these are basically permitting contracts for communicating with outside world.

block-chain-3513216_1280 (2).webpPixabay

Solidity is also in favour of inheritance which is used for permitting contracts for inheritance some characteristics properties and behaviours from other contracts. Solidity also comes with some of the considerations and challenges in which first of all there is usage of practice for coding is important for prevention of any kind of vulnerability.


Reentrancy attack is one of the example of most common kind of vulnerability in solidity contract and it can occur if one contract is calling to another contract in most cases.


"View" is a keyword in solidity which is an indication of this thing that function cannot change or alter the state of contract."Pure" is another keyword use in solubility which is an indication that function cannot modifies state.


For deployment of a solidity contract there is a need to compile it with solidity computer. After deployment is done smart contract can interact with use of web3 library like Web3.js etc. There are some of the most common and popular used tools for development of solidity are Remix,Truffle, visual studio code etc.

Now this is an example of solidly contract in a simple way;

pragma solidity ^0.8.0;

contract SimpleContract {
    address private owner;
    uint public count;

    constructor() {
        owner = msg.sender;
        count = 0;
    }

    function increment() public {
        count += 1;
    }

    function getCount() public visualize returns (uint) {
        return count;
    }
}

So that was all about solidity programming. I hope that everyone understood this concept with comprehensive explanation......

Have a blessed day
Sort:  
CategoryInput
X - Promotion
Plagiarism Free
Image
AI Free
Beneficiary

Note:-


Regards,
@theentertainer


1000012708.png

Coin Marketplace

STEEM 0.22
TRX 0.21
JST 0.035
BTC 98681.55
ETH 3357.07
USDT 1.00
SBD 3.09