Blockchain, Smart Contracts and Mining

blockchain.jpeg
blockchain.jpeg

Blockchain was first mentioned in 1991 and designed to timestamp data so it could not be backdated or changed in any way. This technology was not used until Satoshi Nakamoto adapted it to use it for Bitcoin in 2009.

What is Blockchain and how it works?

Blockchain is a digital book in which transactions executed in cryptocurrencies are written chronologically and publicly. It works as a distributed ledger, which means that it works as a database that is constantly shared and synchronized on multiple locations. This means that cyber-attacks are much harder to perform and transactions are faster and safer. The transaction is a transfer of values between two digital wallets that are registered on the Blockchain. Each digital wallet has a hash address (eg: 1BoatSLRHtKNngkdXEeobR76b53LETtpyT). For transactions to happen, variables are needed, such as: address of the recipient, address of the sender, and amount of cryptocurrency.

Blockchain is simply, as its name says, a chain of blocks.

blockchain1.png

Block

Each block inside of blockchain has its own hash, a hash of previous block, and some data. The data stored within a block depends on the type of Blockchain. Bitcoin blockchain stores the details of the transaction such as the address of the recipient, the address of the sender, and the amount that has been sent. Block’s hash can be described as a digital signature. Hash identifies each block and its content. When a block is created, hash needs to be calculated and it is added inside of the block itself.

If data inside of the block is changed, its hash is also changed and it is not considered the same block.

blockchain2.png

Each block contains its own hash and hash of a previous block, which means that block 3 is referring to block 2, and block 2 is referring to block 1. The first block inside of the blockchain is special because it doesn’t contain a hash from the previous block. That block is called the Genesis block. If the second block is changed, its hash is also changed which means that that block and every subsequent block are no longer valid.

Proof of Work
(Pow) is a mechanism that slows down the process of creating and adding new blocks to the blockchain. On Bitcoins blockchain, it takes about 10 minutes to add a new block to the blockchain.

If we try to calculate what is the maximum size of a blockchain in number of block it would be 115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935
And it would take about 3,671,743,063,080,802,746,815,416,825,491,118,336,290,905,145,409,708,398,004,109,081,935,347 years to reach the maximum size if a new block is added every 15 seconds.

What is a Smart contract and how it works?

Smart contracts were first mentioned by Nick Szabo in 1997. Smart contract is identical to a regular contract, the only difference is that a Smart contract is completely digital.

blockchain3.png

Smart Contract

Smart contracts are programs that were written to automatically control the transfer of values between two or more sides after all of the predefined conditions are satisfied. Smart contracts are a program code, meaning that they are not limited to the type of scenarios like “If X happens, then do Y”, but can be used literally for anything, as long as it’s within the limitation that the data must be written in Blockchain.

How does Smart contract work:
- properties are coded
- terms of contract are coded
- both expressions and assets are entered as blocks in Blockchain
- once the contractual provisions are met by both parties, the contract is executed
- each transfer of funds is made on the basis of the contract's terms

The most popular blockchain on which you can make a Smart contract is Ethereum blockchain. Ethereum has been carefully designed to support smart contracts.

blockchain4.png

Ethereum

The language in which Smart contracts are written in Solidity. It was created for Ethereum and its base is C++, Python, and JavaScript. Syntax is very similar to JavaScript.

Smart contracts were made to communicate with Ethereum Virtual Machine (EVM) which is the heart of Ethereum. EVM can execute a code of arbitrary algorithmic complexity. In computer science terms, Ethereum is “Turing complete”.

Bitcoin Blockchain also has some support for Smart contracts but it is limited, so Bitcoin is not used as often as Ethereum.

Tokens and coins

The two terms used to describe units of different crypto values are coin and token. Their meaning and use significantly overlap, but there are significant differences between them that are often misunderstood.

Altcoins are all those crypto values that are alternative to Bitcoin. A lot of altcoins are Bitcoin variants created by Bitcoin Blockchain’s granulation (aka Fork) to improve some of its functions. Such coins were built using the Bitcoin open code protocol. Some examples of such coins are LiteCoin, Bitcoin Cash, Bitcoin Gold, etc…

Screen-Shot-2020-07-16-at-11.46.40.png

Bitcoin, Bitcoin Gold, Bitcoin Cash

On the other hand, there are a multitude of altcoins that are not derived from Bitcoin’s blockchain. Such coins are made on their special blockchain with their own protocol and some of the examples of such coins are Ethereum, Ripple, NEO, etc…

Tokens are nothing but value units that arise from smart contracts on one of the existing blockchains. Today, the vast majority of tokens are based on the Ethereum platform.

Tokens are created and distributed to the public via the Initial coin offering (ICO) which is a starting point of token sharing/selling. It is considered as an alternative form of investment collection and has emerged outside the traditional financial system. This investment-gathering model has helped many successful crypto-tools to get the means to launch ideas, platforms, and business.

Anyone can participate in the ICO of a new cryptocurrency if they are convinced and recognize that the project will be worth in the future and that the value of the purchased crypt valued will increase, but also if they just want to support the project.

ICO is in principle an event that takes place over a couple of days where a new token is offered that you can replace most often for Bitcoin or Ethereum.

There may be a limit or goal of ICO to finance them, meaning that each token you buy in ICO will have a predefined price and the price will not change during the defined duration of a particular ICO, meaning that the token number is static, i.e. limited and always the number of the token remains the same all the time.

The second variant is that the price is dynamic. If more money is collected, the price of an individual token increases, and the number of tokens remains the same.

The third variant is that the price is static (eg: 1ETH = 1 token) and every time someone pays 1ETH, a new token is created.

blockchain6.png

Airdrop

Airdrop is a way to receive tokens, that may be worth something later, for free.

Most Airdrops require people to subscribe to their company’s Telegram channel, track Twitter channels, share posts, and so on. Although each Airdrop has its own rules

What does mining cryptocurrency mean and how does it work?

Mining is a process in which transactions for different crypto values are verified and added to the blockchain. In this process, a miner is a person who confirms and records transactions on the blockchain.

blockchain7.png

The new block contains transactions and on average every 10 minutes, one of the miners verifies a record, i.e. a transaction block.

The miners provide computing power to the Bitcoin network, and in return, they have the chance to get Bitcoin.

In order for the miner to receive the aforementioned prize, it competes against other miners in solving a complex mathematical problem based on a cryptographical hash algorithm.

The solution to this problem is called “Proof of Work”. Proof that the miner used a significant computer effort.

The basic security models for Bitcoin are the PoW algorithm and its solution resulting in the reward and right of publishing the transaction to a new block that will be written on the blockchain.

Miners use their rigs for mining crypto values. Rigs are computer systems and their main component is a GPU. A CPU core can execute 4 32-bit instructions per clock using a 128-bit SSE instruction, or 8 via AVX using a 256-bit SSE instruction, whereas a GPU like the Radeon HD 5970 can execute 3200 32-bit instructions per clock using its 3200 ALUs or shaders. This is a difference of 800, or 400 in case of AVX, times more instructions per clock.

blockchain8.png

Mining rig