Solidity in Blockchain
In this post we will discuss regarding solidity in Blockchain.
What is solidity?
For writing smart contracts we use solidity and it is a contract oriented programming language .The solidity comes under high level programming language.It is designed so that it can work with the technology of the time-Blockchain. The smart contracts are developed under Ethereum Blockchain platform.Let us discuss some smart contract’s basics.
Smart Contracts
A contract can be simply defined as a storage of code and data(Functions and states respectively) that occupy at a particular address in the Ethereum Blockchain.The state variables,methods,events etc are defined in each contract and it can manage the transactions between blocks in blockchain network.
Solidity Features which are similar to some common High level languages are mentioned down
Statically Typed Language
It is a statically typed language even though it have a structure of javascript.
Contract and interfaces
It can be defined as a unique data structure of solidity language and minimize the complexity in creation and management of contracts.It can create complex contract structures and contracts can be inherited by child contracts.
Function Modifier
This is used to change the behavior of the function which means that we can execute a function in an other way if the condition is met.
Events
We use events to insert data from contracts to Blockchain log.
Access Specifies
The two access specifies in solidity are ‘owned’ and ‘mortal’ which is similar to public and private in OOP languages.
Explicit Type Conversion
Explicit conversion can be done on different datatypes ,checked at compile time and there are exceptions also for this.
Memory Arrays
The dynamic arrays can be easily and directly allocated to memory.
Library
There is a huge collection of built-in contract libraries.
Imports
To import other source files to our contract we can use ‘import’ keyword.
Originally published at www.blockchainexpert.uk