Blockchains based on blocks and hash functions. Blocks

Blockchains today are mostly recognized in the context of cryptocurrencies but serve some other purposes too. One of the earlier designs for blockchains was from a pseudonym called Satoshi Nakamoto who created the Bitcoin cryptocurrencies and solved some problems existing at this time (for example double-spend problem). The fundamental concept of constrcuting such a data structure is based on blocks and hash functions. Blocks is consist of block header and a list of transactions. These blocks are linked sequentially and each block contains the hash value from the previous block. This prevents the previous blocks being modified in a later time and ensures therefore some integrity. It is working because of the security aspects of hash functions which are the pre-image resistance, second pre-image resistance and collision resistance. The transactions can have many different meanings and usages, the most common one is it contains the information of a currency transfer from one account to another. Besides, a transaction also can be the certificate information for a single user cite{qin2017cecoin}. To prevent that malicious users can create transactions for other users there needs to be a mechanism such as signing so that other users can verify the transaction. This leads to the problem how these transactions can be included in a blockchain. The most common usage of blockchains is in a decentralized setting implemented in a peer-to-peer network.When a participant creates a transaction he needs to broadcast it to the network. A deterministic rule is needed to decide about the order of transactions and also to prevent problems such as double-spending. Every blockchain with a global state has a consensus in form of proof-of-work, proof-of-stake and Byzantine Agreement. Proof-of-work is more commonly and lets the participants, which are called miners, solve a problem. The first one who has solved this problem becomes the next block leader and he also gets a reward to give some incentive. Proof-of-stake on the other hand selects the next block creator with a specific algorithm and gives him the right to validate the next block and set of transactions. One idea of this algorithm is that the next leader is chosen based on the amount of coins he put at stake because a rich participant has an incentive to do nothing malicious otherwise he would reduce his own wealth. This is especially interesting because it does not require a lot of computation power which results in a high energy consumption. Byzantine Agreement is considered as a centralized approach to reach consensus. The consensus are made by some pre-selected server and these servers negotiate with each other for making an agreement. Each of these consensus mechanisms have some problems of their own and trust is needed in the system to guarantee that they work. In proof-of-work a so called 51\%-attack can be performed as soon as one user or group has more than 50\% of the computation power. This allows to dismiss transactions or modify some of the last blocks. In reality this has occurred for bitcoin and can let the whole system appear untrustworthy. Proof-of-stake suffers from a selected malicious block creator because there is often no punishment for faulty behavior and also little cost in doing so. Byzantine agreement has a higher requiremnt of the number of honset nodes. There are already some attempts to solve this problem in different kind of ways proposed by Ethereumcite{wood2014ethereum} or PeerCoincite{king2012ppcoin}, for example.subsection{Consensus mechanism}subsubsection{Proof-of-Work}The most widely used mechanism to reach consensus is proof-of-work (PoW). Take Bitcoin as example. The Bitcoin blockchain is replicated on multiple nodes and each node is able to add new transactions into the blockchain. However, if every node broadcasts its new transactions in the network, then the broadcast storm will lead to serious network paralysis. Proof-of-work is designed to solve this problem by presetting a complexity of hash. Instead of broadcasting its new transactions, each node need to firstly calculate a nonce which should be combined with all transactions it receives and the previous block’s hash and then generate a new hash for the current block. Whenever one node (aka miner) finds a hash which meets the complexity requirement of Bitcoin, he broadcasts this hash with the corresponding block (transactions and nonce) in the network, every node who receives this message should verify the validity of this hash. If it is valid, then this block should be append to the original blockchain.Bitcoins blockchain is considered as safe because the attack cost is extremely high. If an attacker want to win the race in proof-of-work, he need controls more than 50\% of the total mining power. Bitcoin guarantees that a new block won’t be found in a pre-set time period by modifying its complexity. POW is proved as an effective mechanism to reach consensus.subsubsection{Proof-of-Stake}Proof-of-stake is another consensus mechanism which achieves a consensus with block leaders. A block leader creates the next block in the blockchain and decides which transactions are part of it. There are different variants how a block leader is selected for the next block. Take Peercoincite{king2012ppcoin} as example. It uses the concept of coinage to select the next block leader. Coinage is a number, which is defined by the time a coin has not been used. Coinage and the amount of coins related to it result in the product being computed.subsubsection{Byzantine Agreement}Byzantine Agreement cite{lamport1982byzantine}, aka Byzantine Generals Problem (BGP) is a classic problem which remains in any distributed computer system network. The original problem is explained as a fictitious historic scenario. Byzantine empire has decided to attack a neighboring country. Its army is divided into several groups and settled in different regions. Each group has a leader, aka general in this case, and generals can communicate with each other either by oral or by written message. Now the problem is, this neighboring county is also powerful, only more than a half generals unite and attack, then they can win this battle, or they will face an unacceptable brutal defeat. Generals know that there are some traitors among them and they want to make an agreement, whether they should attack or not.This problem is firstly proposed by Lamport. In his paper, he simplified this problem as General–Lieutenant model. In each round, one general is selected as General and others generals are considered as Lieutenants, then we can make an agreement upon this general’s decision even with the interference of traitors. After that, if any lieutenant disagrees with the decision that made be this general, he will be elected as Genral and make decisions. Because we know that the majority of generals are loyal, so the result (attack or not) will be convergent. He also proved that if there are no more m traitors in this system and more than 3m + 1 nodes are participating, then an agreement can be made.
ewlineA similar process in Ripple can be descripted as following  cite{schwartz2014ripple}: At first each sever s maintains a unique node list which contains a set of other servers that server s wants to cooperate and make consensus. Then they vote for each single transaction by deciding if it is valid or not and update their ledger. A ledger is a record of the amount of currency in each user’s account and represents the “ground truth” of the network. Any server can broadcast transactions that they want to perform and vote for it.subsection{Real-time gross settlement}Real-time gross settlement (RTGS) is a special funds transfer system where the transmission takes place on a real time basis. “Real-time” means there are no waiting period for transactions. “Gross settlement” means each transaction are not bundled or netted by other transactions. “Settlement” means once a transaction is confirmed, then it can not be revoked. RTGS is generally employed for transfering large-value funds betweene some international banks. RTGS does not require physical exchange of funds, every transfer is done in an electronic way. For example bank A sends bank B 10 million dollars, then the balance of bank A will decrease 10 million dollars, meanwhile bank B increases 10 million dollars.Ripple is a real time gross settlement system, by which you can exchange currency and make remittance. The original founder of Ripple is Ryan Fugger, who is inspired by a local exchange trading system and then he decided to create a financial system which is decentralized and could efficiently allow individuals and communities to transfer their money. After that, blockchain technology appeared and then Ripple is developed based on blochchain and had a high dependency of Bitcoin, which is considered inefficiently and costly now. In May 2011, Arthur Britto and David Schwartz decided to use a new consensus mechanism. Transactions were no more verified by miners during the mining process, instead network members verify the transaction during each rounds. This improvement had made a significant advancement. It remarkably reduced the time which a single user should wait until his transaction is confirmed and almost cost no charges. In September 2012, they founded OpenCoin Inc. which is called Ripple Labs now and created the native cryptocurrency for Ripple which is called XRP. Nowadays Ripple runs a permissioned blockchain to record public ledger and use XRP to maintain its ecosystem. XRP is crucial to Ripple protocol. It is either responsible for enhancing the security goals of Ripple protocol, or acting as the bridge currency of Ripple and supports for any type of currency to exchange. Different from Bitcoin, XRP is used as the incentive mechanism for participants. The incentive scheme of Ripple can be explained as following: Suppose there are two big international companies A and B, they are located in different lands and use different currencies. They cooperate with each other through a trusted third party (an international escorw). However, they both are worried about this trusted third party, who may collude with A or B, so the transaction records between A and B are no more reliable. Under this circumstance, Ripple can help them to maintain a public ledger so that both A and B can make an agreement without trusted third party. Then the payment network will be more reliable and stable. Another benefit is the transfer charges is relative low than using a trusted third party or other decentralized ways such as a smart contract in Ethereum.
ewline2014 is the golden year for Ripple’s development. At this year, Ripple focused at banking area and made a big process. Fidor bank is the first bank which announced to use Ripple in 2014. In the same year’s September, the New Jersey-based Cross River Bank and Kansas-based CBW Bank also accept Ripple protocol and try to start for using it. By December Ripple Labs began working with Earthport and decied to create a cross-border payments service. They tried to combine Ripple’s software with Earthport’s payment services system. At the end of year 2014, Ripple surpass Litecoin and became the second biggest cryptocurrency.On June 13, 2016, Ripple obtained a virtual currency license from the New York State Department of Financial Services, making it the fourth company with a BitLicense.Currently Ripple has developed application for both ios and andriod users. Also it has user-side application for Windows, Unix and Mac OS users. However, the server-side application does not support Windows operating system.subsection{Ripple design features}subsubsection{Gateways}A gateway can be any person or organization that allows people to deposite, withdraw and transfer assets in Ripple liquidity pool. Gateways can be banks, financial organizations and money service businesses who make businesses of providing a way for money and other forms of value to move in and out of the XRP Ledger. For different purposes there are different models cite{Gateway} that a gateway can follow.egin{itemize}item extbf{Issuing Gateway} An issuing gateway is reposible for moving money and other forms of value in and out XRP ledger. All currencies in the XRP Ledger are either XRP or taking the form of issuances tied to a specific issuing gateway.item extbf{Private Exchange} A private exchange is just like a third party market which allows its customer to buy and sell XRP.item extbf{Merchants} Merchants exchange goods by accepting XRP payment. That means user can pay the goods with XRP and get the goods in the real life.end{itemize}subsubsection{Trustlines and rippling}Ripple offers users the possibility to manually set their trustline. Meanwhile, users are also aware of the credit risk for trusting a gateway. After setting the trust of a single gateway, users are also responsible for putting a quantitative limit on their trust. That means, if a user want to deposite 10$ in a gateway which he chooses to trust, then he need firstly grant trust of at least 10$ to the gateway for the money to be available in the Ripple network.subsubsection{Consensus ledger}Similar as many blockchain based micropayment networks, Ripple also relies on a common ledger, which stores the global information of accounts. This ledger is distributed in Ripple network and maintained by server nodes by constantly comparing their own ledger. A server can be anyone who runs a server application. It repeatedly collects transactions and negotiates with other server for deciding if a single transaction should be recorded into ledger. If a single transaction recives supermajority ‘yes’ votes, then this transaction will be added into the global ledger.subsubsection{Market makers}Ripple allows its users to offer arbitrage services. They can earn money by offering services in Ripple. The most common one is acting as a bridge between two end-users. With the increasing number of market makers, the transfer charges will decrease until almost free, the response time of a single tranfer will be quicker and people are able to seamlessly pay each other via the network in different currencies.subsection{Ripple Protocol}subsubsection{Ripple Protocol Component}Before we talk about how ripple works, we need to know some terminologiescite{schwartz2014ripple} in ripple network.egin{itemize}item extbf{Server} A server can be any node which is running in Ripple’s network. In reality, servers are elaborately selected such as international banks and big commercial companies. Server is responsible for participating in the consensus process. In many cases, a server is also a validator which we will be introduced later.item extbf{Ledger} The meaning of ledger is the same as Bitcoin, it records the amount of currency for each users and represents the “ground truth” of the network. One thing that different from Bitcoin is, Ripple has its own blockchain to store the ledger. The ledger is updated repeatedly by adding new transactions in new blocks.item extbf{Last-Closed Ledger} The last-closed ledger is the current perspective of the network.item extbf{Open Ledger} The open ledger is the current under verifying transactions. Each sever receives transactions from its end users and put them into open ledger, which is still under verification.item extbf{Unique Node List (UNL)} Unique node list is the key part of this network. Each server maintains a unique node list and they can either add/remove a node into/from this list. A unique node list is a set of other servers (validators) which this server wants to cooperate with and achieves consensus. A unique node list may contains malicious servers but later we will prove that it will not cause inconsistent of this network. Technically, a unique node list is a list containing a series of public keys.item extbf{Proposer} Any server can be proposer, that means any sever can broadcast transactions to servers in its UNL and negotiate if a single transaction is valid or not.item extbf{Nonfaulty} Any node that behaves correctly and without error can be considered as nonfaulty node. Similarly, a faulty node is either a node behaves honest but with high latency or a malicious node.end{itemize}subsubsection{Ripple Consensus Algorithm}The Ripple Protocol Consensus Algorithm (RPCA)cite{schwartz2014ripple} is the consensus algorithm which every node will automatically apply every couple of seconds for the correctness and consistence of the network.
ewlineRPCA is divided into several rounds, in each round:
ewlineAt the beginning, servers will collect all transactions which they can see from the network, those transactions can be form their end-users or last round. Then servers will validate those transactions. Servers will make a list which contains those valid transactions. And this list is called “candidate set”.
ewlineEach server will send its candidate set to those servers which are in its unique node list. It will also receive some candidate sets and then vote on each transaction’s validity. A ‘yes’ vote means simply signing a transaction.
ewlineThose transactions, which receive a minimum percentage of ‘yes’ votes, will be passed to next round. The threshold of pass should be increased in each round. For example the threshold for first round is 50\%, the second is 60\%, etc. And those which did not receive enough ‘yes’ votes, will either be discarded or remained to the candidate set of next ledger.
ewlineAfter the last round of voting, those transactions which receives more than 80\% votes will be added to the open ledger, and when this open ledger is closed, then it becomes the last-closed ledger.subsubsection{Ripple Validators}A validator is anyone who runs a server side application in Ripple network. It is collected by other servers in UNL and is responsible for determining if transactions are valid (meet the requirement of the protocol) or not. Validators are non-profit and cryptographically identifiable, also there are no running cost for running a validator. The motivation of running a validator is purely to build a strong, robust network. Besides some organsations and banks want to enhence their own financial security, so they decide to participate in consensus process. A single UNL contains five official validators that Ripple runs by default.