Node a b c Node a b c Node a b c Same data on every node P2P Network & Consensus - P2P Network: There is no distinction between client and server - Consensus: Majority voting determines output for input For a given input, all machines produce the same output
Vote Vote Vote Vote Vote Vote Vote Vote() Vote Propose Propose Propose Propose Propose Timeout Vote /PEFTIBWFWPUJOHQPXFSBDDPSEJOHUPDPNQVUJOHQPXFS #MPDL*OUFSWBM Timeout Vote Votes are not collected Votes are not collected No Leader and Probabilistic Finality node A node B node C node D node E
25 coin= voting power 20 coin= voting power 15 coin= voting power 10 Propose 30 Vote 25 Propose 25 Vote 20 Vote 25 Vote 10 Vote 15 LINE Blockchain Mainnet node A node B node C node D node E Leader and Fast Finality Vote 15
block is elected from the set of voters. Issue With the round robin method, the next proposer is predictable and the attack target is easily narrowed down. Solution Weighted election and verification by random number generation using "verifiable random functions”
A gets the winning ticket ! A B C D 0 1 0 1 Min-Max Normalization Verifiable random function: message = sha256(height || round || previous hash) (message, private key) → hash, proof - A hash is used as random number - A proof can prove that you are the creator of the hash Ref: https://github.com/line/ostracon/blob/v1.0.7/docs/ja/02-consensus.md
multi- nodes are not allowed to vote on multiple blocks when voting asynchronously Issue A single stage voting causes a state transition where multiple blocks are approved as the round progresses Solution Two stage voting with prevote and precommit
precommits are found, commit the block and propose a new height block. If not, propose another block of the same height in the next round +2/3 prevote for block +2/3 precommit for block Commit New height Propose block Prevote block Precommit block New round
A, B, C → Round R+1, propose Block X’ D → Commit Block X Block V Block W Block X' Block V Block W Block X A, B, C D fork !!! # % " $ Block X = { nil, vote B, vote_C} < 2/3* 4 members A, B, C Block X = { nil, vote_B, vote_C, vote_D} > 2/3* 4 members D Gossip Protocol D only gossip fail! vote = Precommit Round R " Block X nil # $ % vote vote vote
A, B, C → Round R+1, propose Block X’ D → Commit Block X Block V Block W Block X' Block V Block W Block X A, B, C D fork !!! # % " $ Block X = { nil, vote B, vote_C} < 2/3* 4 members A, B, C Block X = { nil, vote_B, vote_C, vote_D} > 2/3* 4 members D Gossip Protocol D only gossip fail! vote = Precommit Round R " Block X nil # $ % vote vote vote
A, B, C → Round R+1, propose Block X’ D → Commit Block X Block V Block W Block X' Block V Block W Block X A, B, C D fork !!! # % " $ Block X = { nil, vote B, vote_C} < 2/3* 4 members A, B, C Block X = { nil, vote_B, vote_C, vote_D} > 2/3* 4 members D Gossip Protocol D only gossip fail! vote = Precommit Round R " Block X nil # $ % vote vote vote
- Voters can cancel their vote for a block at previous round if they see +2/3 votes for a different block at later round - Voters can vote for a different block at prevote or precommit when unlocked Unlock Rule Lock Rule - Voters are locked into the block where they voted at prevote or precommit - Voters cannot vote for a different block at prevote or precommit when locked
R " Block X nil # $ % nil vote nil vote = Prevote Round R+1 " Block Y vote # $ % vote nil vote Block V Block W Block Y vote B Block Y vote C vote D A, B, C, D vote = Precommit Round R+1 vote A vote B vote C vote D Can vote vote A
R " Block X nil # $ % nil vote nil vote = Prevote Round R+1 " Block Y vote # $ % vote nil vote Block V Block W Block Y vote B Block Y vote C vote D A, B, C, D vote = Precommit Round R+1 vote A vote B vote C vote D Can vote vote A
R " Block X nil # $ % nil vote nil vote = Prevote Round R+1 " Block Y vote # $ % vote nil vote Unlock +2/3 Block V Block W Block Y vote B Block Y vote C vote D A, B, C, D vote = Precommit Round R+1 vote A vote B vote C vote D Can vote vote A
works even if up to 1/3 Byzantine If byzantine node is less than 1/3, agreement can be made among nodes Node Node OK OK OK Node NG OK Node OK OK NG TrustGuard: countering vulnerabilities in reputation management for decentralized overlay networks “The Byzantine Generals Problem” Ref:https://www.microsoft.com/en-us/research/uploads/ prod/2016/12/The-Byzantine-Generals-Problem.pdf
to vote for a block must always be online (the key is loaded into memory and used) Issue If the key is stolen from memory, the vote can be forged Solution Intel SGX for key loading in safe memory space
Approval Forgery Flow: 1. loading a key from a json file 2. Stealing keys in memory 3. Using stolen keys, authorize 4. Adding blocks by forging approvals Solved by encrypting read into a secure memory space. More details in the session: “Secure Key Management System Using Intel SGX Technology" URL:https://tech-verse.me/sessions/82 “Vd2NqqPhV1J k” A Block is added illegally! vote: precommit vote:nil Stolen key Steal the key Malicious node ̍ 2 3 4
( Verifier ) Verification tx sender: Alice tx receiver: Bob When Bob receives a tx, he verifies that it is an approved transaction. Verification method: Check using the Proof in the header of the block "MJDF #PC Is the tx in the list? From:Alice to:Bob 5SBOTBDUJPO" UY #MPDL) Height Proof )FBEFS Tx_A Tx_B Tx_C Tx_D #PEZ ʜ ʜ
as indexed data in a tree structure hash tree. Sender: Transactions are recorded as indexed data in a tree structure hash tree. 3 transactions are {Tx: a=1, Tx: b=2, Tx: c=3} Receiver: Received associated hash values from full node using a=1, b=2, c=3. Check RootHash = Proof using hash=d6f56d E D F C D C B F E E D C IBTIEGE D IBTI C IBTI B IBTI D C B UY UY UY "MJDF 4FOEFS QSPWFS #PC 3FDFJWFS 7FSJpFS SPPUIBTI 1SPPG
as indexed data in a tree structure hash tree. Sender: Transactions are recorded as indexed data in a tree structure hash tree. 3 transactions are {Tx: a=1, Tx: b=2, Tx: c=3} Receiver: Received associated hash values from full node using a=1, b=2, c=3. Check RootHash = Proof using hash=d6f56d E D F C D C B F E E D C IBTIEGE D IBTI C IBTI B IBTI D C B UY UY UY "MJDF 4FOEFS QSPWFS #PC 3FDFJWFS 7FSJpFS SPPUIBTI 1SPPG
a transaction Issue Generating a signature using secp256k1 results in two valid signatures Solution Check if the value is in the range of half of the order
transaction is signed 1. Convert tx data to hash curve 2. Create one signature on an elliptic curve using one private key 3. Elliptic curves are X-axis symmetric, so two valid signatures are created! 2 "MJDF UYEBUB )BTIGVOD )BTI 1SJWBUFLFZ 4JHOUY 4JHOBUVSF "MJDF TJHO TJH TJH Z Y TJH TJH "MJDF TJHO ̍ 3
11’ (Hash:Y) 12’ (Hash:W) from primary from witness Light Node Detect Attack Light Node receives headers for blocks 11 and 12 from primary node Light Node receives headers for blocks 11’ and 12’ from witness node Compares the two headers and detects discrepancies Attack detection by Light Node
block dependent fields” evidence Detecting a discrepancy in one place does not indicate which is correct. Headers are obtained from multiple nodes for monitoring, called witness nodes, to determine which one is incorrect. Light Node Primary Node Witness Node Witness Node Witness Node Attack detection by Light Node with Witness
avoid performance loss Issue Need to define good quality peers Solution Calculation and ranking of confidence values by proportional (latest value), integral (history), and derivative (behavior variation) factors
B ! Trust Value E B D A C address B address E address book … Criteria for choosing Peers - Peers are ordered by the order of their calculated trust value int the address book - Connect to the peer with the highest trust value - Trust value is calculated based on events - The address book is updated using trust values. ex. good event: good connection bad event: Poor connection, incorrect block transmission
TrustValue[i] = a * R[i] Propotionalcomponent + b * H[i] Integralcomponent + c(D[i]) * D[i] Derivativecomponent (1) PropotinalValue = a * R[i] (2) IntegralValue = b * H[i] H[i] = maxH ∑ k=1 R[i + k] * [ w k ∑maxH k=1 wk ] (3) DerivativeValue = c(D[i]) * D[i] D[i] = R[i] − H[i] - Proportional Component:Value of the most recent time interval i - Integral Component:History weighted by time interval - Derivative Component:Value representing a sudden change from good peers to bad peers Factors of most recent, previous, and sudden changes are combined and ranked TrustGuard: countering vulnerabilities in reputation management for decentralized overlay networks “TrustGuard: countering vulnerabilities in reputation management for decentralized overlay networks” Ref:https://dl.acm.org/doi/10.1145/1060745.1060808