HASHGRAPH CONSENSUS: DETAILED EXAMPLES

Similar documents
Running head: ROCK THE BLOCKCHAIN 1. Rock the Blockchain: Next Generation Voting. Nikolas Roby, Patrick Gill, Michael Williams

Simple methods for single winner elections

CS 4407 Algorithms Greedy Algorithms and Minimum Spanning Trees

Protocol to Check Correctness of Colorado s Risk-Limiting Tabulation Audit

c M. J. Wooldridge, used by permission/updated by Simon Parsons, Spring

PLS 103 Lecture 3 1. Today we talk about the Missouri legislature. What we re doing in this section we

Topics on the Border of Economics and Computation December 18, Lecture 8

The Federal in Federalism STEP BY STEP

Electronic Voting Service Using Block-Chain

bitqy The official cryptocurrency of bitqyck, Inc. per valorem coeptis Whitepaper v1.0 bitqy The official cryptocurrency of bitqyck, Inc.

DHSLCalc.xls What is it? How does it work? Describe in detail what I need to do

Answers to Practice Problems. Median voter theorem, supermajority rule, & bicameralism.

Robert's Rules: What You Should Know

Electoral Reform Questionnaire Field Dates: October 12-18, 2016

EDEXCEL FUNCTIONAL SKILLS PILOT. Maths Level 1. Test your skills. Chapters 6 and 7. Investigating election statistics

Math Circle Voting Methods Practice. March 31, 2013

NATIONAL: PUBLIC SAYS LET DREAMERS STAY

Random tie-breaking in STV

Inviscid TotalABA Help

A matinee of cryptographic topics

What are Political Concepts in the US Constitution or What are the guiding themes behind our government? Name Page

3B Circle Graphs. COLORS Use the graph that shows the results of a survey.

MATH 1340 Mathematics & Politics

Addressing the Challenges of e-voting Through Crypto Design

The New Deal And All? Americans

Assumption & Jurisdiction - Howard Freeman

Proposals for the introduction of Elements of Direct Democracy in Great Britain and Northern Ireland

FREEDOM ON THE NET 2011: GLOBAL GRAPHS

Autonocoin: A Proof-of-Belief Cryptocurrency

Computational Social Choice: Spring 2017

The choice E. NOTA denotes None of These Answers. Give exact answers unless otherwise specified. Good luck, and have fun!

Hint: It s not a retrial

METHODOLOGY: Regional leaders are now left to come up with a new plan for the future of transportation in the Lower Mainland.

What you should know about. Influencing Legislation

The option not on the table. Attitudes to more devolution

Bush Shows Improvement; The Race Remains Close

Dear friend, Sincerely yours, Founders of the SPARTA cryptocurrency!

Social Choice. CSC304 Lecture 21 November 28, Allan Borodin Adapted from Craig Boutilier s slides

Swiss E-Voting Workshop 2010

Latino Policy Coalition Second Survey June 2006

In Elections, Irrelevant Alternatives Provide Relevant Data

European Movement Ireland Research Poll. April 2017 Ref:

THE BIG CHAPTER 6,7,8 PROJECT

Chuck R. Venvertloh Adams County Clerk/Recorder 507 Vermont St. Quincy, IL 62301

BALLOT BOX CHECKLIST

MMP vs. FPTP. National Party. Labour Party. Māori Party. ACT New Zealand. United Future. Simpl House 40 Mercer Street

DEVELOPING A COLLECTION PLAN FOR GATHERING VIDEO EVIDENCE

Inviscid TotalABA Help

David R. M. Thompson, Omer Lev, Kevin Leyton-Brown & Jeffrey S. Rosenschein COMSOC 2012 Kraków, Poland

Conditions Governing Use of the Marks by VVA State Councils, Chapters, or Regions

Common Bill Mistakes. How to spot them and how to avoid them

General Election Opinion Poll. May 2018

Joint Membership Sign Up at Events

Separation of Powers: What s for Lunch? STEP BY STEP

EXAMINATION 3 VERSION B "Wage Structure, Mobility, and Discrimination" April 19, 2018

E-Pollbook Version. Please silence your cell phone

LEE S SUMMIT CHARTER REVIEW COMMISSION JUNE 11, 2007

Questions and Answers

Estimating the Margin of Victory for Instant-Runoff Voting

The 2012 GOP Primary: Unmasking the Vote Manipulation

Telephone Survey. Contents *

15-16 yr olds Practice Constitution Bee Name:

The quality of the air

ENGLISH CAFÉ 156. to repeal to end a law; to stop a law from being a law * Alcohol used to be illegal in the United States but that law was repealed.

My fellow Americans, tonight, I d like to talk with you about immigration.

Biometric Hybrid Blockchain City ICO 3.0

PCGENESIS PAYROLL SYSTEM OPERATIONS GUIDE

Section Apportionment Methods. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

4.1 THE DUTCH CONSTITUTION. The part of the government that makes sure laws are carried out 1 mark.

Many Social Choice Rules

HIGH POINT UNIVERSITY POLL MEMO RELEASE 9/24/2018 (UPDATE)

Large Group Lesson. Introduction Video This teaching time will introduce the children to what they are learning for the day.

Teaching Free Markets To Students (Capitalism is a Dirty Word)

Please silence your cell phone. View this presentation and other pollworker-related materials at:

CS 5523 Operating Systems: Synchronization in Distributed Systems

THE AP-GfK POLL. Conducted by GfK Roper Public Affairs & Media

Strategy in Law and Business Problem Set 1 February 14, Find the Nash equilibria for the following Games:

On e-voting and privacy

Virginia Photo Voter Identification: Q &A

1 PEW RESEARCH CENTER

Check 10 key points in the Will to get all the paperwork right for letters testamentary

Get Out The Audit (GOTA): Risk-limiting ballot-polling audits are practical now!

WARREN COUNTY BOARD OF ELECTIONS

Reading vs. Seeing. Federal and state government are often looked at as separate entities but upon

Supporting Information Political Quid Pro Quo Agreements: An Experimental Study

Lyle E. Craker v. Drug Enforcement Administration Transcription of Oral Arguments May 11, 2012 at 9:30 AM

Coin-Vote. Abstract: Version 0.1 Sunday, 21 June, Year 7 funkenstein the dwarf

Alberta Carbon Levy and Rebate Program Lethbridge Public Opinion Study Winter 2018

Supporter Guide to the General Election

13-14 yr olds Practice Constitution Bee Name:

11-12 yr olds Practice Constitution Bee Name:

GST 104: Cartographic Design Lab 6: Countries with Refugees and Internally Displaced Persons Over 1 Million Map Design

Overview. Strategic Imperatives. Our Organization. Finance and Budget. Path to Victory

NPR/Kaiser/Kennedy School Poll on Poverty in America

Policies and Procedures for IEEE 3D Human Factors Working Groups Entity Method

REAL RATE OF UNEMPLOYMENT IN CANADA: TYPICAL EXAMPLE

Public Attitudes Survey Bulletin

Applicants may use three types of granting procedures:

The Effectiveness of Receipt-Based Attacks on ThreeBallot

Lecture 6 Cryptographic Hash Functions

Transcription:

HASHGRAPH CONSENSUS: DETAILED EXAMPLES LEEMON BAIRD BAIRD@SWIRLDS.COM DECEMBER 11, 2016 SWIRLDS TECH REPORT SWIRLDS-TR-2016-02 ABSTRACT: The Swirlds hashgraph consensus algorithm is explained through a series of examples on a hashgraph. Each page shows the hashgraph with annotations explaining a step of the algorithm. This covers the core algorithm, from creating transactions, through finding their consensus order and timestamps. The important terms are defined and illustrated on the following pages: 2 Hashgraph 2 Member 2 Event 2 Transaction 2 Consensus 2 Order 2 Timestamp 3 Gossip protocol 4 Self-parent 4 Other-parent 7 Graph 7 Hash 7 Hashgraph 8 Round created 9 Witness 10 Famous witness 10 Election 10 Vote 11 See 15 Strongly see 15 Supermajority 19 Decide 19 Round created 24 Round received 24 Consensus timestamp 28 Consensus order April 7, 2017: this version includes corrections. 1

This figure is a hashgraph. It grows upward over time. Every participant keeps a copy of it in memory. In this example, there are four members (full nodes) in the network. The members are Alice, Bob, Carol, Dave, and are represented by the 4 lines labeled A, B, C, D. Each member starts by creating an event, which is a small data structure in memory, and which is represented here by a gray circle. = Each event is a container for zero or more transactions. The goal of the Swirlds hashgraph consensus algorithm is for the members of the community to come to a consensus (agreement) on the order of the events (and thus the order of transactions inside the events), and to agree on a timestamp for each event (and so for each transaction). It should be hard for attackers to prevent consensus, or to force different members to come to a different consensus, or to unfairly influence the order and timestamps that are agreed. 2

The community runs a gossip protocol, which means that each member repeatedly calls others at random to sync with them. In this case, Bob randomly chose to call Dave. When they connected over the internet, Bob sent Dave all the events he knew that Dave did not yet know. In this case, it was just one event: the one that Bob had created at the start. Dave records the fact that this sync happened by creating a new event. This is the new circle, which has lines going straight down to his own last event, and diagonally down to Bob s last event. Thus, the graph of events forms a record of how the members have communicated. = TECHNICAL DETAIL: Bob can avoid sending Dave events he already knows. Bob first tells Dave how many events he knows about that were created by each member (i.e., 4 integers). Dave tells Bob the same. Then they will both know exactly which events each should send the other. If Bob has 13 events by Alice and Dave has 10, then Bob sends Alice s last 3 events. 3

Dave s new event is illustrated here. An event is a data structure containing the two hashes of the two events below itself (its self-parent and its other-parent). In this case, the self-parent is Dave s first event, and the otherparent is Bob s first event. The event can optionally contain zero or more transactions that Dave wants to send to the network. So an event is a container for transactions. Dave also puts a timestamp of when he created the event. He then digitally signs it. When this event is gossiped, the signature will be sent along with it. Event (signed by creator): timestamp transactions hash hash = 4

Dave then sends Bob all his events (including the new one he just created). Bob then creates a new event recording the fact they synced, and including the hashes of the most recent event by himself and the most recent event by Dave. = 5

Bob then randomly chooses Alice, and sends her all 4 events he knows about. She creates a new one. = 6

This continues forever, growing a directed acyclic graph upwards forever. This is a graph connected by cryptographic hashes, so it is called a hashgraph. Each event contains the hashes of the events below it and is digitally signed by its creator. So the entire graph of hashes is cryptographically secure. It can always grow, but the older parts are immutable, as strong as the cryptographic hash and signature system used. = 7

Round Created: 4 3 2 It is useful to define a round created for each event. A child never has a round created before one of its parents. So as time flows upward in the diagram, the round created can only stay the same or increase. A later slide will describe how the round created is calculated. The important point is that as soon as you receive an event in a sync, you can immediately calculate its round created. And anyone else receiving it will calculate the same number. Guaranteed. = 1 TECHNICAL DETAIL: The definition is: the round created for an event is R or R+1, where R is the max of the round created of its parents. It is R+1 if and only if it can strongly see a supermajority of round R witnesses. This is explained in greater detail in later slides. 8

Round Created: 4 The first event that Alice creates in each round is called a witness. Her witnesses are labeled A1,, and here. The other members create witnesses similarly. 3 It is possible for a member to have no witnesses in a given round. 2 1 TECHNICAL DETAIL: It is possible for a member to cheat by forking, or creating two events with the same self parent. In that case, there might be two witnesses in the same round by the same member. There are theorems proving that this won t matter. 9

For each witness, we need to determine if it is a famous witness. For example, we will determine if the witness is a famous witness. This is done by considering the witnesses in the next round. So the fame of will be determined by first considering the witnesses,,, and. The idea is for to count as famous if it is seen by many of the witnesses in the next round. There is now an election, in which each of those witnesses will vote on whether is famous. There will be a separate election for every witness, to determine its fame. 10

The witness can see. That means that there is an entirely-downward path from to. In other words, is an ancestor of. And is a descendent of can see, so will vote in the election for whether is famous. TECHNICAL DETAIL: sees all its ancestors except for those created by a member who created a fork that is an ancestor of. In other words, can see if is an ancestor of, and the creator of (who is Bob) did not create two events X and Y that both have the same self-parent and are both ancestors of. So seeing is the same as ancestor, except you can t see cheaters. 11

sees, so it votes. 12

sees, so it votes. 13

sees, so it votes. All four witnesses voted, so we would expect that will be declared to be famous. But the election isn t over yet! An election isn t over until the votes are counted. The votes will be counted by the witnesses in the following round. So B4 will count the votes. And will also count the votes. The hashgraph doesn t yet have an A4 or C4. But as time goes on and more gossiping occurs, there may eventually be an A4 and C4, and then they will count the votes, too. 14

strongly sees: B4 B4 will collect the votes from every round-3 witness that it strongly sees. To strongly see a witness, it isn t enough for there to be a single downward path to it. There must be enough different paths to it so that together, the paths go through a supermajority of the population. A supermajority is any number that is more than two thirds of the population. In this example, there are 4 members in the population, so any 3 of them constitute a supermajority. In this example, B4 is able to strongly see. The red path goes from B4 to through Alice and Bob. The green path goes through Alice, Bob, and Dave. There are no paths from B4 that go through Carol to get to. But that s OK, because Alice, Bob, and Dave make up a supermajority. So Carol isn t needed. In fact, the green path alone would have been enough. The red path wasn t needed. So, B4 can strongly see. Therefore, B4 collects the vote from (which is ). 15

strongly sees:,, B4 B4 strongly sees, because the red path goes through Alice and Bob, and the green path goes through Bob and Dave. In this case, both paths were needed to reach the supermajority. 16

strongly sees:,,, B4 B4 strongly sees, and so collects another vote. TECHNICAL DETAIL: if a path starts at Bob and ends at Carol, then it automatically counts as going through Bob and Carol. In other words, the endpoints of the path are counted, too. 17

strongly sees:,,, B4 B4 strongly sees, and so collects another vote. 18

At this point, B4 has received notes from a supermajority, so B4 decides that the election result is. Color green to show that it is now famous. That is the consensus decision. If B4 had seen 3 and 1 NO, it would still decide, because that s a supermajority. If B4 had seen 3 votes and no other votes (because it couldn t strongly see one of the witnesses), it would still decide, because that s a supermajority. We need for B4 to strongly see a supermajority of witnesses, in order to even have a chance at deciding. Therefore, we use this to define the round created. If an event X has parents with a maximum round created of R, then that event will usually be round R, too. But if that event can strongly see a supermajority of round R witnesses, then that event is defined to be round R+1, and so is a witness. In other words, an event is promoted to the next round when it can strongly see a supermajority of witnesses in the current round. 19

Now we run an election for whether is famous. The yellow path shows that can see, and so votes yes. NO NO NO There are no downward paths from,, or to, so they all vote NO. 20

strongly sees: NO, NO,, NO B4 Since B4 strongly sees all of,,, and, it will therefore collect votes from all of them. NO NO NO The votes are NO, NO,, NO. So a supermajority is NO. So it decides NO. The election is over. is not famous. Color it blue to show that it is not famous. 21

B4 There is a theorem that if any witness is able to decide yes or no, then that is the result of the election, and it is guaranteed that all other witnesses that decide are going to decide the same way. In this example, B4 was able to decide the election. If it had collected votes that were more evenly split between and NO, then it would have failed to decide. In that case, we can consider. If also fails to decide, then perhaps A4 or C4 might decide. If none of the round-4 witnesses can decide, then each of them will simply vote in accordance with the majority of the votes they collected (voting in case of a tie). In that case, it will be up to the round-5 witnesses to collect votes from the round-4 witnesses. Perhaps the round-5 witnesses will be able to decide. 22

The voting continues until it eventually reaches a round where some witness can decide the election. There is a theorem saying that the election will eventually end (with probability one) as long as we add in a coin round every 10 th round of voting. In a coin round, collecting a supermajority causes a witness to merely vote (not decide). And a non-supermajority causes it to vote pseudorandomly, by using the middle bit of its own signature as its vote. 23

6 more elections are run. They decide that,, A1, B1, C1, and D1 are all famous. In normal operation, most events are not witnesses, so there is no election for most events. And most witnesses are declared famous with an almost-unanimous vote in the first round of voting. So most elections do not last very long. Notice that in this example, we have now decided the fame of every witness in round 2. Once a round has the fame decided for all of its witnesses, it is possible to find the round received and find the consensus timestamp for a new set of events. Start by considering the gray event immediately below. TECHNICAL DETAIL: If a member forks, they might have two famous witnesses in the same round. In that case, neither of them are used further. Only the remaining ones (the unique famous witnesses ) are used to determine round received and consensus timestamp. 24

This event can be seen by every famous witness in round 2. The red, green, and blue paths show how,, and, respectively, can all see the black event. This merely requires seeing, not strongly seeing. This only requires seeing by the famous witnesses. It doesn t matter whether can see the black event, because is not famous. Since the black event is seen by all of the famous witnesses in round 2 (but not in any earlier round), it is said to have a round received of 2. TECHNICAL DETAIL: we don t need to limit ourselves to seeing. It is sufficient to use the ancestor relationship instead. In other words, at this step, we don t worry about forking. 25

The consensus timestamp of the black event can be found as follows. Find the earliest event X by Alice that is an ancestor of and a descendent of the black event. Similarly, find the earliest event Y by Bob that is an ancestor of and descendent of the black event. And similarly for event Z by Dave. Take the timestamps on the events X, Y, Z that were put in those events by their creators. Sort all of the timestamps in order. Take the middle one from the list (or the second of the two middle ones, if there are an even number of them). This median timestamp is the consensus timestamp for the black event. 26

Now consider the gray event below. It is seen by, but not seen by or. So it was not seen by all the famous witnesses in round 2. So its received round will be later than round 2. Leave it colored gray to indicate that it doesn t yet have a received round. 27

Continuing, we find consensus for the 6 black events and the 4 dark green events. These are the 10 events that have a round received of 2. We need to sort these 10 events into an order that all members will agree on. This agreed order is the consensus order. This is done by sorting them by round received. Ties are broken by sorting by the median timestamp (which is the consensus timestamp). Further ties are broken by sorting by the extended median (which looks at more than just the middle element of each list). Further ties are broken by sorting them by their signatures, after all the signatures have been XORed with a pseudorandom number. The pseudorandom number for a given round received is found by XORing the signatures of all the famous witnesses in that round. 28

This picture is a screenshot from the HashgraphDemo app that is part of the Swirlds SDK that can be downloaded from Swirlds.com. This screenshot came from running it in slow mode with 4 members, with the checkbox checked to show the round created. This screenshot shows the part of the hashgraph from about round 100 to 105. The example is a slightly-modified version of the top half of this screenshot. 29