Blockchain Charts

A more detailed diagram of a bitcoin transaction

A more detailed diagram of a bitcoin transaction submitted by BowserKoopa to Buttcoin [link] [comments]

Anyone have simple diagrams of bitcoin transaction signing? /r/Bitcoin

Anyone have simple diagrams of bitcoin transaction signing? /Bitcoin submitted by BitcoinAllBot to BitcoinAll [link] [comments]

An Exploration of Bitcoin Transactions, the Blockchain, and Miners

An Exploration of Bitcoin Transactions, the Blockchain, and Miners submitted by willcosgrove to Bitcoin [link] [comments]

JDE Project Rating (A)-Convergent Decentralized Financial Agreement

2020 is the year of the outbreak of the DeFi market. As products of the DeFi 1.0 era, Maker, AAVE, and Compound have become the infrastructure of DeFI. Innovative projects of DeFi 2.0 represented by Uniswap and YFI have gradually attracted the attention of the market. Currently, DeFI 3.0 has emerged, technology innovation + business model innovation has become the theme of 3.0, and innovative projects represented by JDE have gradually occupied the market. This article focuses on the analysis of the JDE project and comprehensively evaluates the JDE project.
Project Positioning——A-
JDE is called Just for Decentralization. The project is positioned as a decentralized DeFi aggregator protocol. In the current DeFi market, each product is an independent agreement, providing users with independent products. For the user side, every DeFi project operation has a certain threshold. If a user selects multiple DeFi products at the same time, the complexity of the operation will be much higher. JDE's centralized decentralized protocol can better satisfy users' multi-faceted and full-ecological services. You can enjoy DeFi financial services with only one key operation.
Aggregation services are the most urgent needs of users in the current market. For example, similar to loan product AAVE, wealth management product Maker, insurance product NXM, etc., users must perform separate operations on each platform if they want to achieve their needs. The high threshold of DeFI will also prevent some users from entering this decentralized world.
JDE provides a complete protocol suite to allow users to perform fool-like one-key operations. On JDE's platform, it includes loan agreement, payment agreement, insurance agreement, decentralized transaction agreement and Game ecological agreement. Users can operate a variety of decentralized financial products on the protocol cluster. This positioning is very in line with the needs of current DeFi market users, and can serve millions of DeFi industry users to provide accurate services.
Project Technology-A
The DeFi project has high technical requirements. Each agreement is an independent individual, so a complete financial agreement aggregator has higher technical requirements. The technology of JDE has been developed for many years. JDE has created an on-chain and off-chain two-layer solution, which allows each protocol to be completed quickly in a short time, and the protocol cluster can also complete the interaction more quickly. Compared with other platforms, JDE's contract interaction time can be reduced by 60%. JDE's Layer 2 solution transfers transactions and transfers on the chain to off-chain, completes a Transaction off-chain, and then performs backup packaging on the chain. At the same time, JDE has added Aztec, a completely anonymous privacy protocol, which can provide more secure and anonymous services than Bitcoin. The following is the technical architecture diagram of JDE
JDE implements Full Stake DeFI on the technical side. As the basic ecological platform, JDE integrates mainstream products in the DeFi 1.0 and 2.0 eras, such as Maker, AAVE, BZX, Uniswap, Curve, YFI and other projects. It also provides projects based on ETH Full Stake DeFI, an independent solution, builds mainstream DeFi application components. Realize one end to meet all DeFi requirements.
JDE's protocol cluster will choose the most suitable product for users from mainstream products and products built by itself, make intelligent judgments between profitability and security, and then launch products that are most suitable for users. According to the needs of users, it will intelligently choose the products that best meet the users.
Each parameter in the JDE aggregation protocol will go through dozens of demonstrations to ensure that each parameter is in the safest state. JDE's technical teams are all from well-known companies around the world, and have a very deep technical foundation in the blockchain field. Compared with the technology of many DeFi projects on the market, the technical requirements of JDE are more complex. The technical aspect scored A.
Product solution——A+
JDE provides the safest guarantee for products at the bottom of the technology. Provides the most comprehensive and complete ecological services on the product side. JDE Ecology provides DeFI financial product solutions including asset pools, loan products, payment wallets, trading products DEX, insurance protection products, game products, etc.
Throughout the current DeFi financial products on the market, they can only provide a single product and service. But on the JDE platform, users can enjoy all aspects and the entire ecosystem of financial services. From the most basic asset pool for mining, lending to payment, to decentralized DEX platform transactions, insurance services, and game product services. Covers the various needs of mainstream users.
The product solution combines the various needs of the market. Focus on the asset pool JDE DAO Pool-V1. This is a more popular mining product today. In this product of JDE, users provide liquidity by depositing mainstream assets ETH, wBTC, USDT, etc., and can perform lending and DEX liquid pool transactions on the platform. Here the user's mortgage loan is a full mortgage, so the platform transplantation can be guaranteed to be in a safe state. When the user's mortgaged assets cannot cover the user's loaned assets, the platform will automatically liquidate. At this time, the platform will charge a 5% liquidation fee.
JDE Ecological DEX trading products are also the main source of revenue for the platform. The platform will charge a transaction fee of 0.2%, which is the lowest in the entire network. The handling fees of other platforms are above 0.3%. Users can inject liquidity into the DEX platform to become a market maker. The platform is very friendly to the project party, can list currency without review, and provide automated market services. The DEX trading platform can help the platform earn hundreds of thousands of dollars in handling fees (compared to the trading fee of the Uniswap platform).
JDE Eco provides a complete and multi-faceted product solution, and users can enjoy one-stop service. The product angle is rated A.
Economic Model-A
JDE is the first ecosystem in the entire network to successfully implement DAO governance. If you want to make product-related proposals in the JDE ecosystem, you must get the approval of the autonomous committee, which is composed of all currency holders. Each coin-holding user realizes a complete process of autonomy by voting on proposals. JDE's token, JDE, not only has appreciation rights, but also has very large autonomy rights.
Let's take a look at the JDE sub-token economy. The total amount of JDE is 10 million and will never be issued. Among them, 70% is used for community liquidity mining; 5% is owned by the technical team and locked for one year; 1% is for community private placement (20% is issued online, and 10% is released every week); 5% is an insurance pool; 10 % Is the DAO Autonomous Community Ecological Fund.
In the JDE economic model, almost 80% of the tokens are allocated to liquid mining, which is a very high proportion. Early rewards can be given to users who participate in the JDE community early. Users can get liquidity rewards for asset deposits, loans, DEX transactions, etc. in the JDE ecosystem. Only the technical section is allocated to the team, and the position is locked for long enough. 10% is the DAO autonomous community ecological fund, which participates in the DAO autonomous ecology. 5% is the insurance pool, which provides liquidity of funds. 1% is given to community welfare and allocated to users who participated in the early stage.
The profit of the products and services of JDE ecology will be repurchased in the JDE secondary market, which is always in a state of deflation. This economic model provides a long-term development guarantee for the JDE ecology. The economic model community surpasses most projects in the industry. The economic model is scored as A.
Comprehensive analysis, JDE ecology has a layout in the Defi field for many years, and at the same time has a very complete design in project positioning, product solutions, technological development, economic models and other sectors. The products in JDE's product solution will be gradually launched to provide users with the most complete ecological services. The prospects of the JDE project are good. It is currently in the early stages of project development. I look forward to the launch of JDE products to provide users with DeFi ecosystem services!
submitted by blockchainlabs-labs to u/blockchainlabs-labs [link] [comments]

Summary of Tau-Chain Monthly Video Update - July 2020

Karim
Agoras Live: Five functionalities complete: 1. Registration 2. Login 3. User Profile Page 4. Calendar 5. Categories List 6. Wallet Screen Payments: Decided that implementing lightning would be too complex. Instead, we decided to implement our own micropayment mechanism using the native BTC multisig addresses. We are going to use the Omni wallet for payments. TML: Continued debugging, getting a TML demo and test cases ready. Hiring: More hiring efforts to increase team size. Timelines: Committing ourselves to a release of Agoras Live and a basic version of discussions in TML in 2020.
Umar: Been working on making improvements to the context free grammar parsing. We now are able to add constraints to productions in the grammar, allowing us to recognize grammars that are context sensitive. Developed test cases for that, too.
Tomas: Fixed issues in TML and ran several steps in a TML program. Now adding more tests to make sure everything is stable and won’t break. Also been working on a TML tutorial, a recorded script based on the intro to TML which was contained in the TML Playground. Also new features are going to be covered such as arithmetics.
Kilian: More outreach & follow-ups to potential partner universities. Positive response by a professor based in Toronto, presented to him our project. Also, response by KULeuven, Belgium, who unfortunately don’t see a good fit in our project. We’ve had one applicant for the IDNI Grant program and currently are evaluating his proposal. Also, we’ve had an applicant from Bangalore, India for the IDNI Ambassador program and we also have been discussing his proposal. Translation Bounties: We’ve had the blog post “The New Tau” translated to Chinese and have been reviewing the translation. We are going to publish the translation on our website and on the Bitcointalk Chinese forum section. Still to be claimed: German translation of “The New Tau”. Done more effort on reach out to potential tribe channels: Research groups, LinkedIn groups, Facebook groups. Most represented keywords: Complex Adaptive Systems, NLP, Computational Linguistics. Usual feedback: Likes but no further interaction. Created an FAQ answering all possible questions surrounding IDNI, Tau & Agoras Idea: Hosting a virtual panel to spread the word about our project among the scientific community, as well as to create some visual content for our community. Two professors are interested in participating, one from Argentina with a focus in semantic parsing, the other one from the University of Washington with a focus on human-computer interaction and social computing. First step: organizing a pre-panel discussion where in 1on1 calls with the professors we get an opinion of them about what we are doing.
Andrei: Agoras Live: Implemented mail system so users now get their mails (e.g. registration email). Improved UX together with Mo’az, e.g. user profiles. Token creation for accessing calls to identify and charge users. Customized Jitsi interface to suit our needs: E.g. display of how much time passed in a call and how much it costs. Next up: Further improve UX; make sure everything works as intended.
Mo’az: Almost finished the IDNI website. Added two more pages: Events & Bounties in collaboration with Fola & Kilian. Agoras Live: Finetuned all the website’s components in collaboration with Andrei.
Juan: Continued working on the payments system for Agoras Live. Had some delays due to the complexity of debugging such applications. Still, we made significant progress and got the funding transactions implemented over the Lightning network through the Omni layer. Spent time analyzing the minimum amount of BTC to pay for the fees associated to the Omni transactions. We aren’t using segregated witness native addresses and instead are using embedded segregated witness. So transaction sizes are enlarged and transaction fees are a bit higher. So there is a bit of finetuning analysis needed in order to enable the multisig address to pay for the closing & refund transactions. So to provide payment channels over the Omni layer, the main remaining technical detail we have to solve at this point is the closing transaction & the refund transaction.
Fola: Have been continuing to look for great talent in different areas. Continued working on website with Mo’az and Kilian. Been working on the branding for Tau & Agoras. Been getting external support to make sure the branding for Tau & Agoras will be as professional as it can be. Working on marketing efforts needed for the release of Agoras Live to get the media pack for marketing ready. Working together with external people to put a plan together for listing the Agoras token on more prominent exchanges as we get closer to release of Agoras Live.
Ohad: Continued working on restricted versions of second-order logic to understand how to implement them. There is a translation in the literature about how to convert second-order logic by Horn into Datalog. Also, I have been revisiting papers that deal with descriptive complexity of higher-order logic. They mention that they have a translation from second-order logic to QBF. I wasn’t able to find where they explain this translation but I wrote one of them and he said he will send me the paper. If so, that will be very good because we already have a QBF solver. Any binary decision diagram is already a QBF solver, so we can just translate arbitrary second-order logic formulas into QBF. This will be very helpful for us to implement second-order logic. Also, those papers mention several aspects that are relevant for self-interpretation, the laws of laws. Apparently, they suggest that certain fragments of higher-order logic may also support the laws of laws. But this is part of the papers that I didn’t have access to, so I have to wait to get further clarification. I also pushed the whitepaper significantly this month and hope we will be finishing it soon. Also, I was thinking about some optimizations for the parser and also was looking into the Lightning network. It was my mistake that I haven’t done so beforehand and if I had done it beforehand, I would have understood earlier, that Lightning is too much. It is too drastic of a change to how traditional payments work and there apparently is no reason to believe that it is secure. So I’m glad I discovered better now than later that it’s not something we’d like to rely on, although we can have it as an optional feature.
Q&A:
Q: With the project development taking longer than other projects such as Tezos, when can AGRS holders expect something to be released and, how can you reassure us that we made the right decision?
A: With regards to when we see some releases, it seems that we will see some releases in 2020. For comparing to Ethereum and Tezos: Let’s first talk about funding. Both projects had a lot of money. For Ethereum, the reason for is that it has probably done one of the most aggressive marketing campaigns in history. It was completely lacking any kind of honesty. It was simply aggressive. None of Ethereum’s visions and promises became true. It simply became an insecure platform for scams. None of their vision of creating a world computer, of creating a better society, a better currency, became true. Because of this aggressive marketing, they not only raised a lot of money, they also took the price to be so high in the market. If you remember the campaign of the flipping, they did a whole campaign on how they would overtake the marketcap of Bitcoin. For Tezos, they made maybe the largest ICO in history in terms of money, mainly because they came at the right time, at the top of the bubble in 2017, and also their promises for better coordination didn’t come true. Their solution is based on voting and based on Turing completeness and the only reason why they managed to gain such a market cap as of today, is not because they offer better currency, better society, better anything. It basically is a Ponzi-scheme because they offer very high interest rate by very high inflation (5,51%). The only reason why people buy Tezos is to get into this Ponzi-scheme. Because both Tezos and Ethereum lack any true economical or technological substance, their value will not sustain and this is true for almost all projects in the cryptocurrency world. In the software, high-tech market, if you come up with good tech and you do all the right things, you succeed big time. But if you don’t have it and you are purely relying on brainwashing people, it will not sustain. Of course, our solution is so disruptive and sustainable. We offer to do advancements for humanity and for economy.
Q: What three subjects would you first like to see discussed on Tau?
A: Of course, picking three subjects now is a bit speculative, but the first thing that comes to mind is the definitions of what good and bad means and what better and worse means. The second subject is the governance model over Tau. The third one is the specification of Tau itself and how to make it grow and evolve even more to suit wider audiences. The whole point of Tau is people collaborating in order to define Tau itself and to improve it over time, so it will improve up to infinity. This is the main thing, especially initially, that the Tau developers (or rather users) advance the platform more and more.
Q: What is stopping programmers using TML right now? If nothing, what is your opinion on why they aren’t?
A: There is nothing essentially missing in TML in order to let it release. And in fact, we are now working towards packaging it and bringing it towards a release level. For things like documentation, bug fixes, minor features, minor optimizations. We indeed actively work towards releasing TML 1.0 and then we can publish it in e.g. developers channels for them to use it.
submitted by m4nki to tauchain [link] [comments]

RESEARCH REPORT ABOUT KYBER NETWORK

RESEARCH REPORT ABOUT KYBER NETWORK
Author: Gamals Ahmed, CoinEx Business Ambassador

https://preview.redd.it/9k31yy1bdcg51.jpg?width=936&format=pjpg&auto=webp&s=99bcb7c3f50b272b7d97247b369848b5d8cc6053

ABSTRACT

In this research report, we present a study on Kyber Network. Kyber Network is a decentralized, on-chain liquidity protocol designed to make trading tokens simple, efficient, robust and secure.
Kyber design allows any party to contribute to an aggregated pool of liquidity within each blockchain while providing a single endpoint for takers to execute trades using the best rates available. We envision a connected liquidity network that facilitates seamless, decentralized cross-chain token swaps across Kyber based networks on different chains.
Kyber is a fully on-chain liquidity protocol that enables decentralized exchange of cryptocurrencies in any application. Liquidity providers (Reserves) are integrated into one single endpoint for takers and users. When a user requests a trade, the protocol will scan the entire network to find the reserve with the best price and take liquidity from that particular reserve.

1.INTRODUCTION

DeFi applications all need access to good liquidity sources, which is a critical component to provide good services. Currently, decentralized liquidity is comprised of various sources including DEXes (Uniswap, OasisDEX, Bancor), decentralized funds and other financial apps. The more scattered the sources, the harder it becomes for anyone to either find the best rate for their trade or to even find enough liquidity for their need.
Kyber is a blockchain-based liquidity protocol that aggregates liquidity from a wide range of reserves, powering instant and secure token exchange in any decentralized application.
The protocol allows for a wide range of implementation possibilities for liquidity providers, allowing a wide range of entities to contribute liquidity, including end users, decentralized exchanges and other decentralized protocols. On the taker side, end users, cryptocurrency wallets, and smart contracts are able to perform instant and trustless token trades at the best rates available amongst the sources.
The Kyber Network is project based on the Ethereum protocol that seeks to completely decentralize the exchange of crypto currencies and make exchange trustless by keeping everything on the blockchain.
Through the Kyber Network, users should be able to instantly convert or exchange any crypto currency.

1.1 OVERVIEW ABOUT KYBER NETWORK PROTOCOL

The Kyber Network is a decentralized way to exchange ETH and different ERC20 tokens instantly — no waiting and no registration needed.
Using this protocol, developers can build innovative payment flows and applications, including instant token swap services, ERC20 payments, and financial DApps — helping to build a world where any token is usable anywhere.
Kyber’s fully on-chain design allows for full transparency and verifiability in the matching engine, as well as seamless composability with DApps, not all of which are possible with off-chain or hybrid approaches. The integration of a large variety of liquidity providers also makes Kyber uniquely capable of supporting sophisticated schemes and catering to the needs of DeFi DApps and financial institutions. Hence, many developers leverage Kyber’s liquidity pool to build innovative financial applications, and not surprisingly, Kyber is the most used DeFi protocol in the world.
The Kyber Network is quite an established project that is trying to change the way we think of decentralised crypto currency exchange.
The Kyber Network has seen very rapid development. After being announced in May 2017 the testnet for the Kyber Network went live in August 2017. An ICO followed in September 2017, with the company raising 200,000 ETH valued at $60 million in just one day.
The live main net was released in February 2018 to whitelisted participants, and on March 19, 2018, the Kyber Network opened the main net as a public beta. Since then the network has seen increasing growth, with network volumes growing more than 500% in the first half of 2019.
Although there was a modest decrease in August 2019 that can be attributed to the price of ETH dropping by 50%, impacting the overall total volumes being traded and processed globally.
They are developing a decentralised exchange protocol that will allow developers to build payment flows and financial apps. This is indeed quite a competitive market as a number of other such protocols have been launched.
In Brief - Kyber Network is a tool that allows anyone to swap tokens instantly without having to use exchanges. - It allows vendors to accept different types of cryptocurrency while still being paid in their preferred crypto of choice. - It’s built primarily for Ethereum, but any smart-contract based blockchain can incorporate it.
At its core, Kyber is a decentralized way to exchange ETH and different ERC20 tokens instantly–no waiting and no registration needed. To do this Kyber uses a diverse set of liquidity pools, or pools of different crypto assets called “reserves” that any project can tap into or integrate with.
A typical use case would be if a vendor allowed customers to pay in whatever currency they wish, but receive the payment in their preferred token. Another example would be for Dapp users. At present, if you are not a token holder of a certain Dapp you can’t use it. With Kyber, you could use your existing tokens, instantly swap them for the Dapp specific token and away you go.
All this swapping happens directly on the Ethereum blockchain, meaning every transaction is completely transparent.

1.1.1 WHY BUILD THE KYBER NETWORK?

While crypto currencies were built to be decentralized, many of the exchanges for trading crypto currencies have become centralized affairs. This has led to security vulnerabilities, with many exchanges becoming the victims of hacking and theft.
It has also led to increased fees and costs, and the centralized exchanges often come with slow transfer times as well. In some cases, wallets have been locked and users are unable to withdraw their coins.
Decentralized exchanges have popped up recently to address the flaws in the centralized exchanges, but they have their own flaws, most notably a lack of liquidity, and often times high costs to modify trades in their on-chain order books.

Some of the Integrations with Kyber Protocol
The Kyber Network was formed to provide users with a decentralized exchange that keeps everything right on the blockchain, and uses a reserve system rather than an order book to provide high liquidity at all times. This will allow for the exchange and transfer of any cryptocurrency, even cross exchanges, and costs will be kept at a minimum as well.
The Kyber Network has three guiding design philosophies since the start:
  1. To be most useful the network needs to be platform-agnostic, which allows any protocol or application the ability to take advantage of the liquidity provided by the Kyber Network without any impact on innovation.
  2. The network was designed to make real-world commerce and decentralized financial products not only possible but also feasible. It does this by allowing for instant token exchange across a wide range of tokens, and without any settlement risk.
  3. The Kyber Network was created with ease of integration as a priority, which is why everything runs fully on-chain and fully transparent. Kyber is not only developer-friendly, but is also compatible with a wide variety of systems.

1.1.2 WHO INVENTED KYBER?

Kyber’s founders are Loi Luu, Victor Tran, Yaron Velner — CEO, CTO, and advisor to the Kyber Network.

1.1.3 WHAT DISTINGUISHES KYBER?

Kyber’s mission has always been to integrate with other protocols so they’ve focused on being developer-friendly by providing architecture to allow anyone to incorporate the technology onto any smart-contract powered blockchain. As a result, a variety of different dapps, vendors, and wallets use Kyber’s infrastructure including Set Protocol, bZx, InstaDApp, and Coinbase wallet.
Besides, dapps, vendors, and wallets, Kyber also integrates with other exchanges such as Uniswap — sharing liquidity pools between the two protocols.
A typical use case would be if a vendor allowed customers to pay in whatever currency they wish, but receive the payment in their preferred token. Another example would be for Dapp users. At present, if you are not a token holder of a certain Dapp you can’t use it. With Kyber, you could use your existing tokens, instantly swap them for the Dapp specific token and away you go.
Limit orders on Kyber allow users to set a specific price in which they would like to exchange a token instead of accepting whatever price currently exists at the time of trading. However, unlike with other exchanges, users never lose custody of their crypto assets during limit orders on Kyber.
The Kyber protocol works by using pools of crypto funds called “reserves”, which currently support over 70 different ERC20 tokens. Reserves are essentially smart contracts with a pool of funds. Different parties with different prices and levels of funding control all reserves. Instead of using order books to match buyers and sellers to return the best price, the Kyber protocol looks at all the reserves and returns the best price among the different reserves. Reserves make money on the “spread” or differences between the buying and selling prices. The Kyber wants any token holder to easily convert one token to another with a minimum of fuss.

1.2 KYBER PROTOCOL

The protocol smart contracts offer a single interface for the best available token exchange rates to be taken from an aggregated liquidity pool across diverse sources. ● Aggregated liquidity pool. The protocol aggregates various liquidity sources into one liquidity pool, making it easy for takers to find the best rates offered with one function call. ● Diverse sources of liquidity. The protocol allows different types of liquidity sources to be plugged into. Liquidity providers may employ different strategies and different implementations to contribute liquidity to the protocol. ● Permissionless. The protocol is designed to be permissionless where any developer can set up various types of reserves, and any end user can contribute liquidity. Implementations need to take into consideration various security vectors, such as reserve spamming, but can be mitigated through a staking mechanism. We can expect implementations to be permissioned initially until the maintainers are confident about these considerations.
The core feature that the Kyber protocol facilitates is the token swap between taker and liquidity sources. The protocol aims to provide the following properties for token trades: ● Instant Settlement. Takers do not have to wait for their orders to be fulfilled, since trade matching and settlement occurs in a single blockchain transaction. This enables trades to be part of a series of actions happening in a single smart contract function. ● Atomicity. When takers make a trade request, their trade either gets fully executed, or is reverted. This “all or nothing” aspect means that takers are not exposed to the risk of partial trade execution. ● Public rate verification. Anyone can verify the rates that are being offered by reserves and have their trades instantly settled just by querying from the smart contracts. ● Ease of integration. Trustless and atomic token trades can be directly and easily integrated into other smart contracts, thereby enabling multiple trades to be performed in a smart contract function.
How each actor works is specified in Section Network Actors. 1. Takers refer to anyone who can directly call the smart contract functions to trade tokens, such as end-users, DApps, and wallets. 2. Reserves refer to anyone who wishes to provide liquidity. They have to implement the smart contract functions defined in the reserve interface in order to be registered and have their token pairs listed. 3. Registered reserves refer to those that will be cycled through for matching taker requests. 4. Maintainers refer to anyone who has permission to access the functions for the adding/removing of reserves and token pairs, such as a DAO or the team behind the protocol implementation. 5. In all, they comprise of the network, which refers to all the actors involved in any given implementation of the protocol.
The protocol implementation needs to have the following: 1. Functions for takers to check rates and execute the trades 2. Functions for the maintainers to registeremove reserves and token pairs 3. Reserve interface that defines the functions reserves needs to implement
https://preview.redd.it/d2tcxc7wdcg51.png?width=700&format=png&auto=webp&s=b2afde388a77054e6731772b9115ee53f09b6a4a

1.3 KYBER CORE SMART CONTRACTS

Kyber Core smart contracts is an implementation of the protocol that has major protocol functions to allow actors to join and interact with the network. For example, the Kyber Core smart contracts provide functions for the listing and delisting of reserves and trading pairs by having clear interfaces for the reserves to comply to be able to register to the network and adding support for new trading pairs. In addition, the Kyber Core smart contracts also provide a function for takers to query the best rate among all the registered reserves, and perform the trades with the corresponding rate and reserve. A trading pair consists of a quote token and any other token that the reserve wishes to support. The quote token is the token that is either traded from or to for all trades. For example, the Ethereum implementation of the Kyber protocol uses Ether as the quote token.
In order to search for the best rate, all reserves supporting the requested token pair will be iterated through. Hence, the Kyber Core smart contracts need to have this search algorithm implemented.
The key functions implemented in the Kyber Core Smart Contracts are listed in Figure 2 below. We will visit and explain the implementation details and security considerations of each function in the Specification Section.

1.4 HOW KYBER’S ON-CHAIN PROTOCOL WORKS?

Kyber is the liquidity infrastructure for decentralized finance. Kyber aggregates liquidity from diverse sources into a pool, which provides the best rates for takers such as DApps, Wallets, DEXs, and End users.

1.4.1 PROVIDING LIQUIDITY AS A RESERVE

Anyone can operate a Kyber Reserve to market make for profit and make their tokens available for DApps in the ecosystem. Through an open reserve architecture, individuals, token teams and professional market makers can contribute token assets to Kyber’s liquidity pool and earn from the spread in every trade. These tokens become available at the best rates across DApps that tap into the network, making them instantly more liquid and useful.
MAIN RESERVE TYPES Kyber currently has over 45 reserves in its network providing liquidity. There are 3 main types of reserves that allow different liquidity contribution options to suit the unique needs of different providers. 1. Automated Price Reserves (APR) — Allows token teams and users with large token holdings to have an automated yet customized pricing system with low maintenance costs. Synthetix and Melon are examples of teams that run APRs. 2. Fed Price Reserves (FPR) — Operated by professional market makers that require custom and advanced pricing strategies tailored to their specific needs. Kyber alongside reserves such as OneBit, runs FPRs. 3. Bridge Reserves (BR) — These are specialized reserves meant to bring liquidity from other on-chain liquidity providers like Uniswap, Oasis, DutchX, and Bancor into the network.

1.5 KYBER NETWORK ROLES

There Kyber Network functions through coordination between several different roles and functions as explained below: - Users — This entity uses the Kyber Network to send and receive tokens. A user can be an individual, a merchant, and even a smart contract account. - Reserve Entities — This role is used to add liquidity to the platform through the dynamic reserve pool. Some reserve entities are internal to the Kyber Network, but others may be registered third parties. Reserve entities may be public if the public contributes to the reserves they hold, otherwise they are considered private. By allowing third parties as reserve entities the network adds diversity, which prevents monopolization and keeps exchange rates competitive. Allowing third party reserve entities also allows for the listing of less popular coins with lower volumes. - Reserve Contributors — Where reserve entities are classified as public, the reserve contributor is the entity providing reserve funds. Their incentive for doing so is a profit share from the reserve. - The Reserve Manager — Maintains the reserve, calculates exchange rates and enters them into the network. The reserve manager profits from exchange spreads set by them on their reserves. They can also benefit from increasing volume by accessing the entire Kyber Network. - The Kyber Network Operator — Currently the Kyber Network team is filling the role of the network operator, which has a function to adds/remove Reserve Entities as well as controlling the listing of tokens. Eventually, this role will revert to a proper decentralized governance.

1.6 BASIC TOKEN TRADE

A basic token trade is one that has the quote token as either the source or destination token of the trade request. The execution flow of a basic token trade is depicted in the diagram below, where a taker would like to exchange BAT tokens for ETH as an example. The trade happens in a single blockchain transaction. 1. Taker sends 1 ETH to the protocol contract, and would like to receive BAT in return. 2. Protocol contract queries the first reserve for its ETH to BAT exchange rate. 3. Reserve 1 offers an exchange rate of 1 ETH for 800 BAT. 4. Protocol contract queries the second reserve for its ETH to BAT exchange rate. 5. Reserve 2 offers an exchange rate of 1 ETH for 820 BAT. 6. This process goes on for the other reserves. After the iteration, reserve 2 is discovered to have offered the best ETH to BAT exchange rate. 7. Protocol contract sends 1 ETH to reserve 2. 8. The reserve sends 820 BAT to the taker.

1.7 TOKEN-TO-TOKEN TRADE

A token-to-token trade is one where the quote token is neither the source nor the destination token of the trade request. The exchange flow of a token to token trade is depicted in the diagram below, where a taker would like to exchange BAT tokens for DAI as an example. The trade happens in a single blockchain transaction. 1. Taker sends 50 BAT to the protocol contract, and would like to receive DAI in return. 2. Protocol contract sends 50 BAT to the reserve offering the best BAT to ETH rate. 3. Protocol contract receives 1 ETH in return. 4. Protocol contract sends 1 ETH to the reserve offering the best ETH to DAI rate. 5. Protocol contract receives 30 DAI in return. 6. Protocol contract sends 30 DAI to the user.

2.KYBER NETWORK CRYSTAL (KNC) TOKEN

Kyber Network Crystal (KNC) is an ERC-20 utility token and an integral part of Kyber Network.
KNC is the first deflationary staking token where staking rewards and token burns are generated from actual network usage and growth in DeFi.
The Kyber Network Crystal (KNC) is the backbone of the Kyber Network. It works to connect liquidity providers and those who need liquidity and serves three distinct purposes. The first of these is to collect transaction fees, and a portion of every fee collected is burned, which keeps KNC deflationary. Kyber Network Crystals (KNC), are named after the crystals in Star Wars used to power light sabers.
The KNC also ensures the smooth operation of the reserve system in the Kyber liquidity since entities must use third-party tokens to buy the KNC that pays for their operations in the network.
KNC allows token holders to play a critical role in determining the incentive system, building a wide base of stakeholders, and facilitating economic flow in the network. A small fee is charged each time a token exchange happens on the network, and KNC holders get to vote on this fee model and distribution, as well as other important decisions. Over time, as more trades are executed, additional fees will be generated for staking rewards and reserve rebates, while more KNC will be burned. - Participation rewards — KNC holders can stake KNC in the KyberDAO and vote on key parameters. Voters will earn staking rewards (in ETH) - Burning — Some of the network fees will be burned to reduce KNC supply permanently, providing long-term value accrual from decreasing supply. - Reserve incentives — KNC holders determine the portion of network fees that are used as rebates for selected liquidity providers (reserves) based on their volume performance.

Finally, the KNC token is the connection between the Kyber Network and the exchanges, wallets, and dApps that leverage the liquidity network. This is a virtuous system since entities are rewarded with referral fees for directing more users to the Kyber Network, which helps increase adoption for Kyber and for the entities using the Network.
And of course there will soon be a fourth and fifth uses for the KNC, which will be as a staking token used to generate passive income, as well as a governance token used to vote on key parameters of the network.
The Kyber Network Crystal (KNC) was released in a September 2017 ICO at a price around $1. There were 226,000,000 KNC minted for the ICO, with 61% sold to the public. The remaining 39% are controlled 50/50 by the company and the founders/advisors, with a 1 year lockup period and 2 year vesting period.
Currently, just over 180 million coins are in circulation, and the total supply has been reduced to 210.94 million after the company burned 1 millionth KNC token in May 2019 and then its second millionth KNC token just three months later.
That means that while it took 15 months to burn the first million KNC, it took just 10 weeks to burn the second million KNC. That shows how rapidly adoption has been growing recently for Kyber, with July 2019 USD trading volumes on the Kyber Network nearly reaching $60 million. This volume has continued growing, and on march 13, 2020 the network experienced its highest daily trading activity of $33.7 million in a 24-hour period.
Currently KNC is required by Reserve Managers to operate on the network, which ensures a minimum amount of demand for the token. Combined with future plans for burning coins, price is expected to maintain an upward bias, although it has suffered along with the broader market in 2018 and more recently during the summer of 2019.
It was unfortunate in 2020 that a beginning rally was cut short by the coronavirus pandemic, although the token has stabilized as of April 2020, and there are hopes the rally could resume in the summer of 2020.

2.1 HOW ARE KNC TOKENS PRODUCED?

The native token of Kyber is called Kyber Network Crystals (KNC). All reserves are required to pay fees in KNC for the right to manage reserves. The KNC collected as fees are either burned and taken out of the total supply or awarded to integrated dapps as an incentive to help them grow.

2.2 HOW DO YOU GET HOLD OF KNC TOKENS?

Kyber Swap can be used to buy ETH directly using a credit card, which can then be used to swap for KNC. Besides Kyber itself, exchanges such as Binance, Huobi, and OKex trade KNC.

2.3 WHAT CAN YOU DO WITH KYBER?

The most direct and basic function of Kyber is for instantly swapping tokens without registering an account, which anyone can do using an Etheruem wallet such as MetaMask. Users can also create their own reserves and contribute funds to a reserve, but that process is still fairly technical one–something Kyber is working on making easier for users in the future.

2.4 THE GOAL OF KYBER THE FUTURE

The goal of Kyber in the coming years is to solidify its position as a one-stop solution for powering liquidity and token swapping on Ethereum. Kyber plans on a major protocol upgrade called Katalyst, which will create new incentives and growth opportunities for all stakeholders in their ecosystem, especially KNC holders. The upgrade will mean more use cases for KNC including to use KNC to vote on governance decisions through a decentralized organization (DAO) called the KyberDAO.
With our upcoming Katalyst protocol upgrade and new KNC model, Kyber will provide even more benefits for stakeholders. For instance, reserves will no longer need to hold a KNC balance for fees, removing a major friction point, and there will be rebates for top performing reserves. KNC holders can also stake their KNC to participate in governance and receive rewards.

2.5 BUYING & STORING KNC

Those interested in buying KNC tokens can do so at a number of exchanges. Perhaps your best bet between the complete list is the likes of Coinbase Pro and Binance. The former is based in the USA whereas the latter is an offshore exchange.
The trading volume is well spread out at these exchanges, which means that the liquidity is not concentrated and dependent on any one exchange. You also have decent liquidity on each of the exchange books. For example, the Binance BTC / KNC books are wide and there is decent turnover. This means easier order execution.
KNC is an ERC20 token and can be stored in any wallet with ERC20 support, such as MyEtherWallet or MetaMask. One interesting alternative is the KyberSwap Android mobile app that was released in August 2019.
It allows for instant swapping of tokens and has support for over 70 different altcoins. It also allows users to set price alerts and limit orders and works as a full-featured Ethereum wallet.

2.6 KYBER KATALYST UPGRADE

Kyber has announced their intention to become the de facto liquidity layer for the Decentralized Finance space, aiming to have Kyber as the single on-chain endpoint used by the majority of liquidity providers and dApp developers. In order to achieve this goal the Kyber Network team is looking to create an open ecosystem that garners trust from the decentralized finance space. They believe this is the path that will lead the majority of projects, developers, and users to choose Kyber for liquidity needs. With that in mind they have recently announced the launch of a protocol upgrade to Kyber which is being called Katalyst.
The Katalyst upgrade will create a stronger ecosystem by creating strong alignments towards a common goal, while also strengthening the incentives for stakeholders to participate in the ecosystem.
The primary beneficiaries of the Katalyst upgrade will be the three major Kyber stakeholders: 1. Reserve managers who provide network liquidity; 2. dApps that connect takers to Kyber; 3. KNC holders.
These stakeholders can expect to see benefits as highlighted below: Reserve Managers will see two new benefits to providing liquidity for the network. The first of these benefits will be incentives for providing reserves. Once Katalyst is implemented part of the fees collected will go to the reserve managers as an incentive for providing liquidity.
This mechanism is similar to rebates in traditional finance, and is expected to drive the creation of additional reserves and market making, which in turn will lead to greater liquidity and platform reach.
Katalyst will also do away with the need for reserve managers to maintain a KNC balance for use as network fees. Instead fees will be automatically collected and used as incentives or burned as appropriate. This should remove a great deal of friction for reserves to connect with Kyber without affecting the competitive exchange rates that takers in the system enjoy. dApp Integrators will now be able to set their own spread, which will give them full control over their own business model. This means the current fee sharing program that shares 30% of the 0.25% fee with dApp developers will go away and developers will determine their own spread. It’s believed this will increase dApp development within Kyber as developers will now be in control of fees.
KNC Holders, often thought of as the core of the Kyber Network, will be able to take advantage of a new staking mechanism that will allow them to receive a portion of network fees by staking their KNC and participating in the KyberDAO.

2.7 COMING KYBERDAO

With the implementation of the Katalyst protocol the KNC holders will be put right at the heart of Kyber. Holders of KNC tokens will now have a critical role to play in determining the future economic flow of the network, including its incentive systems.
The primary way this will be achieved is through KyberDAO, a way in which on-chain and off-chain governance will align to streamline cooperation between the Kyber team, KNC holders, and market participants.
The Kyber Network team has identified 3 key areas of consideration for the KyberDAO: 1. Broad representation, transparent governance and network stability 2. Strong incentives for KNC holders to maintain their stake and be highly involved in governance 3. Maximizing participation with a wide range of options for voting delegation
Interaction between KNC Holders & Kyber
This means KNC holders have been empowered to determine the network fee and how to allocate the fees to ensure maximum network growth. KNC holders will now have three fee allocation options to vote on: - Voting Rewards: Immediate value creation. Holders who stake and participate in the KyberDAO get their share of the fees designated for rewards. - Burning: Long term value accrual. The decreasing supply of KNC will improve the token appreciation over time and benefit those who did not participate. - Reserve Incentives:Value creation via network growth. By rewarding Kyber reserve managers based on their performance, it helps to drive greater volume, value, and network fees.

2.8 TRANSPARENCY AND STABILITY

The design of the KyberDAO is meant to allow for the greatest network stability, as well as maximum transparency and the ability to quickly recover in emergency situations. Initally the Kyber team will remain as maintainers of the KyberDAO. The system is being developed to be as verifiable as possible, while still maintaining maximum transparency regarding the role of the maintainer in the DAO.
Part of this transparency means that all data and processes are stored on-chain if feasible. Voting regarding network fees and allocations will be done on-chain and will be immutable. In situations where on-chain storage or execution is not feasible there will be a set of off-chain governance processes developed to ensure all decisions are followed through on.

2.9 KNC STAKING AND DELEGATION

Staking will be a new addition and both staking and voting will be done in fixed periods of times called “epochs”. These epochs will be measured in Ethereum block times, and each KyberDAO epoch will last roughly 2 weeks.
This is a relatively rapid epoch and it is beneficial in that it gives more rapid DAO conclusion and decision-making, while also conferring faster reward distribution. On the downside it means there needs to be a new voting campaign every two weeks, which requires more frequent participation from KNC stakeholders, as well as more work from the Kyber team.
Delegation will be part of the protocol, allowing stakers to delegate their voting rights to third-party pools or other entities. The pools receiving the delegation rights will be free to determine their own fee structure and voting decisions. Because the pools will share in rewards, and because their voting decisions will be clearly visible on-chain, it is expected that they will continue to work to the benefit of the network.

3. TRADING

After the September 2017 ICO, KNC settled into a trading price that hovered around $1.00 (decreasing in BTC value) until December. The token has followed the trend of most other altcoins — rising in price through December and sharply declining toward the beginning of January 2018.
The KNC price fell throughout all of 2018 with one exception during April. From April 6th to April 28th, the price rose over 200 percent. This run-up coincided with a blog post outlining plans to bring Bitcoin to the Ethereum blockchain. Since then, however, the price has steadily fallen, currently resting on what looks like a $0.15 (~0.000045 BTC) floor.
With the number of partners using the Kyber Network, the price may rise as they begin to fully use the network. The development team has consistently hit the milestones they’ve set out to achieve, so make note of any release announcements on the horizon.

4. COMPETITION

The 0x project is the biggest competitor to Kyber Network. Both teams are attempting to enter the decentralized exchange market. The primary difference between the two is that Kyber performs the entire exchange process on-chain while 0x keeps the order book and matching off-chain.
As a crypto swap exchange, the platform also competes with ShapeShift and Changelly.

5.KYBER MILESTONES

• June 2020: Digifox, an all-in-one finance application by popular crypto trader and Youtuber Nicholas Merten a.k.a DataDash (340K subs), integrated Kyber to enable users to easily swap between cryptocurrencies without having to leave the application. • June 2020: Stake Capital partnered with Kyber to provide convenient KNC staking and delegation services, and also took a KNC position to participate in governance. • June 2020: Outlined the benefits of the Fed Price Reserve (FPR) for professional market makers and advanced developers. • May 2020: Kyber crossed US$1 Billion in total trading volume and 1 Million transactions, performed entirely on-chain on Ethereum. • May 2020: StakeWith.Us partnered Kyber Network as a KyberDAO Pool Master. • May 2020: 2Key, a popular blockchain referral solution using smart links, integrated Kyber’s on-chain liquidity protocol for seamless token swaps • May 2020: Blockchain game League of Kingdoms integrated Kyber to accept Token Payments for Land NFTs. • May 2020: Joined the Zcash Developer Alliance , an invite-only working group to advance Zcash development and interoperability. • May 2020: Joined the Chicago DeFi Alliance to help accelerate on-chain market making for professionals and developers. • March 2020: Set a new record of USD $33.7M in 24H fully on-chain trading volume, and $190M in 30 day on-chain trading volume. • March 2020: Integrated by Rarible, Bullionix, and Unstoppable Domains, with the KyberWidget deployed on IPFS, which allows anyone to swap tokens through Kyber without being blocked. • February 2020: Popular Ethereum blockchain game Axie Infinity integrated Kyber to accept ERC20 payments for NFT game items. • February 2020: Kyber’s protocol was integrated by Gelato Finance, Idle Finance, rTrees, Sablier, and 0x API for their liquidity needs. • January 2020: Kyber Network was found to be the most used protocol in the whole decentralized finance (DeFi) space in 2019, according to a DeFi research report by Binance. • December 2019: Switcheo integrated Kyber’s protocol for enhanced liquidity on their own DEX. • December 2019: DeFi Wallet Eidoo integrated Kyber for seamless in-wallet token swaps. • December 2019: Announced the development of the Katalyst Protocol Upgrade and new KNC token model. • July 2019: Developed the Waterloo Bridge , a Decentralized Practical Cross-chain Bridge between EOS and Ethereum, successfully demonstrating a token swap between Ethereum to EOS. • July 2019: Trust Wallet, the official Binance wallet, integrated Kyber as part of its decentralized token exchange service, allowing even more seamless in-wallet token swaps for thousands of users around the world. • May 2019: HTC, the large consumer electronics company with more than 20 years of innovation, integrated Kyber into its Zion Vault Wallet on EXODUS 1 , the first native web 3.0 blockchain phone, allowing users to easily swap between cryptocurrencies in a decentralized manner without leaving the wallet. • January 2019: Introduced the Automated Price Reserve (APR) , a capital efficient way for token teams and individuals to market make with low slippage. • January 2019: The popular Enjin Wallet, a default blockchain DApp on the Samsung S10 and S20 mobile phones, integrated Kyber to enable in-wallet token swaps. • October 2018: Kyber was a founding member of the WBTC (Wrapped Bitcoin) Initiative and DAO. • October 2018: Developed the KyberWidget for ERC20 token swaps on any website, with CoinGecko being the first major project to use it on their popular site.

Full Article

submitted by CoinEx_Institution to kybernetwork [link] [comments]

Bull market is back… Another wave of hacker attacks starts again?

Bull market is back… Another wave of hacker attacks starts again?

The picture from COINDESK related reports
On Aug. 2, Ethereum Classic Labs (ETC Labs) made an important announcement on ETC blockchain. ETC Labs said due to network attack, Ethereum Classic suffered a reorganization on August 1st. This has been the second attack on the Ethereum Classic Network this year.
Did renting-power cause the problem again?
In this ETC incident, one of the miners mined a large number of blocks offline. When the miner went online, due to its high computing power, and some versions of mining software did not support large-scale blockchain mergers, the consensus failed. Therefore, the entire network was out of sync, which produced an effect similar to a 51% attack. Finally, it caused the reorganization of 3693 blocks, starting at 10904147. The deposit and withdrawal between the exchanges and mining pools had to be suspended for troubleshooting during this period.
Media report shows that the blockchain reorganization may be caused by a miner (or a mining pool) disconnected during mining. Although it has been restored to normal after 15 hours of repair, it does reflect the vulnerability of the Proof of Work (PoW) network: once the computing power of the network is insufficient, the performance of one single mining pool can affect the entire network, which is neither distributed nor secure for the blockchain. Neither does it have efficiency.
At present, most consensus algorithms of blockchains are using PoW, which has been adopted over 10 years. In PoW, each miner solves a hashing problem. The probability to solve the problem successfully is proportional to the ratio of the miner’s hash power to the total hash power of mainnet.
Although PoW has been running for a long time, the attack model against PoW is very straightforward to understand, and has attracted people’s attention for a long time: such an attack, also known as double-spending attack, may happen when an attacker possesses 51% of the overall network hash power. The attacker can roll back any blocks in the blockchain by creating a longer and more difficult chain and as a result, modify the transaction information.
Since hash power can be rented to launch attacks, some top 30 projects have suffered from such attacks. In addition to this interference, the main attack method is through the computing power market such as Nice Hash. Hackers can rent hashpower to facilitate their attacks, which allows the computing power to rise rapidly in a short time and rewrite information. In January of this year, the Ethereum Classic was attacked once, and it was also the case that hackers can migrate computing power from the fiercely competitive Bitcoin and Ethereum, and use it to attack smaller projects, such as ETH Classic.

The picture shows the cost of attacking ETH Classic. It can be seen that it costs only $6,634 to attack ETH Classic for one hour.
The security of one network is no longer limited by whether miners within the main net take more than 51% of the total hash power, rather it is determined by whether the benevolent (non-hackers) miners take more than 51% of the total hash power from the pool of projects that use similar consensus algorithm. For example, the hash power of Ethereum is 176 TH/s and that of Ethereum Classic is 9 TH/s. In this way, if one diverts some hash power from Ethereum (176 TH/s) to Ethereum Classic, then one can easily launch a double-spending attack to Ethereum Classic. The hash power ratio for this attack between the two projects is 9/176 = 5.2%, which is a tiny number.

https://preview.redd.it/qj57vgmgb9f51.png?width=699&format=png&auto=webp&s=39c1efc3645f268dbf1c73e1b373d532d5461006
As one of the top 30 blockchain projects, Ethereum Classic has been attacked several times. Therefore, those small and medium-sized projects with low hash power and up-and-coming future projects are facing great potential risks. This is the reason that many emerging public chain projects abandon PoW and adopt PoS.
Proof of Stake (PoS) can prevent 51% attack but has problems of its own
In addition to PoW consensus, another well-adopted consensus algorithm is Proof of Stake (PoS). The fundamental concept is that the one who holds more tokens has the right to create the blocks. This is similar to shareholders in the stock market. The token holders also have the opportunities to get rewards. The advantages of PoS are: (i) the algorithm avoids wasting energy like that in PoW calculation; and (ii) its design determines that the PoS will not be subjected to 51% hash power attack since the algorithm requires the miner to possess tokens in order to modify the ledger. In this way, 51% attack becomes costly and meaningless.

https://preview.redd.it/rf65o1vhb9f51.png?width=685&format=png&auto=webp&s=9d7a9f9dab6ce823a224e91afa9d116310cf27e1
In terms of disadvantages, nodes face the problem of accessibility. PoS requires a permission to enter the network and nodes cannot enter and exit freely and thus lacks openness. It can easily be forked. In the long run, the algorithm is short of decentralization, and leads to the Matthew effect of accumulated advantages whereby miners with more tokens will receive more rewards and perpetuate the cycle.
More importantly, the current PoS consensus has not been verified for long-term reliability. Whether it can be as stable as the PoW system is yet to be verified. For some of the PoW public chains that are already launched, if they want to switch consensus, they need to do hard fork, which divides communities and carries out a long consensus upgrade and through which Ethereum is undergoing. Is there a safer and better solution?
QuarkChain Provide THE Solution: High TPS Protection + PoSW Consensus
For new-born projects, and some small or medium-sized projects, they all are facing the problem of power attack. For PoW-based chains, there are always some chains with lower hash power than others (ETC vs. ETH, BCH vs BTC), and thus the risk of attack is increased. In addition, the interoperability among the chains, such as cross-chain operation, is also a problem. In response, QuarkChain has designed a series of mechanisms to solve this problem. This can be summed up as a two-layer structure with a calculation power allocation and Proof of Staked Work (PoSW) consensus.
First of all, there is a layer of sharding, which can be considered as some parallel chains. Each sharding chain handles the transactions relatively independently. Such design forms the basis to ensure the performance of the entire system. To avoid security issues caused by the dilution of the hash power, we also have a root chain. The blocks of the root chain do not contain transactions, but are responsible for verifying the transactions of each shard. Relying on the hash power distribution algorithm, the hash power of the root chain will always account for 51% of the net. Each shard, on the other hand, packages their transactions according to their own consensus and transaction models.
Moreover, QuarkChain relies on flexibility that allows each shard to have different consensus and transaction models. Someone who wants to launch a double-spending attack on a shard that is already contained in the root chain must attack the block on the root chain, which requires calling the 51% hash power of the root chain. That is, if there are vertical field projects that open new shards on QuarkChain, even with insufficient hash power, an attacker must first attack the root chain if he or she wants to attack a new shard. The root chain has maintained more than 51% of the network’s hash power, which makes the attack very difficult.

https://preview.redd.it/rxpohs7jb9f51.png?width=674&format=png&auto=webp&s=e2df1307a1753542472f2b6da88e7a4022b30884

As illustrated in the diagram, if the attacker wants to attack the QuarkChain network, one would need to attack the shard and the root chain simultaneously.
PoW has achieved a high level of decentralization and has been verified for its stability for a long time. Combining PoW with the staking capability for PoS would make use of the advantages of both consensus mechanisms. That is what QuarkChain’s PoSW achieves exactly.
PoSW, which is Proof of Staked Work, is exclusively developed by QuarkChain and runs on shards. PoSW allows miners to enjoy the benefits of lower mining difficulty by staking original tokens (currently it’s 20 times lower). Conversely, if someone malicious with a high hash power and does not stake tokens on QuarkChain, he will be punishable by receiving 20 times the difficulty of the hash power, which increases the cost of attack. If the attacker stakes tokens in order to reduce the cost of attack, he/she needs to stake the corresponding amount of tokens, which may cost even more. Thus, the whole network is more secure.
Taking Ethereum Classics (ETC) as an example, if ETC uses the PoSW consensus, if there was another double-spending attack similar to the one in January, the attacker will need at least 110Th/s hash power or 650320 ETC (worth $3.2 million, and 8 TH/s hash power) to create this attack, which is far greater than the cost of the current attack on the network (8Th/s hash power) and revenue (219500 ETC).
Relying on multiple sets of security mechanisms, QuarkChain ensures its own security, while providing security for new shards and small and medium-sized projects. Its high level of flexibility also allows the projects to support different types of ledger models, transaction models, virtual machines, and token economics. Such great degrees of security and flexibility will facilitate the blockchain ecosystem to accelerate growth of innovative blockchain applications.
Learn more about QuarkChain
Website https://www.quarkchain.io
Telegram https://t.me/quarkchainio
Twitter https://twitter.com/Quark_Chain
Medium https://medium.com/quarkchain-official
Reddit https://www.reddit.com/quarkchainio/
Community https://community.quarkchain.io/
submitted by QuarkChain to quarkchainio [link] [comments]

What to expect in Ethereum 2.0

What to expect in Ethereum 2.0
https://preview.redd.it/jqk8bex0lud51.jpg?width=2240&format=pjpg&auto=webp&s=7a20994c9615853e5fca73cdbfec645a13525a9b
Introduction
Ethereum is the second most popular cryptocurrency platform by market capitalization. It is a blockchain-based open-source decentralized software platform that provides much attractive functionality like the development and deployment of smart contracts. Decentralized applications (Dapps), etc which was not supported by Bitcoin. It also serves as the base platform for many different cryptocurrencies like Compound, MakerDao, Enjin, etc.
Like any other technology, Ethereum is also developing and planning to undergo a series of network upgrades to improve the features, functions, and performance of the current Ethereum network.
Ethereum 2.0 also termed as Eth2 or ‘Serenity’, is the next major network upgrade of the Ethereum blockchain. This upgrade will be launched in multiple phases: Phase 0, Phase 1, and Phase 2 starting with Phase 0 planned to be launched in 2020. Rest phases will be released in the coming years.
Note that the network upgrade will not lead to any changes in the data history, transaction records, etc of the Ethereum 1.0 chain. The Ethereum 1.0 chain is expected to become the first shard chain on Ethereum 2.0. Until then, the Ethereum 1.0 chain will continue to operate in the same way as it is running now. But it is expected to undergo certain improvements to embed it as an Ethereum 2.0 shard.
The main motto behind the launch of Ethereum 2.0 is to enhance the security, scalability, simplicity, and throughput of the Ethereum network.
Design Goals
Danny Ryan, Ethereum researcher has mentioned 5 important design goals for Ethereum 2.0:
· Decentralization: Common people having only a desktop or a laptop with O(C) resources would be able to process/validate O(1) shards.
· Resilience: The network will be flexible enough to recover from any major network partitions or incase of large portions of nodes go offline.
· Security: Large participation of validators in total and per unit time should not impact the overall security of the network.
· Simplicity: Network complexity will be reduced, even at the cost of loss in efficiency if required.
· Longevity: To select all components such that they are either quantum secure or can be easily swapped out for quantum secure counterparts when available.
Ethereum 2.0 Roadmap

https://preview.redd.it/jb51yw56lud51.png?width=969&format=png&auto=webp&s=45f034e868c8b520f7d97067cc710688f21445ca
Ethereum 2.0 overall architecture Original diagram by Hsiao-Wei Wang Source
The PoW Main Chain is the Ethereum Mainnet that is currently running. Different development phases of Ethereum 2.0 are as follows:
· Phase 0 - Beacon Chain
The development of the Beacon Chain is currently under progress and is planned to be launched in 2020. The Beacon Chain will manage the Casper Proof of Stake protocol for itself and all of the shard chains. This is the first component to be delivered under the upgrade process.
During this phase, the Eth1 chain will works as it is. After the completion of Phase 0, there will be two active Ethereum chains: Eth1 chain (current, PoW main chain) and the Eth2 chain (new Beacon Chain).
· Phase 1 - Shard Chains
The Shard Chains will be implemented in phase 1. Shard Chains will allow parallel transaction throughput due to this feature they are treated as a solution of network scalability. In Phase 1, 64 shard chains will be deployed.
After the completion of Phase 1, the Eth1 and Eth2 chains will operate in parallel.
· Phase 2 – State Execution
Phase 2 will integrate all the design changes implemented in previous phases. The Shard chains concept that will be implemented in phase 1 will work to follow a structured chain state in this phase and the concept of Smart Contracts will be reintroduced here. Each shard will manage a virtual machine based on eWASM.This VM layer will be responsible for the execution of contracts and transactions.
Resources: https://docs.ethhub.io/ethereum-roadmap/ethereum-2.0/eth-2.0-phases/#introduction
submitted by RumaDas to BlockChain_info [link] [comments]

Review and Prospect of Crypto Economy-Development and Evolution of Consensus Mechanism (1)

Review and Prospect of Crypto Economy-Development and Evolution of Consensus Mechanism (1)

https://preview.redd.it/7skleasc80a51.png?width=553&format=png&auto=webp&s=fc18cee10bff7b65d5b02487885d936d23382fc8
Table 1 Classification of consensus system
Source: Yuan Yong, Ni Xiaochun, Zeng Shuai, Wang Feiyue, "Development Status and Prospect of Blockchain Consensus Algorithm"
Figure 4 Evolution of consensus algorithm

Figure 4 Evolution of consensus algorithm
Source: Network data

Foreword
The consensus mechanism is one of the important elements of the blockchain and the core rule of the normal operation of the distributed ledger. It is mainly used to solve the trust problem between people and determine who is responsible for generating new blocks and maintaining the effective unification of the system in the blockchain system. Thus, it has become an everlasting research hot topic in blockchain.
This article starts with the concept and role of the consensus mechanism. First, it enables the reader to have a preliminary understanding of the consensus mechanism as a whole; then starting with the two armies and the Byzantine general problem, the evolution of the consensus mechanism is introduced in the order of the time when the consensus mechanism is proposed; Then, it briefly introduces the current mainstream consensus mechanism from three aspects of concept, working principle and representative project, and compares the advantages and disadvantages of the mainstream consensus mechanism; finally, it gives suggestions on how to choose a consensus mechanism for blockchain projects and pointed out the possibility of the future development of the consensus mechanism.
Contents
First, concept and function of the consensus mechanism
1.1 Concept: The core rules for the normal operation of distributed ledgers
1.2 Role: Solve the trust problem and decide the generation and maintenance of new blocks
1.2.1 Used to solve the trust problem between people
1.2.2 Used to decide who is responsible for generating new blocks and maintaining effective unity in the blockchain system
1.3 Mainstream model of consensus algorithm
Second, the origin of the consensus mechanism
2.1 The two armies and the Byzantine generals
2.1.1 The two armies problem
2.1.2 The Byzantine generals problem
2.2 Development history of consensus mechanism
2.2.1 Classification of consensus mechanism
2.2.2 Development frontier of consensus mechanism
Third, Common Consensus System
Fourth, Selection of consensus mechanism and summary of current situation
4.1 How to choose a consensus mechanism that suits you
4.1.1 Determine whether the final result is important
4.1.2 Determine how fast the application process needs to be
4.1.2 Determining the degree to which the application requires for decentralization
4.1.3 Determine whether the system can be terminated
4.1.4 Select a suitable consensus algorithm after weighing the advantages and disadvantages
4.2 Future development of consensus mechanism
Chapter 1 Concept and Function of Consensus Mechanism
1.1 Concept: The core rules for the normal operation of distributed ledgers
Since most cryptocurrencies use decentralized blockchain design, nodes are scattered and parallel everywhere, so a system must be designed to maintain the order and fairness of the system's operation, unify the version of the blockchain, and reward users maintaining the blockchain and punish malicious harmers. Such a system must rely on some way to prove that who has obtained the packaging rights (or accounting rights) of a blockchain and can obtain the reward for packaging this block; or who intends to harm , and will receive certain penalty. Such system is consensus mechanism.
1.2 Role: Solve the trust problem and decide the generation and maintenance of new blocks
1.2.1 Used to solve the trust problem between people
The reason why the consensus mechanism can be at the core of the blockchain technology is that it has formulated a set of rules from the perspective of cryptographic technologies such as asymmetric encryption and time stamping. All participants must comply with this rules. And theese rules are transparent, and cannot be modified artificially. Therefore, without the endorsement of a third-party authority, it can also mobilize nodes across the network to jointly monitor, record all transactions, and publish them in the form of codes, effectively achieving valuable information transfer, solving or more precisely, greatly improving the trust problem between two unrelated strangers who do not trust each other. After all, trusting the objective technology is less risky than trusting a subjective individual.
1.2.2 Used to decide who is responsible for generating new blocks and maintaining effective unity in the blockchain system
On the other hand, in the blockchain system, due to the high network latency of the peer-to-peer network, the sequence of transactions observed by each node is different. To solve this, the consensus mechanism can be used to reach consensus on transactions order within a short period of time to decide who is responsible for generating new blocks in the blockchain system, and to maintain the effective unity of the blockchain.
1.3 The mainstream model of consensus algorithm
The blockchain system is built on the P2P network, and the set of all nodes can be recorded as PP, generally divided into ordinary nodes that produce data or transactions, and"miner" nodes (denoted as M) responsible for mining operations, like verifying, packaging, and updating the data generated by ordinary nodes or transactions. The functions of the two types of nodes may be overlapped; miner nodes usually participate in the consensus competition process in general, and will select certain representative nodes and replace them to participant in the consensus process and compete for accounting rights in specific algorithms. The collection of these representative nodes is recorded as DD; the accounting nodes selected through the consensus process are recorded as AA. The consensus process is repeated in accordance with the round, and each round of the consensus process generally reselects the accounting node for the round . The core of the consensus process is the "select leader" and "accounting" two parts. In the specific operation process, each round can be divided into four stages: Leader election, Block generation, Data validation and Chain updating namely accounting). As shown in Figure 1, the input of the consensus process is the transaction or data generated and verified by the data node, and the output is the encapsulated data block and updated blockchain. The four stages are executed repeatedly, and each execution round will generate a new block.
Stage 1: Leader election
The election is the core of the consensus process, that is, the process of selecting the accounting node AA from all the miner node sets MM: we can use the formula f(M)→f(M)→AA to represent the election process, where the function ff represents the specific implementation of the consensus algorithm. Generally speaking, |A|=1,|A|=1, that is, the only miner node is finally selected to keep accounts.
Stage 2: Block generation
The accounting node selected in the first stage packages the transactions or data generated by all nodes PP in the current time period into a block according to a specific strategy, and broadcasts the generated new block to all miner nodes MM or their representative nodes DD. These transactions or data are usually sorted according to various factors such as block capacity, transaction fees, transaction waiting time, etc., and then packaged into new blocks in sequence. The block generation strategy is a key factor in the performance of the blockchain system, and it also exposes the strategic behavior of miners such as greedy transactions packaging and selfish mining.
Stage 3: Verification
After receiving the broadcasted new block, the miner node MM or the representative node DD will verify the correctness and rationality of the transactions or data encapsulated in the block. If the new block is approved by most verification/representative nodes, the block will be updated to the blockchain as the next block.
Stage 4: On-Chain
The accounting node adds new blocks to the main chain to form a complete and longer chain from the genesis block to the latest block. If there are multiple fork chains on the main chain, the main chain needs to be based on the consensus algorithm judging criteria to choose one of the appropriate fork chain as the main chain.
Chapter 2 The Origin of Consensus Mechanism
2.1 The two armies problems and the Byzantium generals problem
2.1.1 The two armies


Figure 2 Schematic diagram of the two armed forces
Selected from Yuan Yong, Ni Xiaochun, Zeng Shuai, Wang Feiyue, "Development Status and Prospect of Blockchain Consensus Algorithm", Journal of Automation, 2018, 44(11): 2011-2022
As shown in the figure, the 1st and 2nd units of the Blue Army are stationed on two sides of the slope, and cannot communicate remotely between each other. While the White Army is just stationed in the middle of the two Blue Army units. Suppose that the White Army is stronger than either of the two Blue Army units, but it is not as strong as the two Blue Army units combined. If the two units of the Blue Army want to jointly attack the White Army at the same time, they need to communicate with each other, but the White Army is stationed in the middle of them. It is impossible to confirm whether the messengers of two Blue Army units have sent the attack signal to each other, let alone the tampering of the messages. In this case, due to the inability to fully confirm with each other, ultimately no effective consensus can be reached between the two Blue Army units, rendering the "paradox of the two armies".
2.1.2 The Byzantine generals problem


Figure 3 Diagram of the Byzantine generals' problem
Due to the vast territory of the Byzantine roman empire at that time, in order to better achieve the purpose of defense, troops were scattered around the empire, and each army was far apart, and only messengers could deliver messages. During the war, all generals must reach an agreement, or decide whether to attack the enemy based on the majority principle. However, since it is completely dependent on people, if there is a situation where the general rebels or the messenger delivers the wrong message, how can it ensure that the loyal generals can reach agreement without being influenced by the rebels is a problem which was called the Byzantine problem.
The two armies problems and the Byzantine generals problem are all elaborating the same problem: in the case of unreliable information exchange, it is very difficult to reach consensus and coordinate action. The Byzantine general problem is more like a generalization of the "paradox of the two armies".
From the perspective of the computer network, the two armies problem and the Byzantine problem are common contents of computer network courses: the direct communication between two nodes on the network may fail, so the TCP protocol cannot completely guarantee the consistence between the two terminal networks. However, the consensus mechanism can use economic incentives and other methods to reduce this uncertainty to a level acceptable to most people.
It is precisely because of the two armies problem and the Byzantine problem that the consensus mechanism has begun to show its value.
2.2 Development history of consensus mechanism
2.2.1 Classification of consensus mechanism
Because different types of blockchain projects have different requirements for information recording and block generation, and as the consensus mechanism improves due to the development of blockchain technology, there are currently more than 30 consensus mechanisms. These consensus mechanisms can be divided into two categories according to their Byzantine fault tolerance performance: Byzantine fault tolerance system and non-Byzantine fault tolerance system.

Table 1 Classification of consensus mechanism
Source: Yuan Yong, Ni Xiaochun, Zeng Shuai, Wang Feiyue, "Development Status and Prospect of Blockchain Consensus Algorithm"
2.2.2 Development frontier of consensus mechanism
-Development of consensus algorithm
According to the proposed time of the consensus algorithm, we can see relatively clearly the development of the consensus algorithm.
Source: Network data

Figure 4 Development frontier of consensus algorithm

Figure 5 Historical evolution of blockchain consensus algorithm
Source: Yuan Yong, Ni Xiaochun, Zeng Shuai, Wang Feiyue, "Development Status and Prospect of Blockchain Consensus Algorithm"
The consensus algorithm has laid the foundation for the blockchain consensus mechanism. Initially, the research of consensus algorithms was mainly used by computer scientists and computer professors to improve the spam problem or conduct academic discussions.
For example, in 1993, American computer scientist and Harvard professor Cynthia Dwork first proposed the idea of proof of work in order to solve the spam problem; in 1997, the British cryptographer Adam Back also independently proposed to solve the spam problem by use of the mechanism of proof of work for hashing cash and published officially in 2002; in 1999, Markus Jakobsson officially proposed the concept of "proof of work", which laid the foundation for the subsequent design of Satoshi Nakamoto's Bitcoin consensus mechanism.
Next lecture: Chapter 3 Detailed Explanation of Consensus Mechanism Technology
CelesOS
As the first DPOW financial blockchain operating system, CelesOS adopts consensus mechanism 3.0 to break through the "impossible triangle". It provides both high TPS and decentralization. Committed to creating a financial blockchain operating system that embraces regulation, providing services for financial institutions and the development of applications on the regulation chain, and developing a role and consensus eco-system regulation level agreement for regulation.
The CelesOS team is committed to building a bridge between blockchain and regulatory agencies / finance industry. We believe that only blockchain technology that cooperates with regulators will have a bright future and strive to achieve this goal.
📷Website
https://www.celesos.com/
📷 Telegram
https://t.me/celeschain
📷 Twitter
https://twitter.com/CelesChain
📷 Reddit
https://www.reddit.com/useCelesOS
📷 Medium
https://medium.com/@celesos
📷 Facebook
https://www.facebook.com/CelesOS1
📷 Youtube
https://www.youtube.com/channel/UC1Xsd8wU957D-R8RQVZPfGA
submitted by CelesOS to u/CelesOS [link] [comments]

Dive Into Tendermint Consensus Protocol (I)

Dive Into Tendermint Consensus Protocol (I)
This article is written by the CoinEx Chain lab. CoinEx Chain is the world’s first public chain exclusively designed for DEX, and will also include a Smart Chain supporting smart contracts and a Privacy Chain protecting users’ privacy.
longcpp @ 20200618
This is Part 1 of the serialized articles aimed to explain the Tendermint consensus protocol in detail.
Part 1. Preliminary of the consensus protocol: security model and PBFT protocol
Part 2. Tendermint consensus protocol illustrated: two-phase voting protocol and the locking and unlocking mechanism
Part 3. Weighted round-robin proposer selection algorithm used in Tendermint project
Any consensus agreement that is ultimately reached is the General Agreement, that is, the majority opinion. The consensus protocol on which the blockchain system operates is no exception. As a distributed system, the blockchain system aims to maintain the validity of the system. Intuitively, the validity of the blockchain system has two meanings: firstly, there is no ambiguity, and secondly, it can process requests to update its status. The former corresponds to the safety requirements of distributed systems, while the latter to the requirements of liveness. The validity of distributed systems is mainly maintained by consensus protocols, considering the multiple nodes and network communication involved in such systems may be unstable, which has brought huge challenges to the design of consensus protocols.

The semi-synchronous network model and Byzantine fault tolerance

Researchers of distributed systems characterize these problems that may occur in nodes and network communications using node failure models and network models. The fail-stop failure in node failure models refers to the situation where the node itself stops running due to configuration errors or other reasons, thus unable to go on with the consensus protocol. This type of failure will not cause side effects on other parts of the distributed system except that the node itself stops running. However, for such distributed systems as the public blockchain, when designing a consensus protocol, we still need to consider the evildoing intended by nodes besides their failure. These incidents are all included in the Byzantine Failure model, which covers all unexpected situations that may occur on the node, for example, passive downtime failures and any deviation intended by the nodes from the consensus protocol. For a better explanation, downtime failures refer to nodes’ passive running halt, and the Byzantine failure to any arbitrary deviation of nodes from the consensus protocol.
Compared with the node failure model which can be roughly divided into the passive and active models, the modeling of network communication is more difficult. The network itself suffers problems of instability and communication delay. Moreover, since all network communication is ultimately completed by the node which may have a downtime failure or a Byzantine failure in itself, it is usually difficult to define whether such failure arises from the node or the network itself when a node does not receive another node's network message. Although the network communication may be affected by many factors, the researchers found that the network model can be classified by the communication delay. For example, the node may fail to send data packages due to the fail-stop failure, and as a result, the corresponding communication delay is unknown and can be any value. According to the concept of communication delay, the network communication model can be divided into the following three categories:
  • The synchronous network model: There is a fixed, known upper bound of delay $\Delta$ in network communication. Under this model, the maximum delay of network communication between two nodes in the network is $\Delta$. Even if there is a malicious node, the communication delay arising therefrom does not exceed $\Delta$.
  • The asynchronous network model: There is an unknown delay in network communication, with the upper bound of the delay known, but the message can still be successfully delivered in the end. Under this model, the network communication delay between two nodes in the network can be any possible value, that is, a malicious node, if any, can arbitrarily extend the communication delay.
  • The semi-synchronous network model: Assume that there is a Global Stabilization Time (GST), before which it is an asynchronous network model and after which, a synchronous network model. In other words, there is a fixed, known upper bound of delay in network communication $\Delta$. A malicious node can delay the GST arbitrarily, and there will be no notification when no GST occurs. Under this model, the delay in the delivery of the message at the time $T$ is $\Delta + max(T, GST)$.
The synchronous network model is the most ideal network environment. Every message sent through the network can be received within a predictable time, but this model cannot reflect the real network communication situation. As in a real network, network failures are inevitable from time to time, causing the failure in the assumption of the synchronous network model. Yet the asynchronous network model goes to the other extreme and cannot reflect the real network situation either. Moreover, according to the FLP (Fischer-Lynch-Paterson) theorem, under this model if there is one node fails, no consensus protocol will reach consensus in a limited time. In contrast, the semi-synchronous network model can better describe the real-world network communication situation: network communication is usually synchronous or may return to normal after a short time. Such an experience must be no stranger to everyone: the web page, which usually gets loaded quite fast, opens slowly every now and then, and you need to try before you know the network is back to normal since there is usually no notification. The peer-to-peer (P2P) network communication, which is widely used in blockchain projects, also makes it possible for a node to send and receive information from multiple network channels. It is unrealistic to keep blocking the network information transmission of a node for a long time. Therefore, all the discussion below is under the semi-synchronous network model.
The design and selection of consensus protocols for public chain networks that allow nodes to dynamically join and leave need to consider possible Byzantine failures. Therefore, the consensus protocol of a public chain network is designed to guarantee the security and liveness of the network under the semi-synchronous network model on the premise of possible Byzantine failure. Researchers of distributed systems point out that to ensure the security and liveness of the system, the consensus protocol itself needs to meet three requirements:
  • Validity: The value reached by honest nodes must be the value proposed by one of them
  • Agreement: All honest nodes must reach consensus on the same value
  • Termination: The honest nodes must eventually reach consensus on a certain value
Validity and agreement can guarantee the security of the distributed system, that is, the honest nodes will never reach a consensus on a random value, and once the consensus is reached, all honest nodes agree on this value. Termination guarantees the liveness of distributed systems. A distributed system unable to reach consensus is useless.

The CAP theorem and Byzantine Generals Problem

In a semi-synchronous network, is it possible to design a Byzantine fault-tolerant consensus protocol that satisfies validity, agreement, and termination? How many Byzantine nodes can a system tolerance? The CAP theorem and Byzantine Generals Problem provide an answer for these two questions and have thus become the basic guidelines for the design of Byzantine fault-tolerant consensus protocols.
Lamport, Shostak, and Pease abstracted the design of the consensus mechanism in the distributed system in 1982 as the Byzantine Generals Problem, which refers to such a situation as described below: several generals each lead the army to fight in the war, and their troops are stationed in different places. The generals must formulate a unified action plan for the victory. However, since the camps are far away from each other, they can only communicate with each other through the communication soldiers, or, in other words, they cannot appear on the same occasion at the same time to reach a consensus. Unfortunately, among the generals, there is a traitor or two who intend to undermine the unified actions of the loyal generals by sending the wrong information, and the communication soldiers cannot send the message to the destination by themselves. It is assumed that each communication soldier can prove the information he has brought comes from a certain general, just as in the case of a real BFT consensus protocol, each node has its public and private keys to establish an encrypted communication channel for each other to ensure that its messages will not be tampered with in the network communication, and the message receiver can also verify the sender of the message based thereon. As already mentioned, any consensus agreement ultimately reached represents the consensus of the majority. In the process of generals communicating with each other for an offensive or retreat, a general also makes decisions based on the majority opinion from the information collected by himself.
According to the research of Lamport et al, if there are 1/3 or more traitors in the node, the generals cannot reach a unified decision. For example, in the following figure, assume there are 3 generals and only 1 traitor. In the figure on the left, suppose that General C is the traitor, and A and B are loyal. If A wants to launch an attack and informs B and C of such intention, yet the traitor C sends a message to B, suggesting what he has received from A is a retreat. In this case, B can't decide as he doesn't know who the traitor is, and the information received is insufficient for him to decide. If A is a traitor, he can send different messages to B and C. Then C faithfully reports to B the information he received. At this moment as B receives conflicting information, he cannot make any decisions. In both cases, even if B had received consistent information, it would be impossible for him to spot the traitor between A and C. Therefore, it is obvious that in both situations shown in the figure below, the honest General B cannot make a choice.
According to this conclusion, when there are $n$ generals with at most $f$ traitors (n≤3f), the generals cannot reach a consensus if $n \leq 3f$; and with $n > 3f$, a consensus can be reached. This conclusion also suggests that when the number of Byzantine failures $f$ exceeds 1/3 of the total number of nodes $n$ in the system $f \ge n/3$ , no consensus will be reached on any consensus protocol among all honest nodes. Only when $f < n/3$, such condition is likely to happen, without loss of generality, and for the subsequent discussion on the consensus protocol, $ n \ge 3f + 1$ by default.
The conclusion reached by Lamport et al. on the Byzantine Generals Problem draws a line between the possible and the impossible in the design of the Byzantine fault tolerance consensus protocol. Within the possible range, how will the consensus protocol be designed? Can both the security and liveness of distributed systems be fully guaranteed? Brewer provided the answer in his CAP theorem in 2000. It indicated that a distributed system requires the following three basic attributes, but any distributed system can only meet two of the three at the same time.
  1. Consistency: When any node responds to the request, it must either provide the latest status information or provide no status information
  2. Availability: Any node in the system must be able to continue reading and writing
  3. Partition Tolerance: The system can tolerate the loss of any number of messages between two nodes and still function normally

https://preview.redd.it/1ozfwk7u7m851.png?width=1400&format=png&auto=webp&s=fdee6318de2cf1c021e636654766a7a0fe7b38b4
A distributed system aims to provide consistent services. Therefore, the consistency attribute requires that the two nodes in the system cannot provide conflicting status information or expired information, which can ensure the security of the distributed system. The availability attribute is to ensure that the system can continuously update its status and guarantee the availability of distributed systems. The partition tolerance attribute is related to the network communication delay, and, under the semi-synchronous network model, it can be the status before GST when the network is in an asynchronous status with an unknown delay in the network communication. In this condition, communicating nodes may not receive information from each other, and the network is thus considered to be in a partitioned status. Partition tolerance requires the distributed system to function normally even in network partitions.
The proof of the CAP theorem can be demonstrated with the following diagram. The curve represents the network partition, and each network has four nodes, distinguished by the numbers 1, 2, 3, and 4. The distributed system stores color information, and all the status information stored by all nodes is blue at first.
  1. Partition tolerance and availability mean the loss of consistency: When node 1 receives a new request in the leftmost image, the status changes to red, the status transition information of node 1 is passed to node 3, and node 3 also updates the status information to red. However, since node 3 and node 4 did not receive the corresponding information due to the network partition, the status information is still blue. At this moment, if the status information is queried through node 2, the blue returned by node 2 is not the latest status of the system, thus losing consistency.
  2. Partition tolerance and consistency mean the loss of availability: In the middle figure, the initial status information of all nodes is blue. When node 1 and node 3 update the status information to red, node 2 and node 4 maintain the outdated information as blue due to network partition. Also when querying status information through node 2, you need to first ask other nodes to make sure you’re in the latest status before returning status information as node 2 needs to follow consistency, but because of the network partition, node 2 cannot receive any information from node 1 or node 3. Then node 2 cannot determine whether it is in the latest status, so it chooses not to return any information, thus depriving the system of availability.
  3. Consistency and availability mean the loss of the partition tolerance: In the right-most figure, the system does not have a network partition at first, and both status updates and queries can go smoothly. However, once a network partition occurs, it degenerates into one of the previous two conditions. It is thus proved that any distributed system cannot have consistency, availability, and partition tolerance all at the same time.

https://preview.redd.it/456x2blv7m851.png?width=1400&format=png&auto=webp&s=550797373145b8fc1471bdde68ed5f8d45adb52b
The discovery of the CAP theorem seems to declare that the aforementioned goals of the consensus protocol is impossible. However, if you’re careful enough, you may find from the above that those are all extreme cases, such as network partitions that cause the failure of information transmission, which could be rare, especially in P2P network. In the second case, the system rarely returns the same information with node 2, and the general practice is to query other nodes and return the latest status as believed after a while, regardless of whether it has received the request information of other nodes. Therefore, although the CAP theorem points out that any distributed system cannot satisfy the three attributes at the same time, it is not a binary choice, as the designer of the consensus protocol can weigh up all the three attributes according to the needs of the distributed system. However, as the communication delay is always involved in the distributed system, one always needs to choose between availability and consistency while ensuring a certain degree of partition tolerance. Specifically, in the second case, it is about the value that node 2 returns: a probably outdated value or no value. Returning the possibly outdated value may violate consistency but guarantees availability; yet returning no value deprives the system of availability but guarantees its consistency. Tendermint consensus protocol to be introduced is consistent in this trade-off. In other words, it will lose availability in some cases.
The genius of Satoshi Nakamoto is that with constraints of the CAP theorem, he managed to reach a reliable Byzantine consensus in a distributed network by combining PoW mechanism, Satoshi Nakamoto consensus, and economic incentives with appropriate parameter configuration. Whether Bitcoin's mechanism design solves the Byzantine Generals Problem has remained a dispute among academicians. Garay, Kiayias, and Leonardos analyzed the link between Bitcoin mechanism design and the Byzantine consensus in detail in their paper The Bitcoin Backbone Protocol: Analysis and Applications. In simple terms, the Satoshi Consensus is a probabilistic Byzantine fault-tolerant consensus protocol that depends on such conditions as the network communication environment and the proportion of malicious nodes' hashrate. When the proportion of malicious nodes’ hashrate does not exceed 1/2 in a good network communication environment, the Satoshi Consensus can reliably solve the Byzantine consensus problem in a distributed environment. However, when the environment turns bad, even with the proportion within 1/2, the Satoshi Consensus may still fail to reach a reliable conclusion on the Byzantine consensus problem. It is worth noting that the quality of the network environment is relative to Bitcoin's block interval. The 10-minute block generation interval of the Bitcoin can ensure that the system is in a good network communication environment in most cases, given the fact that the broadcast time of a block in the distributed network is usually just several seconds. In addition, economic incentives can motivate most nodes to actively comply with the agreement. It is thus considered that with the current Bitcoin network parameter configuration and mechanism design, the Bitcoin mechanism design has reliably solved the Byzantine Consensus problem in the current network environment.

Practical Byzantine Fault Tolerance, PBFT

It is not an easy task to design the Byzantine fault-tolerant consensus protocol in a semi-synchronous network. The first practically usable Byzantine fault-tolerant consensus protocol is the Practical Byzantine Fault Tolerance (PBFT) designed by Castro and Liskov in 1999, the first of its kind with polynomial complexity. For a distributed system with $n$ nodes, the communication complexity is $O(n2$.) Castro and Liskov showed in the paper that by transforming centralized file system into a distributed one using the PBFT protocol, the overwall performance was only slowed down by 3%. In this section we will briefly introduce the PBFT protocol, paving the way for further detailed explanations of the Tendermint protocol and the improvements of the Tendermint protocol.
The PBFT protocol that includes $n=3f+1$ nodes can tolerate up to $f$ Byzantine nodes. In the original paper of PBFT, full connection is required among all the $n$ nodes, that is, any two of the n nodes must be connected. All the nodes of the network jointly maintain the system status through network communication. In the Bitcoin network, a node can participate in or exit the consensus process through hashrate mining at any time, which is managed by the administrator, and the PFBT protocol needs to determine all the participating nodes before the protocol starts. All nodes in the PBFT protocol are divided into two categories, master nodes, and slave nodes. There is only one master node at any time, and all nodes take turns to be the master node. All nodes run in a rotation process called View, in each of which the master node will be reelected. The master node selection algorithm in PBFT is very simple: all nodes become the master node in turn by the index number. In each view, all nodes try to reach a consensus on the system status. It is worth mentioning that in the PBFT protocol, each node has its own digital signature key pair. All sent messages (including request messages from the client) need to be signed to ensure the integrity of the message in the network and the traceability of the message itself. (You can determine who sent a message based on the digital signature).
The following figure shows the basic flow of the PBFT consensus protocol. Assume that the current view’s master node is node 0. Client C initiates a request to the master node 0. After the master node receives the request, it broadcasts the request to all slave nodes that process the request of client C and return the result to the client. After the client receives f+1 identical results from different nodes (based on the signature value), the result can be taken as the final result of the entire operation. Since the system can have at most f Byzantine nodes, at least one of the f+1 results received by the client comes from an honest node, and the security of the consensus protocol guarantees that all honest nodes will reach consensus on the same status. So, the feedback from 1 honest node is enough to confirm that the corresponding request has been processed by the system.

https://preview.redd.it/sz8so5ly7m851.png?width=1400&format=png&auto=webp&s=d472810e76bbc202e91a25ef29a51e109a576554
For the status synchronization of all honest nodes, the PBFT protocol has two constraints on each node: on one hand, all nodes must start from the same status, and on the other, the status transition of all nodes must be definite, that is, given the same status and request, the results after the operation must be the same. Under these two constraints, as long as the entire system agrees on the processing order of all transactions, the status of all honest nodes will be consistent. This is also the main purpose of the PBFT protocol: to reach a consensus on the order of transactions between all nodes, thereby ensuring the security of the entire distributed system. In terms of availability, the PBFT consensus protocol relies on a timeout mechanism to find anomalies in the consensus process and start the View Change protocol in time to try to reach a consensus again.
The figure above shows a simplified workflow of the PBFT protocol. Where C is the client, 0, 1, 2, and 3 represent 4 nodes respectively. Specifically, 0 is the master node of the current view, 1, 2, 3 are slave nodes, and node 3 is faulty. Under normal circumstances, the PBFT consensus protocol reaches consensus on the order of transactions between nodes through a three-phase protocol. These three phases are respectively: Pre-Prepare, Prepare, and Commit:
  • The master node of the pre-preparation node is responsible for assigning the sequence number to the received client request, and broadcasting the message to the slave node. The message contains the hash value of the client request d, the sequence number of the current viewv, the sequence number n assigned by the master node to the request, and the signature information of the master nodesig. The scheme design of the PBFT protocol separates the request transmission from the request sequencing process, and the request transmission is not to be discussed here. The slave node that receives the message accepts the message after confirming the message is legitimate and enter preparation phase. The message in this step checks the basic signature, hash value, current view, and, most importantly, whether the master node has given the same sequence number to other request from the client in the current view.
  • In preparation, the slave node broadcasts the message to all nodes (including itself), indicating that it assigns the sequence number n to the client request with the hash value d under the current view v, with its signaturesig as proof. The node receiving the message will check the correctness of the signature, the matching of the view sequence number, etc., and accept the legitimate message. When the PRE-PREPARE message about a client request (from the main node) received by a node matches with the PREPARE from 2f slave nodes, the system has agreed on the sequence number requested by the client in the current view. This means that 2f+1 nodes in the current view agree with the request sequence number. Since it contains information from at most fmalicious nodes, there are a total of f+1 honest nodes that have agreed with the allocation of the request sequence number. With f malicious nodes, there are a total of 2f+1 honest nodes, so f+1represents the majority of the honest nodes, which is the consensus of the majority mentioned before.
  • After the node (including the master node and the slave node) receives a PRE-PREPARE message requested by the client and 2f PREPARE messages, the message is broadcast across the network and enters the submission phase. This message is used to indicate that the node has observed that the whole network has reached a consensus on the sequence number allocation of the request message from the client. When the node receives 2f+1 COMMIT messages, there are at least f+1 honest nodes, that is, most of the honest nodes have observed that the entire network has reached consensus on the arrangement of sequence numbers of the request message from the client. The node can process the client request and return the execution result to the client at this moment.
Roughly speaking, in the pre-preparation phase, the master node assigns a sequence number to all new client requests. During preparation, all nodes reach consensus on the client request sequence number in this view, while in submission the consistency of the request sequence number of the client in different views is to be guaranteed. In addition, the design of the PBFT protocol itself does not require the request message to be submitted by the assigned sequence number, but out of order. That can improve the efficiency of the implementation of the consensus protocol. Yet, the messages are still processed by the sequence number assigned by the consensus protocol for the consistency of the distributed system.
In the three-phase protocol execution of the PBFT protocol, in addition to maintaining the status information of the distributed system, the node itself also needs to log all kinds of consensus information it receives. The gradual accumulation of logs will consume considerable system resources. Therefore, the PBFT protocol additionally defines checkpoints to help the node deal with garbage collection. You can set a checkpoint every 100 or 1000 sequence numbers according to the request sequence number. After the client request at the checkpoint is executed, the node broadcasts messages throughout the network, indicating that after the node executes the client request with sequence number n, the hash value of the system status is d, and it is vouched by its own signature sig. After 2f+1 matching CHECKPOINT messages (one of which can come from the node itself) are received, most of the honest nodes in the entire network have reached a consensus on the system status after the execution of the client request with the sequence numbern, and then you can clear all relevant log records of client requests with the sequence number less than n. The node needs to save these2f+1 CHECKPOINTmessages as proof of the legitimate status at this moment, and the corresponding checkpoint is called a stable checkpoint.
The three-phase protocol of the PBFT protocol can ensure the consistency of the processing order of the client request, and the checkpoint mechanism is set to help nodes perform garbage collection and further ensures the status consistency of the distributed system, both of which can guarantee the security of the distributed system aforementioned. How is the availability of the distributed system guaranteed? In the semi-synchronous network model, a timeout mechanism is usually introduced, which is related to delays in the network environment. It is assumed that the network delay has a known upper bound after GST. In such condition, an initial value is usually set according to the network condition of the system deployed. In case of a timeout event, besides the corresponding processing flow triggered, additional mechanisms will be activated to readjust the waiting time. For example, an algorithm like TCP's exponential back off can be adopted to adjust the waiting time after a timeout event.
To ensure the availability of the system in the PBFT protocol, a timeout mechanism is also introduced. In addition, due to the potential the Byzantine failure in the master node itself, the PBFT protocol also needs to ensure the security and availability of the system in this case. When the Byzantine failure occurs in the master node, for example, when the slave node does not receive the PRE-PREPARE message or the PRE-PREPARE message sent by the master node from the master node within the time window and is thus determined to be illegitimate, the slave node can broadcast to the entire network, indicating that the node requests to switch to the new view with sequence number v+1. n indicates the request sequence number corresponding to the latest stable checkpoint local to the node, and C is to prove the stable checkpoint 2f+1 legitimate CHECKPOINT messages as aforementioned. After the latest stable checkpoint and before initiating the VIEWCHANGE message, the system may have reached a consensus on the sequence numbers of some request messages in the previous view. To ensure the consistency of these request sequence numbers to be switched in the view, the VIEWCHANGE message needs to carry this kind of the information to the new view, which is also the meaning of the P field in the message. P contains all the client request messages collected at the node with a request sequence number greater than n and the proof that a consensus has been reached on the sequence number in the node: the legitimate PRE-PREPARE message of the request and 2f matching PREPARE messages. When the master node in view v+1 collects 2f+1 VIEWCHANGE messages, it can broadcast the NEW-VIEW message and take the entire system into a new view. For the security of the system in combination with the three-phase protocol of the PBFT protocol, the construction rules of the NEW-VIEW information are designed in a quite complicated way. You can refer to the original paper of PBFT for more details.

https://preview.redd.it/x5efdc908m851.png?width=1400&format=png&auto=webp&s=97b4fd879d0ec668ee0990ea4cadf476167a2948
VIEWCHANGE contains a lot of information. For example, C contains 2f+1 signature information, P contains several signature sets, and each set has 2f+1 signature. At least 2f+1 nodes need to send a VIEWCHANGE message before prompting the system to enter the next new view, and that means, in addition to the complex logic of constructing the information of VIEWCHANGE and NEW-VIEW, the communication complexity of the view conversion protocol is $O(n2$.) Such complexity also limits the PBFT protocol to support only a few nodes, and when there are 100 nodes, it is usually too complex to practically deploy PBFT. It is worth noting that in some materials the communication complexity of the PBFT protocol is inappropriately attributed to the full connection between n nodes. By changing the fully connected network topology to the P2P network topology based on distributed hash tables commonly used in blockchain projects, high communication complexity caused by full connection can be conveniently solved, yet still, it is difficult to improve the communication complexity during the view conversion process. In recent years, researchers have proposed to reduce the amount of communication in this step by adopting aggregate signature scheme. With this technology, 2f+1 signature information can be compressed into one, thereby reducing the communication volume during view change.
submitted by coinexchain to u/coinexchain [link] [comments]

How Heterogeneous Sharding Empowers Enterprise

How Heterogeneous Sharding Empowers Enterprise
Despite starting out in the financial industry, we believe that blockchain technology can be applicable and useful to almost any field. QuarkChain is working on developing the most effective and useful enterprise blockchain solution. We did lots of research to understand what kind of blockchain solutions are really needed by enterprises. The first thing I believe is flexibility. In fact, it is a relatively missing feature in most existing projects.

https://preview.redd.it/hym7kpkq5d051.png?width=1350&format=png&auto=webp&s=196fee0da4a6197278d4d800d3e89841db6f5c8f
What does flexibility refer to? With many enterprise business scenarios and geographical differences, can we address all the scenarios with just one public chain? In my opinion, this solution is not viable. The ideal solution should be scenario-based: based on the specifications of the scenario, customize a public chain as a solution. In other words, the solution that addresses all scenarios should be multiple blockchains.
Another question arises: if each business scenario requires its own blockchain to be relatively independent, then how can we make the interactions between these blockchains seamless? How can we ensure a high level of security while crossing chains?
Thirdly, if the business needs to expand, how can we maintain a high level of scalability with few major improvements? As we all know, the biggest problem the existing blockchain solution faces is that, once it is written, it is extremely cumbersome to upgrade. For example, when Ethereum is upgraded from 1.0 to 2.0, it is not something we understand in the traditional sense that the project is modifying the infrastructure from version 1.0 to 2.0. ETH 1.0 and 2.0 are two separate projects which show the whole blockchain ecosystem indeed lacks scalability.
Now we have another question, what kind of roles do public chains and alliance chains play in the ecosystem? We know that alliance chains offer more friendly monitoring capabilities and are easier to satisfy business demands. Public chains are more open and are better for cross-border or some international business scenarios. Based on our understanding and observations of clients, we see that we are trending towards a comprehensive solution that provides both public chains and alliance chains when needed. To be able to satisfy any demands at any time is something that enterprises are looking for. How can one satisfy the varying types of demands? The simple answer is heterogenous sharding.
Let me introduce more about the heterogeneous sharding, the cutting edge technology of QuarkChain. There are three key concepts related to heterogeneous sharding namely single chain, shards, and heterogenous sharding. What is a single chain? It is analogous to a single-lane highway. ETH 1.0, EOS, NEO, hyperledger, public chains, alliance chains, and so on are all single chains. As for sharding, it is like a multi-lane highway. The advantage of a multi-lane highway is that the time needed for a huge amount of traffic to pass through is lesser than that of passing through a single-lane highway.

https://preview.redd.it/7w4fcs7s5d051.png?width=1400&format=png&auto=webp&s=d1c55ee8637ade010180fa96dd25a1d3ec8c649a
At the same time, sharding can be based on the current traffic to dynamically adjust the number of lanes. If one has three lanes for now, when traffic increases, one can add one, or two, or three more lanes to expand the capacity to allow more traffic to pass through. One thing to note is that, for each lane, one needs to have identical lanes with identical specifications. Such constraint requires us to consider in the first place how wide the lane should be. What kind of materials should be used? Sandstone or granite? Should we plant any greens on both sides? All these specifications are needed during the design phase. After the design, every time when we add lanes, we follow this blueprint to add identical lanes.
In the area of sharding, ETH 2.0, Zilliqa, Harmony, Near are all good examples. If so, then what is heterogenous sharding? Heterogenous sharding, like sharding, has a multi-lane highway but each lane can be designed differently. As the highway in the previous examples requires the same width and the same materials and such, the heterogenous sharding highway allows each lane to be designed differently. In the area of heterogeneous sharding, QuarkChain and Polkadot are the leading examples.
We mentioned earlier that heterogenous sharding allows customized configuration but in terms of what areas? Before addressing this question, let us first establish a few baseline understandings of blockchain. Currently, all the structure of blockchain infrastructure includes all the tokens and public chains we heard of, such as Bitcoin, and Ethereum, anonymous tokens, ZCash, Grin, EOS, and all public chains consist of four important components.
The first component is transaction mode, which also can be referred to as a virtual machine (VM). The second component is called the consensus mechanism. The third component is the ledger model and the fourth component is token economics, which is more related to public chains. Do not be intimidated if you do not understand these four terms. As long as you understand that any blockchain platform must include these four components, then we can proceed to the main discussion.
For example, for ETH1.0, it uses EVM as virtual machine, POW as consensus mechanism, account base as ledger, and inflationary expansion as token economic. ETH is also used for paying transaction fees. For Bitcoin, its token economics is a fixed 21-million token supply of which it just halved its production rate a few days ago. Its ledger model is UXTO and consensus mechanism is POW with its own unique transaction mode called bitcoin type transaction mode. So as you can imagine any blockchain platform must contain these four elements.
However, for each platform, it has a fixed combination of ABCD. Once defined, users cannot modify or customize based on their needs. If the platform defines A as the consensus mechanism, then all users need to follow suit and adopt A as the consensus mechanism. It is similar to our analogy where once the width of the highway lane is defined then everyone has to abide by the specification.

https://preview.redd.it/m4fm65tt5d051.png?width=816&format=png&auto=webp&s=e8319f0d82a1d4ec258f5c949cf7a625cd0ab56e
In contrast, heterogenous sharding allows each new blockchain to be configured completely anew. For each shard on QuarkChain, one can add a new VM. For example, one shard can use EVM while the other one uses Wasm. One shard can use POW as a consensus mechanism while the other uses POS. The same logic can be applied to the ledger model and token economics. With that logic in mind, each lane can look completely different based on the needs of each lane.
Each shard chain in the blockchain can be added based on demand. The maximum number of shards can be added is about 20000. There are four shards in this diagram. Shard 1 uses EVM as a virtual machine, POW as consensus. This shard in fact is similar to ETH and in fact, has incorporated all the ETH functionalities. The second shard is similar to the first shard except that it uses DPos instead of POW as a consensus mechanism, which is used by EOS and Tron.
The third shard uses XVM as a virtual machine, which is a new type of virtual machine. If one day, I would like to have a chain using the latest VM technology, I can implement it quickly on a shard instead of hard forking the existing project. This example demonstrates that out of all the possible VMs or consensus mechanisms, one can choose what it prefers to configure a shard based on business requirements or domains.

https://preview.redd.it/gwg34w5v5d051.png?width=1400&format=png&auto=webp&s=3a1147d2c7ce69443e6378dbde64308b739bce59
In fact, heterogeneous sharding shares many similarities with cross-chains. What I meant by cross-chain is not interactions between ETH and EOS or between EOS to Tron, but interactions based on the same infrastructure. For example, Cosmos has a strategy: users can leverage its HUB API to launch a new chain easily but one would need to take its own risk in protecting the chain from attacks. Users are welcome to customize the configuration of each of the four components.
For Polkadot, it has a relay chain, which is the main chain that allows users to release a new chain easily. Among the released chains, one can cross the chains for communications. However, a new chain does not enjoy complete freedom in picking the four components: at this stage, each chain can pick its consensus mechanism out of the three limited grandpa options that Polkadot provides. In the future, it will add more options for consensus mechanisms. For protection, Polkadot’s hub will provide hashing power from its relay chain to protect the chains launched under the hub.

https://preview.redd.it/wp8ff6kw5d051.png?width=816&format=png&auto=webp&s=6b86c4e4a669ab54215aa2dc7d55c2b602cb58aa
ETH2.0 shares many resemblances with Polkadot and Cosmos as well. It has one root chain and many shards. However, its shards have to be identical, lacking diversification. Lastly, for QuarkChain, it can launch shard chains with one click like that of Cosmos. What is even better is that each shard supports many types of consensus and allows cross-chains.
To summarize all the questions above, a single chain only allows the building of dApp with no customization. All the four components cannot be modified once the chain is launched. Polkadot and Cosmo support launching a chain with one click and can build a public chain and parallel chain and allow cross-chains. As for QuarkChain, we also support launching one chain with one click. Our solution can customize for public chains as well as alliance chains and allows cross-chains. It can provide a comprehensive solution for public chains and alliance chains, which is something that will satisfy the future demand in enterprises.
I am going to share two actual business cases now. One case is a solution we customized for a major multi-industry business client. This client covers various industries and currently based on three different areas, it has built three different independent single-chain public blockchains, one on hyperledger, one on alliance chain, and one on ETH. The problem they are facing is that for future businesses, if it would like to allow those resources to be moved onto blockchains in the future, how should we design to allow scalability? If it would like to exchange data between different industries, how would it be carried out? Since the different businesses all belong to the same company, it would make sense to share the data across verticals. However, to cross chains between hyperledger, alliance chain, and ETH with three different infrastructure layers are indeed challenging at this moment.
In the future, should we launch the 4th, 5th, 6th chains and so on and enable cross-chains among them? Or is it better to create a new chain that integrates all businesses? Both solutions are not optimal in my opinion. In the end, our solution was using QuarkChain’s infrastructure layer that implements heterogeneous sharding. The root chain acts as the executive level of the parent company that possesses the right to all business data and guarantee security. For each shard chain, the company can customize it based on business needs.
In terms of customization, the four components that make up blockchains can be tuned to fit what the client is looking for. One certain combination can be identical to hyperledger, the other can be the same as alliance chain, and the other for ETH. So one can pick a combination it prefers and add to the root chain. Since different shards are built on the same infrastructure layer, the solution allows cross-chain interactions. In the future, if the client would like to move some businesses onto the chain, it can add shards onto the chain. Such a solution allows scalability and avoids creating a public chain anew.
The second case is for a client who is a large-scale business. The client is looking to build a blockchain-based platform for resource management. Currently, it would like to start small with some test points. Next step, it plans to expand the testing area to more cities and more types of resources. So at the beginning stage, the client wants to start with a few areas and a single type of resource and later on integrate more resources and more cities. The traditional solution would be to create one chain for the particular resource and connect the related areas altogether. In the next stage, when the client decides to expand to more businesses, then it can launch a new blockchain that adds more users and more types of resources, which is like changing from project version 1.0 to project version 2.0.

https://preview.redd.it/a3ghe26y5d051.png?width=1400&format=png&auto=webp&s=073199e7576b2176116d7201d7181f2dd708fd44
Our QuarkChain solution provides a well-planned solution that uses heterogeneous sharding to avoid the need to relaunch a new chain for each expansion. It can have multiple layers and add shards on each layer. To go into more details, for instance the first layer is the state or equal scale executive level, which is the root chain that controls all the access rights for all data; the second layer is the lower administrative level like the city-level executives, which can use different resources that they have to customize different shards and allow cross-chains among shards. The first layer has a higher level of access rights compared to that of the second layer. In the future, if the project spans across more resources and even rolls up to the national level, we can add a third or even fourth layer whereby each layer enjoys different administrative rights and controls appropriately.
As a leading blockchain technology company, QuarkChain is exploring to use heterogeneous sharding technology to achieve the most innovative ways enterprises are incorporating blockchain to revolutionize their industry. In 2020, QuarkChain plans to expand the enterprise solution into the smart city and large-scale resource management system, bringing high storage capacity, high processing efficiency, safe and reliable enterprise blockchain solutions.
Website
https://www.quarkchain.io
Telegram
https://t.me/quarkchainio
Twitter
https://twitter.com/Quark_Chain
Medium
https://medium.com/quarkchain-official
Reddit
https://www.reddit.com/quarkchainio/
Facebook
https://www.facebook.com/quarkchainofficial/
Discord
https://discord.me/quarkchain
submitted by QuarkChain to quarkchainio [link] [comments]

An interesting fact about big players. How they play? Courtesy- nick

An interesting fact about big players. How they play? Courtesy- nick submitted by Shubha_m to Bitcoin [link] [comments]

FlowCards: A Declarative Framework for Development of Ergo dApps

FlowCards: A Declarative Framework for Development of Ergo dApps
Introduction
ErgoScript is the smart contract language used by the Ergo blockchain. While it has concise syntax adopted from Scala/Kotlin, it still may seem confusing at first because conceptually ErgoScript is quite different compared to conventional languages which we all know and love. This is because Ergo is a UTXO based blockchain, whereas smart contracts are traditionally associated with account based systems like Ethereum. However, Ergo's transaction model has many advantages over the account based model and with the right approach it can even be significantly easier to develop Ergo contracts than to write and debug Solidity code.
Below we will cover the key aspects of the Ergo contract model which makes it different:
Paradigm
The account model of Ethereum is imperative. This means that the typical task of sending coins from Alice to Bob requires changing the balances in storage as a series of operations. Ergo's UTXO based programming model on the other hand is declarative. ErgoScript contracts specify conditions for a transaction to be accepted by the blockchain (not changes to be made in the storage state as result of the contract execution).
Scalability
In the account model of Ethereum both storage changes and validity checks are performed on-chain during code execution. In contrast, Ergo transactions are created off-chain and only validation checks are performed on-chain thus reducing the amount of operations performed by every node on the network. In addition, due to immutability of the transaction graph, various optimization strategies are possible to improve throughput of transactions per second in the network. Light verifying nodes are also possible thus further facilitating scalability and accessibility of the network.
Shared state
The account-based model is reliant on shared mutable state which is known to lead to complex semantics (and subtle million dollar bugs) in the context of concurrent/ distributed computation. Ergo's model is based on an immutable graph of transactions. This approach, inherited from Bitcoin, plays well with the concurrent and distributed nature of blockchains and facilitates light trustless clients.
Expressive Power
Ethereum advocated execution of a turing-complete language on the blockchain. It theoretically promised unlimited potential, however in practice severe limitations came to light from excessive blockchain bloat, subtle multi-million dollar bugs, gas costs which limit contract complexity, and other such problems. Ergo on the flip side extends UTXO to enable turing-completeness while limiting the complexity of the ErgoScript language itself. The same expressive power is achieved in a different and more semantically sound way.
With the all of the above points, it should be clear that there are a lot of benefits to the model Ergo is using. In the rest of this article I will introduce you to the concept of FlowCards - a dApp developer component which allows for designing complex Ergo contracts in a declarative and visual way.

From Imperative to Declarative

In the imperative programming model of Ethereum a transaction is a sequence of operations executed by the Ethereum VM. The following Solidity function implements a transfer of tokens from sender to receiver . The transaction starts when sender calls this function on an instance of a contract and ends when the function returns.
// Sends an amount of existing coins from any caller to an address function send(address receiver, uint amount) public { require(amount <= balances[msg.sender], "Insufficient balance."); balances[msg.sender] -= amount; balances[receiver] += amount; emit Sent(msg.sender, receiver, amount); } 
The function first checks the pre-conditions, then updates the storage (i.e. balances) and finally publishes the post-condition as the Sent event. The gas which is consumed by the transaction is sent to the miner as a reward for executing this transaction.
Unlike Ethereum, a transaction in Ergo is a data structure holding a list of input coins which it spends and a list of output coins which it creates preserving the total balances of ERGs and tokens (in which Ergo is similar to Bitcoin).
Turning back to the example above, since Ergo natively supports tokens, therefore for this specific example of sending tokens we don't need to write any code in ErgoScript. Instead we need to create the ‘send’ transaction shown in the following figure, which describes the same token transfer but declaratively.
https://preview.redd.it/sxs3kesvrsv41.png?width=1348&format=png&auto=webp&s=582382bc26912ff79114d831d937d94b6988e69f
The picture visually describes the following steps, which the network user needs to perform:
  1. Select unspent sender's boxes, containing in total tB >= amount of tokens and B >= txFee + minErg ERGs.
  2. Create an output target box which is protected by the receiver public key with minErg ERGs and amount of T tokens.
  3. Create one fee output protected by the minerFee contract with txFee ERGs.
  4. Create one change output protected by the sender public key, containing B - minErg - txFee ERGs and tB - amount of T tokens.
  5. Create a new transaction, sign it using the sender's secret key and send to the Ergo network.
What is important to understand here is that all of these steps are preformed off-chain (for example using Appkit Transaction API) by the user's application. Ergo network nodes don't need to repeat this transaction creation process, they only need to validate the already formed transaction. ErgoScript contracts are stored in the inputs of the transaction and check spending conditions. The node executes the contracts on-chain when the transaction is validated. The transaction is valid if all of the conditions are satisfied.
Thus, in Ethereum when we “send amount from sender to recipient” we are literally editing balances and updating the storage with a concrete set of commands. This happens on-chain and thus a new transaction is also created on-chain as the result of this process.
In Ergo (as in Bitcoin) transactions are created off-chain and the network nodes only verify them. The effects of the transaction on the blockchain state is that input coins (or Boxes in Ergo's parlance) are removed and output boxes are added to the UTXO set.
In the example above we don't use an ErgoScript contract but instead assume a signature check is used as the spending pre-condition. However in more complex application scenarios we of course need to use ErgoScript which is what we are going to discuss next.

From Changing State to Checking Context

In the send function example we first checked the pre-condition (require(amount <= balances[msg.sender],...) ) and then changed the state (i.e. update balances balances[msg.sender] -= amount ). This is typical in Ethereum transactions. Before we change anything we need to check if it is valid to do so.
In Ergo, as we discussed previously, the state (i.e. UTXO set of boxes) is changed implicitly when a valid transaction is included in a block. Thus we only need to check the pre-conditions before the transaction can be added to the block. This is what ErgoScript contracts do.
It is not possible to “change the state” in ErgoScript because it is a language to check pre-conditions for spending coins. ErgoScript is a purely functional language without side effects that operates on immutable data values. This means all the inputs, outputs and other transaction parameters available in a script are immutable. This, among other things, makes ErgoScript a very simple language that is easy to learn and safe to use. Similar to Bitcoin, each input box contains a script, which should return the true value in order to 1) allow spending of the box (i.e. removing from the UTXO set) and 2) adding the transaction to the block.
If we are being pedantic, it is therefore incorrect (strictly speaking) to think of ErgoScript as the language of Ergo contracts, because it is the language of propositions (logical predicates, formulas, etc.) which protect boxes from “illegal” spending. Unlike Bitcoin, in Ergo the whole transaction and a part of the current blockchain context is available to every script. Therefore each script may check which outputs are created by the transaction, their ERG and token amounts (we will use this capability in our example DEX contracts), current block number etc.
In ErgoScript you define the conditions of whether changes (i.e. coin spending) are allowed to happen in a given context. This is in contrast to programming the changes imperatively in the code of a contract.
While Ergo's transaction model unlocks a whole range of applications like (DEX, DeFi Apps, LETS, etc), designing contracts as pre-conditions for coin spending (or guarding scripts) directly is not intuitive. In the next sections we will consider a useful graphical notation to design contracts declaratively using FlowCard Diagrams, which is a visual representation of executable components (FlowCards).
FlowCards aim to radically simplify dApp development on the Ergo platform by providing a high-level declarative language, execution runtime, storage format and a graphical notation.
We will start with a high level of diagrams and go down to FlowCard specification.

FlowCard Diagrams

The idea behind FlowCard diagrams is based on the following observations: 1) An Ergo box is immutable and can only be spent in the transaction which uses it as an input. 2) We therefore can draw a flow of boxes through transactions, so that boxes flowing in to the transaction are spent and those flowing out are created and added to the UTXO. 3) A transaction from this perspective is simply a transformer of old boxes to the new ones preserving the balances of ERGs and tokens involved.
The following figure shows the main elements of the Ergo transaction we've already seen previously (now under the name of FlowCard Diagram).
https://preview.redd.it/06aqkcd1ssv41.png?width=1304&format=png&auto=webp&s=106eda730e0526919aabd5af9596b97e45b69777
There is a strictly defined meaning (semantics) behind every element of the diagram, so that the diagram is a visual representation (or a view) of the underlying executable component (called FlowCard).
The FlowCard can be used as a reusable component of an Ergo dApp to create and initiate the transaction on the Ergo blockchain. We will discuss this in the coming sections.
Now let's look at the individual pieces of the FlowCard diagram one by one.
1. Name and Parameters
Each flow card is given a name and a list of typed parameters. This is similar to a template with parameters. In the above figure we can see the Send flow card which has five parameters. The parameters are used in the specification.
2. Contract Wallet
This is a key element of the flow card. Every box has a guarding script. Often it is the script that checks a signature against a public key. This script is trivial in ErgoScript and is defined like the def pk(pubkey: Address) = { pubkey } template where pubkey is a parameter of the type Address . In the figure, the script template is applied to the parameter pk(sender) and thus a concrete wallet contract is obtained. Therefore pk(sender) and pk(receiver) yield different scripts and represent different wallets on the diagram, even though they use the same template.
Contract Wallet contains a set of all UTXO boxes which have a given script derived from the given script template using flow card parameters. For example, in the figure, the template is pk and parameter pubkey is substituted with the `sender’ flow card parameter.
3. Contract
Even though a contract is a property of a box, on the diagram we group the boxes by their contracts, therefore it looks like the boxes belong to the contracts, rather than the contracts belong to the boxes. In the example, we have three instantiated contracts pk(sender) , pk(receiver) and minerFee . Note, that pk(sender) is the instantiation of the pk template with the concrete parameter sender and minerFee is the instantiation of the pre-defined contract which protects the miner reward boxes.
4. Box name
In the diagram we can give each box a name. Besides readability of the diagram, we also use the name as a synonym of a more complex indexed access to the box in the contract. For example, change is the name of the box, which can also be used in the ErgoScript conditions instead of OUTPUTS(2) . We also use box names to associate spending conditions with the boxes.
5. Boxes in the wallet
In the diagram, we show boxes (darker rectangles) as belonging to the contract wallets (lighter rectangles). Each such box rectangle is connected with a grey transaction rectangle by either orange or green arrows or both. An output box (with an incoming green arrow) may include many lines of text where each line specifies a condition which should be checked as part of the transaction. The first line specifies the condition on the amount of ERG which should be placed in the box. Other lines may take one of the following forms:
  1. amount: TOKEN - the box should contain the given amount of the given TOKEN
  2. R == value - the box should contain the given value of the given register R
  3. boxName ? condition - the box named boxName should check condition in its script.
We discuss these conditions in the sections below.
6. Amount of ERGs in the box
Each box should store a minimum amount of ERGs. This is checked when the creating transaction is validated. In the diagram the amount of ERGs is always shown as the first line (e.g. B: ERG or B - minErg - txFee ). The value type ascription B: ERG is optional and may be used for readability. When the value is given as a formula, then this formula should be respected by the transaction which creates the box.
It is important to understand that variables like amount and txFee are not named properties of the boxes. They are parameters of the whole diagram and representing some amounts. Or put it another way, they are shared parameters between transactions (e.g. Sell Order and Swap transactions from DEX example below share the tAmt parameter). So the same name is tied to the same value throughout the diagram (this is where the tooling would help a lot). However, when it comes to on-chain validation of those values, only explicit conditions which are marked with ? are transformed to ErgoScript. At the same time, all other conditions are ensured off-chain during transaction building (for example in an application using Appkit API) and transaction validation when it is added to the blockchain.
7. Amount of T token
A box can store values of many tokens. The tokens on the diagram are named and a value variable may be associated with the token T using value: T expression. The value may be given by formula. If the formula is prefixed with a box name like boxName ? formula , then it is should also be checked in the guarding script of the boxName box. This additional specification is very convenient because 1) it allows to validate the visual design automatically, and 2) the conditions specified in the boxes of a diagram are enough to synthesize the necessary guarding scripts. (more about this below at “From Diagrams To ErgoScript Contracts”)
8. Tx Inputs
Inputs are connected to the corresponding transaction by orange arrows. An input arrow may have a label of the following forms:
  1. [email protected] - optional name with an index i.e. [email protected] or u/2 . This is a property of the target endpoint of the arrow. The name is used in conditions of related boxes and the index is the position of the corresponding box in the INPUTS collection of the transaction.
  2. !action - is a property of the source of the arrow and gives a name for an alternative spending path of the box (we will see this in DEX example)
Because of alternative spending paths, a box may have many outgoing orange arrows, in which case they should be labeled with different actions.
9. Transaction
A transaction spends input boxes and creates output boxes. The input boxes are given by the orange arrows and the labels are expected to put inputs at the right indexes in INPUTS collection. The output boxes are given by the green arrows. Each transaction should preserve a strict balance of ERG values (sum of inputs == sum of outputs) and for each token the sum of inputs >= the sum of outputs. The design diagram requires an explicit specification of the ERG and token values for all of the output boxes to avoid implicit errors and ensure better readability.
10. Tx Outputs
Outputs are connected to the corresponding transaction by green arrows. An output arrow may have a label of the following [email protected] , where an optional name is accompanied with an index i.e. [email protected] or u/2 . This is a property of the source endpoint of the arrow. The name is used in conditions of the related boxes and the index is the position of the corresponding box in the OUTPUTS collection of the transaction.

Example: Decentralized Exchange (DEX)

Now let's use the above described notation to design a FlowCard for a DEX dApp. It is simple enough yet also illustrates all of the key features of FlowCard diagrams which we've introduced in the previous section.
The dApp scenario is shown in the figure below: There are three participants (buyer, seller and DEX) of the DEX dApp and five different transaction types, which are created by participants. The buyer wants to swap ergAmt of ERGs for tAmt of TID tokens (or vice versa, the seller wants to sell TID tokens for ERGs, who sends the order first doesn't matter). Both the buyer and the seller can cancel their orders any time. The DEX off-chain matching service can find matching orders and create the Swap transaction to complete the exchange.
The following diagram fully (and formally) specifies all of the five transactions that must be created off-chain by the DEX dApp. It also specifies all of the spending conditions that should be verified on-chain.

https://preview.redd.it/piogz0v9ssv41.png?width=1614&format=png&auto=webp&s=e1b503a635ad3d138ef91e2f0c3b726e78958646
Let's discuss the FlowCard diagram and the logic of each transaction in details:
Buy Order Transaction
A buyer creates a Buy Order transaction. The transaction spends E amount of ERGs (which we will write E: ERG ) from one or more boxes in the pk(buyer) wallet. The transaction creates a bid box with ergAmt: ERG protected by the buyOrder script. The buyOrder script is synthesized from the specification (see below at “From Diagrams To ErgoScript Contracts”) either manually or automatically by a tool. Even though we don't need to define the buyOrder script explicitly during designing, at run time the bid box should contain the buyOrder script as the guarding proposition (which checks the box spending conditions), otherwise the conditions specified in the diagram will not be checked.
The change box is created to make the input and output sums of the transaction balanced. The transaction fee box is omitted because it can be added automatically by the tools. In practice, however, the designer can add the fee box explicitly to the a diagram. It covers the cases of more complex transactions (like Swap) where there are many ways to pay the transaction fee.
Cancel Buy, Cancel Sell Transactions
At any time, the buyer can cancel the order by sending CancelBuy transaction. The transaction should satisfy the guarding buyOrder contract which protects the bid box. As you can see on the diagram, both the Cancel and the Swap transactions can spend the bid box. When a box has spending alternatives (or spending paths) then each alternative is identified by a unique name prefixed with ! (!cancel and !swap for the bid box). Each alternative path has specific spending conditions. In our example, when the Cancel Buy transaction spends the bid box the ?buyer condition should be satisfied, which we read as “the signature for the buyer address should be presented in the transaction”. Therefore, only buyer can cancel the buy order. This “signature” condition is only required for the !cancel alternative spending path and not required for !swap .
Sell Order Transaction
The Sell Order transaction is similar to the BuyOrder in that it deals with tokens in addition to ERGs. The transaction spends E: ERG and T: TID tokens from seller's wallet (specified as pk(seller) contract). The two outputs are ask and change . The change is a standard box to balance transaction. The ask box keeps tAmt: TID tokens for the exchange and minErg: ERG - the minimum amount of ERGs required in every box.
Swap Transaction
This is a key transaction in the DEX dApp scenario. The transaction has several spending conditions on the input boxes and those conditions are included in the buyOrder and sellOrder scripts (which are verified when the transaction is added to the blockchain). However, on the diagram those conditions are not specified in the bid and ask boxes, they are instead defined in the output boxes of the transaction.
This is a convention for improved usability because most of the conditions relate to the properties of the output boxes. We could specify those properties in the bid box, but then we would have to use more complex expressions.
Let's consider the output created by the arrow labeled with [email protected] . This label tells us that the output is at the index 0 in the OUTPUTS collection of the transaction and that in the diagram we can refer to this box by the buyerOut name. Thus we can label both the box itself and the arrow to give the box a name.
The conditions shown in the buyerOut box have the form bid ? condition , which means they should be verified on-chain in order to spend the bid box. The conditions have the following meaning:
  • tAmt: TID requires the box to have tAmt amount of TID token
  • R4 == bid.id requires R4 register in the box to be equal to id of the bid box.
  • script == buyer requires the buyerOut box to have the script of the wallet where it is located on the diagram, i.e. pk(buyer)
Similar properties are added to the sellerOut box, which is specified to be at index 1 and the name is given to it using the label on the box itself, rather than on the arrow.
The Swap transaction spends two boxes bid and ask using the !swap spending path on both, however unlike !cancel the conditions on the path are not specified. This is where the bid ? and ask ? prefixes come into play. They are used so that the conditions listed in the buyerOut and sellerOut boxes are moved to the !swap spending path of the bid and ask boxes correspondingly.
If you look at the conditions of the output boxes, you will see that they exactly specify the swap of values between seller's and buyer's wallets. The buyer gets the necessary amount of TID token and seller gets the corresponding amount of ERGs. The Swap transaction is created when there are two matching boxes with buyOrder and sellOrder contracts.

From Diagrams To ErgoScript Contracts

What is interesting about FlowCard specifications is that we can use them to automatically generate the necessary ErgoTree scripts. With the appropriate tooling support this can be done automatically, but with the lack of thereof, it can be done manually. Thus, the FlowCard allows us to capture and visually represent all of the design choices and semantic details of an Ergo dApp.
What we are going to do next is to mechanically create the buyOrder contract from the information given in the DEX flow card.
Recall that each script is a proposition (boolean valued expression) which should evaluate to true to allow spending of the box. When we have many conditions to be met at the same time we can combine them in a logical formula using the AND binary operation, and if we have alternatives (not necessarily exclusive) we can put them into the OR operation.
The buyOrder box has the alternative spending paths !cancel and !swap . Thus the ErgoScript code should have OR operation with two arguments - one for each spending path.
/** buyOrder contract */ { val cancelCondition = {} val swapCondition = {} cancelCondition || swapCondition } 
The formula for the cancelCondition expression is given in the !cancel spending path of the buyOrder box. We can directly include it in the script.
/** buyOrder contract */ { val cancelCondition = { buyer } val swapCondition = {} cancelCondition || swapCondition } 
For the !swap spending path of the buyOrder box the conditions are specified in the buyerOut output box of the Swap transaction. If we simply include them in the swapCondition then we get a syntactically incorrect script.
/** buyOrder contract */ { val cancelCondition = { buyer } val swapCondition = { tAmt: TID && R4 == bid.id && @contract } cancelCondition || swapCondition } 
We can however translate the conditions from the diagram syntax to ErgoScript expressions using the following simple rules
  1. [email protected] ==> val buyerOut = OUTPUTS(0)
  2. tAmt: TID ==> tid._2 == tAmt where tid = buyerOut.tokens(TID)
  3. R4 == bid.id ==> R4 == SELF.id where R4 = buyerOut.R4[Coll[Byte]].get
  4. script == buyer ==> buyerOut.propositionBytes == buyer.propBytes
Note, in the diagram TID represents a token id, but ErgoScript doesn't have access to the tokens by the ids so we cannot write tokens.getByKey(TID) . For this reason, when the diagram is translated into ErgoScript, TID becomes a named constant of the index in tokens collection of the box. The concrete value of the constant is assigned when the BuyOrder transaction with the buyOrder box is created. The correspondence and consistency between the actual tokenId, the TID constant and the actual tokens of the buyerOut box is ensured by the off-chain application code, which is completely possible since all of the transactions are created by the application using FlowCard as a guiding specification. This may sound too complicated, but this is part of the translation from diagram specification to actual executable application code, most of which can be automated.
After the transformation we can obtain a correct script which checks all the required preconditions for spending the buyOrder box.
/** buyOrder contract */ def DEX(buyer: Addrss, seller: Address, TID: Int, ergAmt: Long, tAmt: Long) { val cancelCondition: SigmaProp = { buyer } // verify buyer's sig (ProveDlog) val swapCondition = OUTPUTS.size > 0 && { // securing OUTPUTS access val buyerOut = OUTPUTS(0) // from [email protected] buyerOut.tokens.size > TID && { // securing tokens access val tid = buyerOut.tokens(TID) val regR4 = buyerOut.R4[Coll[Byte]] regR4.isDefined && { // securing R4 access val R4 = regR4.get tid._2 == tAmt && // from tAmt: TID R4 == SELF.id && // from R4 == bid.id buyerOut.propositionBytes == buyer.propBytes // from script == buyer } } } cancelCondition || swapCondition } 
A similar script for the sellOrder box can be obtained using the same translation rules. With the help of the tooling the code of contracts can be mechanically generated from the diagram specification.

Conclusions

Declarative programming models have already won the battle against imperative programming in many application domains like Big Data, Stream Processing, Deep Learning, Databases, etc. Ergo is pioneering the declarative model of dApp development as a better and safer alternative to the now popular imperative model of smart contracts.
The concept of FlowCard shifts the focus from writing ErgoScript contracts to the overall flow of values (hence the name), in such a way, that ErgoScript can always be generated from them. You will never need to look at the ErgoScript code once the tooling is in place.
Here are the possible next steps for future work:
  1. Storage format for FlowCard Spec and the corresponding EIP standardized file format (Json/XML/Protobuf). This will allow various tools (Diagram Editor, Runtime, dApps etc) to create and use *.flowcard files.
  2. FlowCard Viewer, which can generate the diagrams from *.flowcard files.
  3. FlowCard Runtime, which can run *.flowcard files, create and send transactions to Ergo network.
  4. FlowCard Designer Tool, which can simplify development of complex diagrams . This will make designing and validation of Ergo contracts a pleasant experience, more like drawing rather than coding. In addition, the correctness of the whole dApp scenario can be verified and controlled by the tooling.
submitted by eleanorcwhite to btc [link] [comments]

How Bitcoin Works in 5 Minutes (Technical) - YouTube BlockChain Slides 2 A guide to using diagrams - YouTube Bitcoin: How Cryptocurrencies Work - YouTube BlockChain Slides: technology, bitcoin transactions and more

The transaction hash from the previous transaction will match the transaction hash from the hash in the input array of the current transaction. A private key (which we do not know) is used to generate the public key hash (which can be derived from a bitcoin address) in the previous transaction. Let’s understand the mechanics of a real bitcoin transaction. We’ll use the image above as a reference. If you were to cut open a typical bitcoin transaction, you’d end up with three major pieces: the header, the input(s), and the output(s). Let’s briefly look at the fields available to us in these sections, as they’ll be important ... The total number of mined bitcoin that are currently circulating on the network. Market Price. The average USD market price across major bitcoin exchanges. Market Capitalization (USD) ... The median time for a transaction with miner fees to be included in a mined block and added to the public ledger. An transaction is a transfer of Bitcoin value that is broadcast to the network and collected into blocks. A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs. Transactions are not encrypted, so it is possible to browse and view every transaction ever ... All of the data in a transaction is in hexadecimal.; The following icon indicates that the data is in reverse byte order: ; Diagram. A transaction is basically a series of inputs and a series of outputs.. In further detail; the transaction data tells you how to unlock existing packages of bitcoins (from previous transactions), and how to lock them up again in to new packages.

[index] [26271] [26012] [20099] [21165] [2718] [33295] [31178] [8263] [23424] [21970]

How Bitcoin Works in 5 Minutes (Technical) - YouTube

Drawing diagrams is a very different type of communication than most of us are used to, but it allows us to think in new ways and encourages us to approach p... Get up and going on Bitcoin fast, from how to Buy, store and send, to the basic concepts, to the inner workings, to how to program. ... HowTo Send a Bitcoin Transaction with JavaScript & Bitcore ... Collection of detailed diagrams, flowcharts, and illustrations on blockchain technology, bitcoin transactions and more. Educated innovators and investors will benefit from understanding the scale ... Blockchain charts, graphs, illustrations. Collection of detailed diagrams, flowcharts, and illustrations on blockchain technology, bitcoin transactions and more. A short introduction to how Bitcoin Works. Want more? Check out my new in-depth course on the latest in Bitcoin, Blockchain, and a survey of the most excitin...

#