Slide 1

Slide 1 text

Scaling blockchain with off-chain transactions By Koshik Raj www.koshik.me

Slide 2

Slide 2 text

Scaling issues in blockchain ● Remember CryptoKitties? 7 TPS 50,000 TPS ● Bitcoin cannot scale like centralized payment gateways such as VISA ○ In December, 2017, CryptoKitties clogged up Ethereum network due to increased transactions

Slide 3

Slide 3 text

Why doesn’t blockchain scale? ● CAP theorem states any distributed system cannot possess consistency, availability and partition tolerance properties ● Due to blockchain trilemma, any DLT can possess only 2 of the 3 properties Scalability Decentralization Security

Slide 4

Slide 4 text

How to scale? Layer 1 solution: ● Modifying the core blockchain consensus algorithms to support higher transaction rates: ● Increase the blocksize Layer 2 solutions: ● Take the transaction outside blockchain (offchain transactions) ○ State channels ○ Sidechains

Slide 5

Slide 5 text

Off-chain state channels Nodes create a channel and perform a series of transactions and commit only the final state to the blockchain Alice Bob

Slide 6

Slide 6 text

Lightning Network (LN) ● A layer-2 protocol built for Bitcoin based blockchain. ● It was created to reduce the transaction fee for micropayments. ● Lightning network essentially performs only 2 blockchain transactions for every channel ● Currently runs beta implementation on Bitcoin mainnet

Slide 7

Slide 7 text

A basic design ● Create a payment channel by committing initial funds ● Perform microtransactions using and update the funds in the channel ● Close and broadcast the final state at any time to include in the blockchain Alice Bob Multisig account

Slide 8

Slide 8 text

Routed payment channel in LN ● LN can perform transactions without creating a direct channel ● Routed payment system uses Hash time lock contracts (HTLC) ● HTLC makes sure that none of the actors in the routed channel can cheat Alice Carol Bob

Slide 9

Slide 9 text

Routed payment channel in LN ● Alice creates a routed channel with Carol via Bob ● Carol creates a Secret and shares only its hash value ● Alice constructs an HTLC worth 1.1 BTC and shares it with Bob ● Bob constructs an HTLC worth 1.0 BTC and shares it with Carol ● Funds are retrieved by Bob and Carol only after they disclose the secret 1.1 BTC 1.0 BTC 2.0 2.0 4.0 3.0 3.0 0.9 4.1 Alice Carol Bob

Slide 10

Slide 10 text

LN implementations ● There are several implementations of LN. Few of them are: ○ Lightning network daemon (Scala implementation by Lightning Labs) ○ C-lightning (C) ○ Eclair (Go) ● Huge number of apps (LApps) have been built using these LN implementations: ○ FileBazar - A marketplace for images, video. ○ Lightning Tip - Tipping service in LN ○ HamerCoin - RPG that uses LN for payment

Slide 11

Slide 11 text

Sidechains ● Sidechain is a chain that runs parallel to the main blockchain ● Sidechain is attached to the main chain using 2 way peg ● Sidechain is permanent, unlike state channels ● A same asset can transacted between main chain and side chain ● Sidechain is responsible for its own security

Slide 12

Slide 12 text

A basic design ● Assets on the mainchain is locked up by sending it to a special address ● This is communicated to the sidechain ● Sidechain releases the similar assets once the assets are locked in mainchain ● Similar process can be carried out in the other direction 1.0 BTC 1.0 BTC

Slide 13

Slide 13 text

Sidechain implementations ● The sidechains are an independant chain with their own consensus mechanism ○ Example: Sidechain can run on proof-of-stake while mainchain uses proof-of-work ○ ● Several sidechains have been implemented for both Bitcoin and Ethereum: ○ Rootstock : ■ Smart contract platform on top of Bitcoin blockchain ■ Provides the same level of security as Bitcoin ■ Scales upto 100 TPS ○ Loom Network ■ Helping Ethereum to scale with a DPoS sidechain ■ Secured by Plasma on Ethereum ■ Several games have been built on this network

Slide 14

Slide 14 text

Other layer 1 scaling solutions ● Sharding ○ Provides solution to the Increasing size of blockchain ○ Ethereum is implementing sharding in the serenity release using PoS ● Improved consensus algorithms: ○ Variants of BFT (FBFT, DBFT) ○ PoS, DPoS, PoET, PoA

Slide 15

Slide 15 text

Contact me: Koshik Raj linkedIn: koshikraj GitHub: koshikraj twitter: rajkoshik [email protected] www.koshik.me “keep calm and scale blockchain”