Stablecoins: Things you need to know

Stablecoins: Things you need to know

Overview of stablecoins and their role in the market Cryptocurrencies

What are stablecoins?

Stablecoins are a special type of digital asset that represent the value of another currency or asset found outside of this asset’s blockchain. Investors may think of it almost as a derivative product, in that there is an underlying asset involved. “Stable” references that the outside asset is more constant relative to the value held on this asset’s current blockchain. Major cryptocurrencies, Bitcoin and Ether, are renowned for their volatility — which have been the boon and bane of many investors. The most popular currency that stablecoins represent is the US Dollar, thereby allowing for stable on-and-off ramps for investors, a process that previously involved multiple costly transfers between fiat and cryptocurrencies.

Why use cryptocurrencies?

Cryptocurrencies have several potential advantages over using regular fiat. Fiat requires trust in the central issuing government body. Since all major currencies have decoupled from the gold standard in the latter half of the last century, fiat is no longer backed by a hard asset, meaning that value in a fiat currency is tied to trust in the issuing body. The US Dollar and Euro have a high amount of trust and support, but that’s not the case with other currencies. Zimbabwe’s dollar was effectively abandoned as a national currency in 2009 due to hyperinflation. Cryptocurrencies offer a higher level of transparency since all transactions are stored on an immutable ledger. This detailed record-keeping reduces the need for paid intermediaries to verify if and when transactions occurred. Also, consumers benefit from lower transaction fees with remittances. Cross border transactions no longer have to do multiple hops between intermediary currencies based on what individual banks support. Value can be moved in a single step from one user to another. Certain cryptocurrencies allow for programmable logic to be built into blockchains as well.

Cryptocurrencies aren’t sufficient?

Investors have entered the digital asset ecosystem for a number of reasons. Ethereum¹, with the use of smart contracts², offers a multifunctional protocol that has seen significant application development and financial proofs of concept. Ethereum provides a decentralized network for running resilient, secure, and borderless applications. While Ethereum enables the world computer, the majority of transactions are still tied to the real financial world. Bills, insurance, and everyday expenses are still primarily paid in fiat. Complex financial products and commodities, as well as all domestic transactions, are still denominated in US Dollars. With cryptocurrency volatility persisting, having a solution where one gets fiat price stability and blockchain technology is an essential component in the development of the global digital financial ecosystem.

How do stablecoins solve this problem?

  • Stablecoins bridge existing financial markets and crypto-related ones by using the same reference pricing. Users are able to stay in the “digital sphere” while allowing for real-world assets to come online.
  • A digital token with price stability gives investors the opportunity to interact with the digital ecosystem while avoiding the middlemen’s costly conversions between fiat and crypto. The investment experience can remain entirely digital.
  • Fiat currencies’ inherent benefit also applies to stablecoins: the stability of the US Dollar or another asset/currency to which it is linked. Countries with weaker or volatile fiat currencies could utilize stablecoins similar to embracing the USD to manage risk and participate in global monetary systems.
  • Cryptocurrencies’ inherent benefit applies to stablecoins: fast and trustless settlement, frictionless transfer, and use of blockchain technology.

Source CMC

Collateralized Stablecoins

Fiat-backed

Example: TUSD, GUSD, USDC, PAX, USDT

  • Fiat-backed stablecoins are issued in accordance to a set ratio pegged to fiat currency. The total amount of tokens issued must be 1:1 with the total cash in the bank or vault. For example, the USD Coin (USDC) is pegged 1:1 to the US Dollar. This stabilization method presents risks around the trust of centralized third parties. These fiat custodians are audited frequently to prove that the digital tokens are fully backed by fiat deposits.

Asset-backed

Example: Digix

  • The structure of asset-backed stablecoins is similar to fiat-backed, however, the digital coin is pegged to the value of a hard asset instead of a fiat currency. For example, Digix offers a token, DGX, where one token is equal to one gram of gold. This gold is stored in a vault in Singapore and is audited quarterly to ensure the gold reserves correlate to the total market cap of the token.
  • The risks associated with asset-backed stablecoins are similar to the risks of fiat-backed stablecoins in that third parties must be trusted with audits to ensure the peg ratio holds true.

Crypto-backed

Example: DAI

  • Crypto-backed stablecoins are digital tokens that are backed by the value of another digital asset like Bitcoin or ETH. This structure is a bit more complicated as the price of cryptocurrencies can swing wildly; thus simply pegging the two assets, Ether and the stablecoin, 1:1 will not serve to stabilize the price. Thus, more creative solutions, like that of MakerDAO and their stablecoin DAI, have been introduced. Maker uses collateral debt positions (CDP) which operate similar to a bank. Smart contracts on Ethereum hold collateral in ETH and in return give a “loan” of 66% of DAI. If the value of ETH goes below a certain threshold, the user either pays back the CDP, or the position is auctioned to the highest bidder.
  • Currency risk exists in this initial deployment of CDPs due to lack of diversification of a single digital asset, ETH, held as collateral. Future developments of the CDP functionality will allow the smart contracts to hold multiple asset types thereby increasing diversification and reducing volatility.

Non-collateralized Stablecoins

Algorithmic

Example: Basis

  • Algorithmic stablecoins are not backed by a hard asset, but instead automated logic modifies the token supply based on supply and demand. Think of this as an automated central bank that enacts monetary policy through programmatic capital controls.
  • User adoption is one risk faced by algorithmic stablecoins, like Basis, since the functionality of the system required participation for stability.

What do stablecoins enable?

  • Growth of applications using blockchain technology by serving as an intermediary between the digital and fiat world.
  • Greater access to the global financial system: anyone with internet access can gain exposure to stablecoins.
  • Stablecoins are poised to be a powerful vehicle for fundamental long-term changes in the global economy: decentralized stablecoins transcend economic controls and policies.
  • Intersection of stablecoins and tokenized securities: investments and dividends become practical.
  • Programmability: payments via stablecoin are not subject to the volatility of cryptocurrencies.

What comes next?

The next generation of currency, payment, and settlement will undoubtedly occur in digital form. The composition of the initial attempts gives us an idea of where this technology can go. Fiat-backed currencies offer familiarity and ideological comfort of 1:1 backing of the underlying pegged currency. Although introducing centralized risk, they serve an important function to familiarize and build trust with newcomers to the digital ecosystem.

The next generation of currency should allow alternative pegging so that they can be shielded from extraordinary events. Ideally, it should be backed by a diversified uncorrelated basket of assets to avoid effects of such events. Additionally, an ideal stablecoin would execute smart contract logic on-chain and be backed by decentralized assets. Each of the first attempts highlighted above successfully accomplish essential tasks in this development. With certainty, the next evolution in stablecoins is coming.

Thanks for reading ...


What is in a block? - Blockchain

In my previous article, I tried to described the concept of a blockchain with code. This time, I'll try to describe the structure of a single block. I will use the Bitcoin blockchain to explain blocks, but keep in mind that the concepts will remain more or less the same. It could be useful to read my&nbsp;<a href="https://dev.to/damcosset/trying-to-understand-blockchain-by-making-one-ce4" target="_blank">last article</a>to understand a few things first.

Introduction

In my previous article, I tried to described the concept of a blockchain with code. This time, I'll try to describe the structure of a single block. I will use the Bitcoin blockchain to explain blocks, but keep in mind that the concepts will remain more or less the same. It could be useful to read my last articleto understand a few things first.

Structure of a block

A block is a container data structure. In the Bitcoin world, a block contains more than 500 transactions on average. The average size of a block seems to be 1MB (source). In Bitcoin Cash ( a hard fork from the Bitcoin blockchain ), the size of a block can go up to 8MB. This enables more transactions to be processed per second.

Anyway, a block is composed of a header and a long list of transactions. Let's start with the header.

Block Header

The header contains metadata about a block. There are three different sets of metadata:

  • The previous block hash. Remember that in a blockchain, every block is inherits from the previous block because we use the previous block's hash to create the new block's hash. For every block N, we feed it the hash of the block N-1.
  • Mining competition. For a block to be part of the blockchain, it needs to be given a valid hash. This contains the timestamp, the nonce and the difficulty. Mining is another crucial part of the blockchain technology, but it is outside the scope of this article.
  • The third part is a merkle tree root. This is a data structure to summarize the transactions in the block. And we will leave it at that for now. More on this later.
Block identifiers

To identify a block, you have a cryptographic hash, a digital signature if you will. This is created by hashing the block header twice with the SHA256 algorithm. For example, this is a block. I will refer to this block as an example for this article.

The block header hash for this particular block is (right column): 000000000000000000301fcfeb141088a93b77dc0d52571a1185b425256ae2fb

We also can see the previous block's hash (right column): 0000000000000000004b1ef0105dc1275b3adfd067aed63a43324929bed64fd7

Remember that we used the second hash to create the first. Every block uses the previous block's hash to construct its own hash. The block hash is a unique identifier. You won't find two blocks with the same hash.

The other way to identify a specific block is the block height. The is the position of the block in the blockchain. Our example's block is in the 500312 position. This means that there are 500311 blocks before this one. Since the creation of the Bitcoin blockchain in 2009, 500312 blocks have been created ( at the time of writing obviously ).

A block height is not unique. Several blocks can compete for the same position in the case of a fork, like Bitcoin Cash for example.

Merkle Trees

The transactions in a block are contained in a structure called a merkle tree or binary hash tree.

I feel that topics like that are easier to understand with actual examples. So we'll go coding for this. A merkle tree is constructed by recursively hashing pairs of nodes ( in this case, transactions ), until there is only one hash, called the root or merkle root. If we stay in the Bitcoin world, the cryptographic hash algorithm used is SHA256. This is applied twice each time.

An example: We have a block with 4 transactions. For the sake of simplicity, each transaction is a string:

const tA = 'Hello'
const tB = 'How are you?'
const tC = 'This is Thursday'
const tD = 'Happy new Year'

To construct our merkle tree, we start from the bottom. We take each transaction and double-hash them. I'll use the js-sha256 package here.

const sha256 = require('js-sha256').sha256

// Double-hashing here
const hA = sha256(sha256(tA))
const hB = sha256(sha256(tB))
const hC = sha256(sha256(tC))
const hD = sha256(sha256(tD))

//Results
52c87cd40ccfbd7873af4180fced6d38803d4c3684ed60f6513e8d16077e5b8e //hA
426436adcaca92d2f41d221e0dd48d1518b524c56e4e93fd324d10cb4ff8bfb9 //hB
6eeb307fb7fbc0b0fdb8bcfdcd2d455e4f6f347ff8007ed47475481a462e1aeb //hC
fd0df328a806a6517e2eafeaacea72964f689d29560185294b4e99ca16c63f8f //hD

Ok, great. Now remember that I wrote a merkle tree is constructed hashing pairs of nodes. So, we will pair our transactions and concatenate their hashes. Then, we will double hash them too. We will create a hash using the hashes hA and hB, and another for hC and hD. Then, we repeat that process until we have only one hash left and no more pairs to work with. The last hash will be our merkle root.

With only four transactions, this will be rather quick:

//Pairing hA and hB

const hAB = sha256(sha256(hA + hB))
//5dc23d1a2151665e2ac258340aa9a11ed227a4cc235e142a3e1738333575590b

//Pairing hC and hD

const hCD = sha256(sha256(hC + hD))
//ff220daefda29821435691a9aa07dd2c47ca1d2574b8b77344aa783142bae330

// We do it again. We pair hAB and hCD
// This is our root!
const hABCD = sha256(sha256(hAB + hCD))
//301faf21178234b04e1746ee43e126e7b2ecd2188e3fe6986356cc1dd7aa1377

The node at the top of the merkle tree is called the root. This is the information that is stored in the block header in each block on the blockchain. This is how transactions are summarized in each block. In our example block given earlier, the merkle root can be found in the right column: 

a89769d0487a29c73057e14d89afafa0c01e02782cba6c89b7018e5129d475cc

It doesn't matter how many transactions are contained in a block, they always will be summarized by a 32 bytes hash.

Note: The merkle tree is a binary tree. If there is an odd number of transactions, the last one will be duplicated so we can construct our tree.

Because all the leaves in our tree depends on other leaves, it is impossible to alter one leaf without altering others. If you change only one leaf ( one transaction ), the hash changes, therefore the hash you constructed by pairing it with another leaf changes, therefore the merkle root will be different.

You can prove that any transaction is included in a block by creating a authentification path or merkle path. You only need to know log base 2(N) 32-byte hashes. For example:

-For my 4 transactions merkle tree:

log base 2( 4 ) = 2 => If I have a path of 2 hashes for a tree of 4 transactions, I can manage to prove if a transaction belongs to this merkle tree.

For a 16 transactions merkle tree:

log base 2( 16 ) = 4 => If I have a path of 4 hashes for a tree of 16 transactions, I can manage to prove if a transaction belongs to this merkle tree.

log base 2( 1500 ) = 10.55 => If I have a path of 11 hashes for a tree of 1500 transactions, I can manage to prove if a transaction belongs to this merkle tree.

Perhaps a little diagram will help.

There are 16 leaves in this tree. We construct our tree from the bottom up by pairing each leaf. Now, anybody can prove that the leaf I ( in orange ) is part of this block by having the path given in green. We have only 4 hashes, but that is enough to know if the leaf I belongs here. That is because with those informations, we are able to construct every single leaf we need( in yellow ). We can create IJIJKLIJKLMNOP and the root and check if those hashes correspond. This is why it is very complicated to cheat a blockchain. To change one thing means you must change everything.

Well, that's pretty much what a block contains in the Bitcoin blockchain. Hope it helped!


How should i start learning code of any cryptocurrency?

I want to learn about the code of cryptocurrency with all it's features including POS and master node features, currently I have XSN code (stake-net coin) and i want to learn it so i can make use of it to learn different features of blockchain. There is no purpose to clone it or anything. How should i start learning it? I mean from which file should i start learning the code. I have learned basics of c++ but unfortunately I'm not that much good with c++. So from which file should i start learning it there is a lot .cpp and header files. Is there any one can had the same experience learning it?

I want to learn about the code of cryptocurrency with all it's features including POS and master node features, currently I have XSN code (stake-net coin) and i want to learn it so i can make use of it to learn different features of blockchain. There is no purpose to clone it or anything. How should i start learning it? I mean from which file should i start learning the code. I have learned basics of c++ but unfortunately I'm not that much good with c++. So from which file should i start learning it there is a lot .cpp and header files. Is there any one can had the same experience learning it?

Bitcoin to Surpass $100k by 2021? – Jared – Medium

Cryptocurrencies, The decision is yours

I’ve been told by naysayers that Bitcoin “will never hit $100k” and such a proposition is absurd. With a combination of the factors above, I believe that Bitcoin will usurp the $100k barrier within the next 3 years, but the path won’t be seamless. There will be cycles of boom and bust. Also, it’s possible that Bitcoin fails to reach such valuations or is halted by a massive setback like a black swan event. However, my bet is clearly on Bitcoin. In fact, I envision that someday we’ll look back and realize that the greater risk was not investing in Bitcoin at all.