Basics of Blockchain Technology

in #technology6 years ago (edited)

I came in touch with blockchain technology at the beginning of 2017. Searching for a Master's research topic, I stumbled over cryptocurrency which made me very excited and I have decided to further investigate the underlying technologies.

This is my very first article on steemit and further articles may follow.

I will explain some basics of blockchain technology and quickly introduce Bitcoin and Ethereum, the leading blockchain platforms.

To get deeper knowledge about this technology, have a look at the reference list at the end of this article.

Blockchain

A ledger is the basis of a blockchain. The ledger records all transactions that have ever happened. Valid transactions that occur during a certain time period form a block and every new block gets appended to a previous block. The term blockchain refers to all these blocks being chained together. Nodes of the underlying peer-to-peer network decide independently which new blocks they append to their chain. As long as the majority of the network follows the rules, the fastest growing, which is the most adopted chain, will be the valid chain.

The state of the ledger is replicated on all participating nodes. Only the initial block, which is called genesis, does not reference a previous block. All others know the cryptographic hash of their predecessor. To make transactions on the network users require a private and public key pair. The public key serves as uniquely identifiable account address to which tokens can be transferred. A transaction is only valid when it was signed with the account owner’s private key. As a result, asymmetric cryptography ensures authentication, integrity and non-repudiation of transactions.

The creation of new blocks is an infinitely repeating process. First, a signed transaction gets communicated to one-hop neighbors via broadcast. Only valid transactions get communicated further. Transactions are then processed into a timestamped candidate block. This packaging process is called mining. Finally, a published block gets adopted by other nodes if they regard it as valid. Because there might be disagreement between nodes about which block to be added next, the fastest growing chain is considered as the valid one and eventually all nodes will follow the majority’s decision.

Blockchains can be either public or private and either permissionless or permissioned. A public blockchain is visible for anyone, a private blockchain can only be read by eligible entities. A permissionless blockchain can be joined by any node. In contrast, participation in a permissioned blockchain is restricted to whitelisted nodes. Ideally blockchain based solutions are tolerant to node failures, have a single, universally accepted state of events, provide transparency, verifiability and auditability.

Proof-of-Work

The proof-of-work protocol enables nodes to verify the blockchain history and detect modifications easily. The proof-of-work protocol requires mining nodes (miners) to find a certain number (nonce), which when added to the block, results in a hash value of the block with a certain amount of leading zeros. The correctness of such a nonce can be verified by other nodes with little effort. Any attempt to modify a block would require to redo the proof-of-work for all following blocks. Thus, it’s highly unlikely that an attacker has enough computationally resources to change the history of the blockchain because he would have to outpace the current valid chain which is constantly growing.

Proof-of-Stake

As an alternative to proof-of-work, the proof-of-stake mechanism was invented. Proof-of-stake has the advantage that it does not waste lots of computationally resources to find a certain nonce. In contrast, users get selected with a probability proportionally to their holdings of value tokens to mine a block. Miners that do not obey the protocol get punished by decreasing the value of their stake.

Smart Contracts

A smart contract is a digital transaction protocol that allows interaction of non-trusting participants in a predefined, secure way without any central authority. Procedures are linked to unique addresses and only authorized entities can trigger them. Smart contracts are especially suitable to trade digital assets. It’s crucial that business logic to handle all possible outcomes of a smart contract is implemented.

Bitcoin

Bitcoin is the first cryptocurrency that has ever been created. Its implementation is based on Nakamoto’s paper ‘Bitcoin: A Peer-to-Peer Electronic Cash System’. Bitcoin transactions are realized using the unspent transaction outputs (UTXO) model. The amount of bitcoin that are associated with an account address is the sum of transaction outputs sent to this address. The account owner can spend each transaction output only once. Transactions can have several inputs and one or two outputs. For example, to transfer 3.5 bitcoin from an account with two UTXO, one of value 3 bitcoins and one of value 1 bitcoin, a transaction with both UTXO as inputs would be required. Further, this transaction would define two outputs. One output would indicate that 3.5 bitcoin shall be transferred to the recipient’s address and the second output would specify to return 0.5 bitcoin, the change, to the sender’s account.

Ethereum

The Ethereum blockchain is a transaction-based state machine. In contrast to Bitcoin, Ethereum is account-based and does not implement the UTXO model. Further, Ethereum offers smart contract functionality. Central properties of the Ethereum solution are transparency, incorruptibility of judgement, absolute confidence about the system behavior and trust although other interacting parties are unknown.

Ethereum relies on state changes caused by transactions. Initially, there is a genesis state which then gets altered by transactions. The latest state is the canonical version of Ethereum.

To incentivize low-cost computation and prevent infinite loops as well as network abuse, Ethereum uses the concept of gas. Whenever a transaction is made, the signer has to pay a fee. This fee is the product of the transaction’s defined gas limit and the gas prize. The fee is payed to the miner of the block in Ether which is Ethereum’s cryptocurrency. Miners are free to not include transactions, for example, if their fee is so low that they’re unattractive for the miner. Thus, developers should choose the price reasonably. Furthermore, the gas limit should not be set too high, otherwise hardly any user will be willing to execute such a transaction.

Whenever an exception is thrown, all the Ether payed for this transaction gets used up completely. However, if the execution is successful, all remaining gas will be refunded to the sender. If the gas is not enough to finish the transaction, all changes will be reverted, but the payed Ether is gone. User can only perform transactions if they are able to pay the transaction fee.

Ethereum smart contracts can be used to store all kind of information on the blockchain. Smart contracts are very similar to normal user accounts because they are associated with a balance and a unique address. In contrast to externally owned accounts, smart contracts can also store program code which can be executed.

Transactions are realized in Ethereum as message calls. This mechanism allows to transfer Ether to other accounts including smart contracts. The concept of message calls also allows to trigger procedures of smart contracts. A message call gets only accepted by the Ethereum nodes if it is signed with a private key and if the sender’s account balance can cover the transaction fees. State-changing transactions only take effect if they make it in a new block.

Under the hood Ethereum runs Ethereum Virtual Machine (EVM) bytecode allowing the execution of Turing-complete software. Smart contracts for the Ethereum blockchain can be implemented using Solidity, a language similar to JavaScript. To be deployable, Solidity smart contracts have to be compiled to EVM code.

References and Further Information

Bitcoin: A Peer-to-Peer Electronic Cash System

Ethereum

Ethereum: A Secure Decentralised Generalised Transaction Ledger

Ethereum White Paper

Free Coursera Online Course 'Bitcoin and Cryptocurrency Technologies'

YouTube Channel ‘Blockchain at Berkeley’

Sort:  
Loading...

Resteemed by @resteembot! Good Luck!
The resteem was payed by @greetbot
Curious?
The @resteembot's introduction post
Get more from @resteembot with the #resteembotsentme initiative
Check out the great posts I already resteemed.

Hi. I am @greetbot - a bot that uses AI to look for newbies who write good content.
I found your post and decided to help you get noticed.
I will pay a resteeming service to resteem your post,
and I'll give you my stamp of automatic approval!
greetbot's stamp of approval

@greetbot=@resteembot, so how can he "pay" someting if he just send money to himself? All he want is make more money, like he always did, with a lot of spam. We will stop this new spam attack again and let him not destroy our good name in steemit. @resteem.bot

Coin Marketplace

STEEM 0.33
TRX 0.11
JST 0.034
BTC 66438.74
ETH 3268.32
USDT 1.00
SBD 4.39