We often come across the terms fungible Tokens and non-fungible tokens in the blockchain. What are they? The following table explains what are they and how they differ.
Fungible Tokens
Non-fungible Tokens
Interchangeable A fungible token can be exchanged with any other fungible token of the same type. It is like exchanging a dollar bill with another dollar bill and the value is still the same.
Non-Interchangeable A non-fungible token cannot be exchanged with another non-fungible token of the same type. It is like your passport or ID, they cannot be exchanged.
Uniform Each fungible token is identical to all other fungible tokens of the same type. For example, your one-dollar bill is the same as John’s one-dollar bill.
Unique Each token is unique and different from all other tokens of the same type. For example, your bank account is not the same as John’s bank account
Divisible A fungible token can be divided into smaller units and the total value is still the same. For example, you can divide a dollar bill into two 50 cents or five 20 cents and the total value is still the same.
Non-divisible The non-fungible token cannot be divided into smaller units. The basic unit is one token and one token only. For example, your driving license.
ERC-20 Standard The Ethereum Standard is used for issuance tokens to be used as cryptocurrencies.
ERC-721 Standard The Ethereum Standard is used for the issuance of unique, non-fungible tokens. The most well-known case is CryptoKitties, which is a virtual collectibles marketplace where each kitty is unique.
Non-fungible tokens can be used in KYC (Know Your Customer) procedures, for academic degrees and other educational certificates, collectibles, badges, voting & elections, loyalty programs, in-game items, copyright, supply chain tracking, medical data, software licenses, warranties, and more.
“Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.
These apps run on a custom built blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of property.
”
Definition of Ethereum
Based on the above descriptions, Ethereum is an open-source blockchain-based decentralized platform featuring smart contracts. Indeed, Ethereum is a programmable blockchain that enables developers to build and deploy decentralized applications. Rather than providing users with a set of predefined applications like bitcoin, Ethereum allows users to create any kind of applications they wish. In this way, it serves as a platform for many different types of decentralized blockchain applications, including but not limited to cryptocurrencies.
Ethereum Virtual Machine
At the core of the Ethereum platform is the Ethereum Virtual Machine (“EVM”), which possesses its own programming language, known as the ‘EVM bytecode’. It is the runtime environment that executes all of the smart contracts on the Ethereum network.
The Smart Contract code is written in high-level programming languages such as Solidity. The code is compiled to the EVM bytecode so that the Ethereum Virtual Machine can understand what has been written.
Decentralized Applications(dapps)
The Ethereum Virtual Machine makes the process of creating decentralized applications much easier than ever before. Instead of having to build an entire blockchain for each new application, the EVM enables users to develop decentralized applications all on one platform.
Cryptokitties is one of the most well known decentralized application (dapp) among many dapps developed so far. You can check out lots of interesting dapps at https://www.dapp.com/. I have also developed a prototype dapp that I named it Kittychain Shop. In this virtual pet shop, the user can adopt a kitty, as shown in the figure below.
The Ethereum Architecture
Ethereum runs on a distributed public blockchain network. Each and every node connected to the Ethereum network helps to maintain and update the blockchain database. The nodes of the network run the EVM and execute the instructions according to the smart contracts. Ethereum node runs the EVM in order to maintain consensus across the blockchain.
Ethereum peers achieve consensus via the proof of work algorithm, which is similar to bitcoin. However, they are planning to shift to the proof of stake algorithm in near future to improve scalability. The consensus gives Ethereum a high level of fault tolerance, ensures zero downtime, and makes data stored on the blockchain immutable and secure.
Like Bitcoin, Ethereum allows individuals to exchange cash without involving any middlemen like financial institutions and others. However, Ethereum is more than just cryptocurrency. Beyond financial applications, we can create decentralized applications where trust, security, and permanence are considered important. Among the potential applications are asset registries, voting, governance, Internet of things, supply chain management and more.
Similar to Bitcoin, we can also carry out mining activity in Ethereum. However, In the Ethereum blockchain, instead of mining for bitcoin, miners work to earn Ether, the default currency of Ethereum. Beyond a tradeable cryptocurrency, Ether is also used by application developers to pay for transaction fees and services on the Ethereum network. For example, the user needs to pay for acquiring a crypto asset in a dapps marketplace using Ether.
Generally, people conceive mining in blockchain as a way to obtain bitcoins or other cryptocurrencies. Well, it is partially true but this is not the main purpose of mining. In actual fact, the main objective of mining is to ensure the perpetuity and security of the decentralized network. The network comprises nodes that store the distributed ledgers in the form of the blockchain.
Bitcoins or other cryptocurrencies are awarded to the miners for their effort in maintaining the integrity of the blockchain by validating the transactions in the blockchain. Because of the reward system, miners (nodes) will stay on in the network and help to prevent network downtime. Just imagine if there is no reward, nobody will want to connect to the network and it will just cease to exist.
How does Mining work?
The mining process starts when miners are trying to validate new transactions and record them on the blockchain. The miners are competing to solve a difficult mathematical puzzle based on a cryptographic hash algorithm. The solution found is called the Proof-Of-Work. When a block is ‘solved’, all the transactions contained in the candidate block are considered validated, and the new block is confirmed. This new block will be appended to the blockchain. The time taken to confirm a new block is approximately 10 minutes for bitcoin, for other coins it is much faster. So, if you send or receive some bitcoin, it will take approximately 10 minutes for the transaction to be confirmed.
Miners receive a reward when they solve the complex mathematical problem. There are two types of rewards: new bitcoins and transaction fees. The amount of bitcoins created decreases every 4 years or every 210,000 blocks to be precise. Today, a newly created block creates 12.5 bitcoins. This number will keep going down until no more bitcoin will be issued. This will happen around 2140, when 1 millions bitcoins will have been created. After this date, no more bitcoin will be issued.
Miners can also receive rewards in the form of transaction fees. The winning miner can collect all the transaction fees in the block. As the amount of bitcoin created with each block diminishes, the transactions fees received by the miner will increase. After 2140, the winning miner will only receive transaction fees as his reward.
A blockchain is a distributed digital ledger that can be used to record transactions and other data across a decentralized peer-to-peer network made up of a cluster of computing devices. We can also define a blockchain as a distributed encrypted database like a spreadsheet that is duplicated thousands of times across a network of computers. This network is designed to regularly update this spreadsheet. It is a subset of distributed ledger technologies.
The Blockchain Network
The blockchain network is a peer-to-peer decentralized Network. The peers, also known as nodes, are connected to this network in a synchronous way. The node can be a desktop, a laptop, a mobile phone, mining rig, servers or any other electronic devices. These nodes form the foundation of the blockchain network. They provide computing resources such as disk storage space to keep the network alive and to maintain its integrity and security, and they do it voluntarily.
The main feature of the blockchain is decentralization. To understand what decentralization is, first we need to understand the traditional centralized operation mode. For example, if you go to the supermarket to buy something, you pay with a credit card when you check out. This process requires the approval of a third party, the bank. The transaction is completed after the bank approved it. However, if you use the blockchain platform to perform a transaction, you do not need a third party. The buyer and the seller can trade directly and seamlessly in a transparent and secure blockchain ecosystem.
Another feature of the blockchain is that all participants in the network do not need to establish any trust relationships to perform transactions. It relies on a cryptographic authentication technology, a decentralized network, and a consensus mechanism to ensure the security and integrity of funds and information. Therefore, the information of the blockchain is highly transparent and not easily falsified. Thus, the blockchain system is particularly suitable for a financial industry.
Decentralized Network Vs Centralized Network
Let’s examine the diagrams below to see the difference between a centralized network and a decentralized network. A centralized network has an authoritative central point of control. All the clients are connected to this single point and all their data are stored in the central server. The client has not much control over how the central authority will use his or her data.
A good example is your bank account, the bank keeps your money and manages your account and they record all your transactions. They can also lend your money to other clients. Although this system has been quite reliable, it is prone to the vulnerability of a single point of failure. For example, if a bank’s central server is hacked by a hacker, all the accounts will be compromised.
On the other hand, in the peer-to-peer decentralized network, all the peers work together to upkeep the network via a consensus mechanism. The peers have 100% control of their data and how the data could be used. In addition, they don’t need a third party or a middle entity to perform transactions.
More importantly, it eliminates the vulnerability of a single point of failure. If a node is being hacked, only the data belong to that particular node would be compromised while all other nodes still keep a copy of the ledger. moreover, the cryptographic hashing algorithm makes it extremely difficult to hack the blockchain.
To ensure the nodes are motivated to maintain the network, blockchain incentivizes the nodes through a mechanism known as mining. By engaging in mining activities the successful miners will be rewarded with some cryptocurrencies such as Bitcoin, Ethereum or other coins. I shall explain mining in another article.
The Composition of Blockchain
A blockchain comprises a chronological chain of blocks. The first block is known as the genesis block. A block refers to a set of transactions that are bundled together and appended to the blockchain. The second block is appended to the genesis block, the third block is appended to the second block and so forth, as shown in the following diagram:
Every node in the network stores a copy of the distributed ledgers, or the blockchain, as shown in the figure below.
The Block Structure
A block consists mainly of the block header containing metadata and a list of transactions appended to the block header. The blockchain metadata are as shown in the following figure:
Moreover, there is other information in the block, such as rewards, transaction fees and so on. I will explain them one by one in future articles. If you want to find out the latest Bitcoin block information, you can browse the following link:
The following figure shows the real data of Bitcoin block #546717:
Block Height
The block height of a particular block is defined as the number of blocks preceding it in the blockchain(Investopedia). It is calculated as the length of the blockchain minus one. Genesis block has a block height of zero as it does not have preceding blocks. For example, the height of block 546717 is 546717 (refer to the figure above).
Nonce
A nonce is a random number the miners used to solve a mathematical puzzle in the mining process, which is also known as proof of work. The nonce in the bitcoin block is a 32-bit (4-byte) field whose value is adjusted by the miner to make the hash of the block smaller than or equal to the current target of the network. The concept of proof of work is explained in the following section.
What is Proof of work?
On the Bitcoin blockchain network, the miner nodes bundle unconfirmed and valid transactions into a block. Each block contains a given number of transactions. In the Bitcoin network, every miner must solve a cryptographic puzzle to propose the next block. This process is known as ‘proof of work’. Proof-of-work is a mechanism that existed before the first blockchain was created. It prevents abuses by requiring a certain amount of computing work. That amount of work is key to prevent spamming and tampering. Spamming is no longer worth it if it requires a lot of computing power.
Difficulty
Difficulty is a value that measures the degree of difficulty to find a hash value for a given target, which represents the difficulty of mining. The value of difficulty will be changed once every 2016 blocks, the value will usually increase.
What is Timestamping?
According to Wikipedia, a timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day. In the olden days, the term derives from rubber stamps used in offices to stamp the current date, and sometimes time, in ink on paper documents, to record when the document was received, as shown in the diagram below:
In this digital age, the term has been expanded to refer to the date and time information attached to digital data. For example, computer files contain timestamps that tell when the file was created and when was it last updated. Digital cameras add timestamps to the pictures by recording the date and time the pictures were taken.
The Unix timestamp is the number of seconds passed since midnight on January 1, 1970 (UTC / GMT), ignoring of leap seconds. When I wrote this article, the Unix timestamp is 1540130658. You can check the current timestamp from the links below:
Timestamping is an important feature of blockchain technology. Each block is timestamped, with each new block referring to the previous block using the cryptographic hash. Combined with cryptographic hashes, this timestamped chain of blocks provides an immutable record of all transactions in the blockchain, as shown in the figure below:
What is Hash?
A hash or hash value is the result of a hash function. A hash function takes an input of any length, perform some algorithmic transformation, and produces an alphanumeric value of a predetermined length. The input could be a spreadsheet file, a music file, video file, image file, financial statement, invoice, contract etc.
A hash value comprises a 256 bits(64 characters) random letters and numbers , as follows: “4373c7fb1437035365d9228c77eca2cfd240523e274163e78c1eba11effd8b38”.
You can generate a hash online using the following link:
A given input has a precisely predictable output of a specified length, usually, but not necessarily much shorter than the input.
Even if the input is only slightly changed, the output differs dramatically.
If the hash function is of the cryptographic variety, it is very difficult, if not practically impossible, to infer the original input, given only the output. The degree of difficulty/impossibility depends on the strength of the encryption used.
Every transaction occurring on the blockchain network is encoded with a hashing algorithm to produce a hash that is impossible to decrypt. Hashes are used to represent the current state of the blockchain. It means all the transactions that have taken place so far have been hashed, and the resulting output hash represents the current state of the blockchain. The hash is used for all parties to agree that the state is the same.
Hash is for validation purpose. Data on the blockchain is “hashed” in each block. Each block is linked with the previous block via the hash value. If someone tampers with a block, everyone will know the block is corrupted. Therefore. It preserves the integrity and immutability of the blockchain.
What is a Digital Signature?
According to Wikipedia,
” A digital signature is a mathematical scheme for presenting the authenticity of digital messages or documents. A valid digital signature gives a recipient reason to believe that the message was created by a known sender (authentication), that the sender cannot deny having sent the message (non-repudiation), and that the message was not altered in transit (integrity).“
A digital signature is generated using asymmetric cryptography, which is more secure than handwritten signatures that can be easily forged. It is used as a way to prove that a message originates from a specific individual and not from someone else.
Asymmetric cryptography, also known as public key cryptography (PKI), uses public and private keys to encrypt and decrypt data. In the asymmetric encryption system, a user generates the key pair, which comprises a public key and a private key using some known algorithm. The public key and private key are associated with each other via some mathematical relationship.
The public key is meant to be distributed publicly to serve as an address to receive messages (including cryptocurrencies) from other users, like your Bitcoin or Ethereum address. The private key is meant to be kept secret and is used by the sender to send digitally signed messages to other users. The signature is included in the message so that the recipient can verify using the sender’s public key. This way, the recipient can be sure that only the sender could have sent this message key pair, which is a public key and a private key using some known algorithm. For examle, every transaction on the blockchain is digitally signed by the sender using their private key. This signature ensures that only the owner of the account can move money out of the account.
The steps can be explained below:
Signing the message with the private key
To create a digital signature, the user can use a signing software to create a one-way hash of the electronic data. The private key is then used to encrypt the hash. The encrypted hash, along with other information, is the digital signature. The process of creating a digital signature is illustrated in the following figure:
Verifying the message with the public key
To verify the message, the receiver uses the sender’s public key to decrypt the hash. If this decrypted hash matches a second computed hash of the same data, it proves that the data has not changed since it was signed. If the two hashes do not match, the data has either been tampered with in some way or the signature was created with a private key that does not correspond to the public key presented by the sender. The verification process is illustrated in the following figure:
To sum it all together, blockchain could not exist without hashing and digital signatures. Hashing provides a way for everyone on the blockchain to agree on the current world state, while digital signatures provide a way to ensure that all transactions are only made by the rightful owners. We rely on these two properties to ensure that the blockchain has not been corrupted or compromised.
Blockchain has been the most hyped technology in the last few years. A recent World Economic Forum report predicts that by 2025, 10% of GDP will be generated by blockchain. Though blockchain technology is being overhyped somewhat, it has the potential to disrupt many existing industries.
Some startups, MNCs, governments, non-profit organizations, and even individuals have already developed and implemented blockchain-based applications. Therefore, everyone should take notice of this trend. However, there’s still a lack of understanding about what it is.
To begin with, the first blockchain was invented by Satoshi Nakamoto in 2008 to serve as the public transaction ledger of the cryptocurrency bitcoin. That year, he (or she) posted a paper called Bitcoin – A Peer to Peer Electronic Cash System to a mailing list discussion on cryptography. However, Satoshi Nakamoto real identity remains a mystery to this day. In fact, Satoshi Nakamoto may not be a particular person, but a group of people.
On the other hand, some people argued that Satoshi Nakamoto might not be the first person that created the blockchain technology. The idea behind blockchain technology could be traced back to 1991 when Stuart Haber and W. Scott Stornetta (Scott-Briggs, 2018) conceived the idea on a cryptographically secured chain of blocks. In 1992, they incorporated Merkle trees into the design allowing several documents to be collected into a block.
In addition, there were also previous attempts at creating online currencies with ledgers secured by encryption, among them were B-Money and Bit Gold. B-money was an early proposal created by Wei Dai for an “anonymous, distributed electronic cash system ”. His essay was published on the cypherpunks mailing-list in November 1998. Even Satoshi Nakamoto referenced B-Money when he invented bitcoin. Another precursor of bitcoin is bit gold, invented by Nick Szabo in 1998. Bit Gold is a decentralized digital currency but was never implemented.
However, the blockchain technology did not gain traction until the emergence of bitcoin. Since its debut in 2008, the bitcoin price has skyrocketed. Many people are actively involved in mining activities to get rich quick. From 2011 onwards, many alternative cryptocurrencies have emerged, among them were Ethereum, Namecoin and Litecoin and more. Currently, there are over 1,000 cryptocurrencies in circulation with new ones frequently appearing.
None of the cryptocurrencies came close to challenging Bitcoin until the invention of Ethereum by Vitalik Buterin in 2013. The Ethereum platform introduced the concept of smart contracts and cryptocurrency Ether. It is also a platform for ICO and crypto crowdfunding.