Core Blockchain concepts

What is Blockchain?

Blockchain is a technology that emerged with the creation of Bitcoin by Satoshi Nakamoto in 2009. The blockchain is the underlying technology allowing Bitcoin to work without the need of a trusted third party by relying solely on the protocol itself to establish trust. Blockchains use a decentralized peer-to-peer network in order to achieve consensus and byzantine fault-tolerance on Bitcoin and Ethereum - which are the most popular blockchains available.

This consensus is achieved; in the case of Ethereum, with proof-of-work. Which provides a probabilistic solution to the byzantine generals problem.

The blockchain can be seen as a big ledger, containing all the past transactions and is consultable by anyone. As it is distributed to all nodes in the network, each of which contains a copy of this blockchain, it is mathematically impossible to fraudulently change a transaction.

These transactions are contained in "blocks". Each block can contain a finite number of transactions and the average time needed to create a new block is fixed in the implementation level of the blockchain.

As each block is linked to the previous one by a cryptographical proof (the block header of a new block contains the hash of the previous block) the transactions that are processed in a block on the blockchain are immutable, this characteristic is necessary when it comes to the use of this technology for transferring value.

The Ethereum Blockchain1

The Ethereum Blockchain is an evolution of the Bitcoin blockchain protocol. The first release of the protocol was in 2015 and it has evolved a lot since then. The intent of Ethereum is to create an alternative protocol for building decentralized applications, providing a different set of tradeoffs that are very useful for a large class of decentralized applications; with particular emphasis on situations where rapid development time, security for small and rarely used applications, and the ability of different applications to very efficiently interact, are important.

Ethereum does this by building what is essentially the ultimate abstract foundational layer: a blockchain with a built-in Turing-complete programming language, allowing anyone to write smart
contracts and decentralized applications, where they can create their own arbitrary rules for ownership, transaction formats, and state transition functions. Smart contracts, cryptographic "boxes" that contain value and only unlock it if a certain set of conditions are met, can also be built on top of the platform, with vastly more power than that offered by Bitcoin scripting because of the added powers of Turing-completeness, value-awareness, blockchain-awareness, and state.

The Smart Contracts2

A smart contract is a computer protocol running on top of a blockchain; containing a set of rules under which the parties to that smart contract agree to interact with each other. If and when the pre-defined rules are met, the agreement is automatically enforced. The smart contract code facilitates, verifies, and enforces the negotiation, or performance of an agreement or transaction. It is the simplest form of decentralized automation.

The term smart contract is a bit unfortunate since a smart contract is neither smart nor are they to be confused with a legal contract.

  • A smart contract can only be as smart as the people coding it. Taking into account all available information at the time of coding.
  • While smart contracts have the potential to become legal contracts if certain conditions are met, they should not be confused with legal contracts accepted by courts and or law enforcement. However, we will probably see a fusion of legal contracts and smart contracts emerge over the next few years as the technology becomes more mature and widespread and legal standards are adopted.

Smart contracts radically reduce transaction costs. Auto enforceable code – whether on the protocol level or on the application level – standardizes transaction rules, thus reducing the transaction costs of:

  • Reaching an agreement
  • Formalization
  • Enforcement

A smart contract can formalize the relationships between people, institutions and the assets they own. The transaction rulesets (agreement) of the smart contract define the conditions – rights and obligations – to which the parties of a protocol or smart contract consent. It is often predefined, and agreement is reached with simple opt-in actions. This transaction rule set is formalized in a digital format, in a machine-readable code formalization. These rights and obligations established in the smart contract can now be automatically executed by a computer or a network of computers as soon as the parties have come to an agreement and met the conditions of the agreement (enforcement).

The concept of a smart contract is not new. However, Blockchain seems to be the catalyst for smart contract implementation. The most primitive form of a smart contract is a vending machine. The rules of a transaction are programmed into a machine. You select a product by pressing a number related to that product, insert the coins, and the machine acts as a smart contract checking whether you inserted enough money, If yes, the machine is programmed to eject the product, and if you have inserted too much money, it will also eject the change. If you didn’t insert enough money, or if the machine ran out of the product, you will get your change back. Automatic vending machines not only slashed transaction costs by making human vendors obsolete, but they also expanded service time. Offering 24/7 availability instead of limited opening hours of a kiosk.

Characteristics of a smart contract

Smart contracts are capable of tracking performance in real-time and can bring tremendous cost savings. Compliance and control happen on the fly. In order to get external information, a smart contract needs information oracles , which feed the smart contract with external information.

Smart contracts are :

  • Self-verifying
  • Self-executing
  • Tamper-resistant

Smart Contracts can :

  • Turn legal obligations into automated processes
  • Guarantee a greater degree of security
  • Reduce reliance on trusted intermediaries
  • Lower transaction costs

The ERC-20 Token Standard

ERC-20 is a token standard first proposed by Vitalik Buterin in June 2015. It is a simple interface that allows for the creation of tokens on Ethereum that can be re-used by other applications, from wallets to decentralized exchanges. It is also the most commonly used standard for Ethereum-based tokens and was the most popular choice for many initial coin offerings (ICOs) between 2016-2018.

The standard ERC-20 is a list of rules that an Ethereum token has to implement. Giving developers the ability to program how new tokens will function within the Ethereum ecosystem. The ERC-20 token standard became popular with crowdfunding companies working on initial coin offering (ICO) cases due to the simplicity of deployment. Together with its potential for interoperability with other Ethereum token standards. ERC-20 tokens are fungible, which means that there is no way to make the difference between one token and another belonging to the same token smart contract.
The ERC-20 standard dominates the Ethereum ecosystem. It mainly consists in six functions:

Allowance : The Allowance function allows for two addresses to create repeated unidirectional transfers; a wallet address tokenOwner & a second wallet spender are defined as the two wallets that will engage in repeated transactions. Specifically, the wallet spender will withdraw some amount from the wallet tokenOwner at some interval – both of these are variables that will be determined later on.

Approve: For the Approve function, refer back to our Allowance function: the function allows for two addresses to repeatedly withdraw unidirectionally. The Approve function, aptly named, is a simple standard function that calls for the wallet owner to “approve” a transaction that’s about to made on his/her behalf in the context of an Allowance. This function requires two inputs, the address of the spender & the amount of tokens being sent. The output returns a public boolean that dictates whether approval was provided or rejected.

BalanceOf: BalanceOf is an intuitive function that accepts a single address input parameter (address tokenOwner) & returns a single public constant (UINT balance). The returned UINT constant, balance, represents the amount of tokens the queried address holds — remember, transactions on a blockchain are usually public, Ethereum is no different.

TotalSupply: The totalSupply function is an anonymous constructor function that runs only once in the very first moment of deployment to the live Ethereum network. The function returns a public constant totalSupply unassigned integer (UINT) that acts as that tokens total supply for the remainder of the contracts life. This totalSupply constant is usually defined as one of two ways: hardcoding a variable or funding from an origin wallet.

Transfer: The Transfer function is the core function of any ERC20 token; it defines & implements direct wallet-owner-to-peer token transferring. Since wallet owners make this call, only two parameters are required: the receiver address & the amount of tokens being sent. These two parameters are usually initialized as (address to) & (uint tokens). The Transfer return value is simply a boolean that confirms whether the receiver (the “to” address) received the tokens sent.

TransferFrom: The TransferFrom function allows for a smart contract to execute a transfer with the parameters passed on behalf of the wallet owner. Carefully make the distinction with the previous Transfer function. The previous function allowed for the wallet owner to directly send tokens to an address; this TransferFrom allows for a smart contract to send tokens on the wallet owners’ behalf, such as filling an order on an exchange, releasing funds in a timely manner, or paying our winnings in an game of luck.

The TransferFrom function has three input parameters, the address of the wallet owner, the address of the receiver wallet, & the amount of tokens sent. They’re often initialized in the following syntax: (address from, address to, UINT tokens). The function output is exactly the same as the Transfer output: a single public boolean that details the success or failure of the transaction.

ERC-20 tokens are relatively easy to create – as of June 14, 2019, there are 192,826 ERC-20 contracts deployed on the Ethereum blockchain. Some of the most valuable ERC-20 tokens include Binance Coin (BNB), 0x (ZRX), and OmiseGo (OMG) with market caps of $4,6 billions, $191 million, and $297 million, respectively.



What’s Next

Learn more about onchain identities on the next page