LOOPRING 1.5 daniel@loopring.org alex@loopring.org jay@loopring.org Loopring Project Ltd foundation@loopring.org 2017 12 29 ERC20 dapp 1
2 1 3 2 3 3 5 3.1................................... 6 3.2................................ 6 3.3................................... 7 3.4................................... 7 3.4.1............................ 8 3.4.2................................. 8 3.4.3............................... 9 3.4.4......................... 10 3.5................................ 11 3.5.1.......................... 11 3.5.2............................ 11 3.5.3............................. 11 3.5.4.......................... 11 3.5.5............................... 12 3.6................................... 12 3.7................................... 12 3.8................................... 13 3.9................................... 14 4 Loopring LRC 14 4.1.................................. 14 4.2................................. 15 4.3.............................. 16 5 17 5.1 Loopring................... 17 6 18 7 19 22 A Loopring 22
1 3 1 [1][2] [3] [4][5] coinmarketcap.com 790 [6] ETH 170 Tokenization [7][5] Token [2] IOU IOU IOU 2014 2 Mt.Gox 85 [8] Mt.Gox 85 7000 2016 8 Bitfinex 119756 6500 2 Ripple BitShares Openledger Ripple [9] Ripple In-
2 4 terledger [10] ILP ILP Ripple BitShares [11][12] BitShares DEX BitShares Openledger[13] SmartCoins SmartCoins paypal Openledger BitShares 2.0 Graphene Toolkit Openledger Graphene Toolkit BitShares 2.0 [14] [15] Bancor[16] Logarithmic Market Scoring Rules LSMR [17] Bancor 0x [18] ERC20[19] dapps dapps dapps 0x dapps 0x taker 0x OTC 0x
3 5 3 1: Loopring Loopring 1. Loopring Loopring Matching Contract 1 1000 A 9 B 100 C 2. 1000 A 10 B A B 1000/10 = 100.0 3.7 3. 4. orderbook 5. Loopring 1 ERC20
3 6 6. Loopring Loopring Registration Contract Loopring Loopring Stats Contract 2: Loopring 7. 3.1 C i i O i j C i C j s i j C i b i j C j r i j O i j s i j /b i j s i j b i j 3.2 s i j = 0 Loopring s i j /b i j = s i j /b i j r i j = r i j
3 7 3.3 O i j O j k, C j Ci C k O i j k O i k s i j k = min(b i j, s j k ) r i j (1) b i j k = min(b i j, s j k )/r j k (2) r i j k = r i j r j k (3) n 1 n, n 1 O 0... n s 0 1 n = 1 s 0... n = min(b 0... n 1, s n 1 n ) r 0... n 1 n > 1 b 0 1 n = 1 b 0... n = min(b 0... n 1, s n 1 n )/r n 1 n n > 1 r 0... n = n 1 i=0 r i i+1 O i j C i C j O i... j O i j 3.4 Loopring 3.1 ( ) n C 0 C 1 C n 1 n O 0 1 O i i 1 O n 1 0 i 1 i + 1 mod n n
3 8 O 0 1 O i i 1 O n 1 0 n 3.4.1 3 C 0 C 1 C 2 O 0 1 O 1 2 O 2 0 r 0 1 r 1 2 r 2 0 = 1 r 0 1 r 1 2 r 2 0 > 1 Loopring γ r 0 1 (1 γ) r 1 2 (1 γ) r 2 0 (1 γ) r 0 1 (1 γ) r 1 2 (1 γ) r 2 0 (1 γ) = 1 (4) γ = 1 1 3 r0 1 r 1 2 r 2 0 n γ = 1 1 n n 1 i=0 ri r i i γ 0 i O i ˆr i = r i (1 γ) ˆr i r i 3.4.2 3.2 i ŝ ˆb ŝ i = s i ˆb i = ŝ i /ˆr i s i ; ŝ i 1 = ˆb i ˆb i 1 = ŝ i 1 /ˆr i 1 ; ŝ i 2 = ˆb i 1 ˆb i 2 = ŝ i 2 /ˆr i 2 ;...
3 9 3.4.3 Loopring LRC, m i i f i = b i m i /b i Loopring O i, b i b i b i, i = b i r i γ Loopring θ i Θ O i f i = i Θ = b i r i γ Θ n 1 F = b i r i γ Θ i=0 Loopring LRC m i m i = 0 100% Θ = 100% λ η n 1 F = (1 λ) (1 η) (b i r i γ Θ + b i m i /b i ) i=0 LRC LRC
3 10 Loopring 3.4.4 Loopring LRC n λ n = 0.05 (ln(n + e 1) 1) n λ 1 0% 2 1.57% 10 7.31% 20 10.39% 99 18.06% 100 18.11% 1000 29.55% 1001 30.00% 1: LRC 1001 30% λ 2 λ 1 λ 100 λ 99
3 11 3: LRC 3.5 3.5.1 Loopring Loopring O a b O b a r a b r b a > 1 O b c O c d O d b 5 r a b r b c r c d r d b r b a = 1 0 O a b O b a O b c O c d O d b Loopring 3.5.2 Loopring 3.5.3 3.5.4
3 12 3.5.5 h = H(r, nonce) H() r nonce nonce 3.6 3.3 ERC20 3.7 OTC Keccak SHA3 ECDSA message Order { address protocol; address owner; address outtoken; address intoken; uint256 outamount; uint256 inamount; unit256 expiration unit256 fee; // Loopring // // ERC20 // ERC20 // ERC20 // ERC20 // // LRC
3 13 } uint8 marginsplit; unit8 v; bytes32 r; bytes32 s; // outamount // fee 0 100% outamount/inamount r r UI outamount inamount outamount outamount outamount inamount message MatchRing { Order[] orders; // address feerecipient; // unit256 additionaldiscount; // - eta unit256 nonce; // unit8 v; bytes32 r; bytes32 s; } 3.8 inamount outamount inamount outamount 0 inamount outamount 0 balance balance outamount
4 LOOPRING LRC 14 max(balance, outamount) 3.9 Loopring Loopring Loopring Oracle Loopring dapp 4 Loopring LRC Loopring ERC20 LRC 4.1 LRC LRC ERC20 LRC 3.4.3
4 LOOPRING LRC 15 LRC 4.2 LRC S N CoinAge S = f(n, CoinAge) CoinAge = H c H s CoinAge H c H s CoinAge Loopring
4 LOOPRING LRC 16 4: Loopring Loopring 4.3 Loopring ERC20 Loopring LRC Loopring ERC20 LRC LRC fee 0
5 17 5 Loopring Loopring Loopring ERC20 ERC20 Loopring ERC20 Tokenization ERC20 5.1 Loopring Maker Taker Maker Taker Maker Maker Loopring Over- The-Counter OTC Loopring Loopring Loopring Loopring Trading Pair
6 18 A B B A Loopring Loopring 1 2 3 4 5 6 7 8 Maker Taker 9 10 11 2: 6 ERC20 Loopring 1 Loopring 2 Loopring 3 Loopring 4 Loopring 5 Loopring 6 Loopring 7 Loopring ERC20 8 Loopring Loopring 9 Loopring Maker 10 Loopring 11 Loopring
7 19 Loopring ERC20 EOS Loopring Loopring 7 ChinaLedger NEO Onchain CEO YOYOW CEO Redpoint Ventures X Alex Cheng IT Airbnb Zhen Wang
20 [1] Economist Staff. Blockchains: The great chain of being sure about things. The Economist. Retrieved, 18, 2016. [2] Melanie Swan. Blockchain: Blueprint for a new economy. O Reilly Media, Inc., 2015. [3] Satoshi Nakamoto. Bitcoin: A peer-to-peer electronic cash system. 2008. [4] Leslie Lamport, Robert Shostak, and Marshall Pease. The byzantine generals problem. ACM Transactions on Programming Languages and Systems (TOPLAS), 4(3):382 401, 1982. [5] Konstantinos Christidis and Michael Devetsikiotis. Blockchains and smart contracts for the internet of things. IEEE Access, 4:2292 2303, 2016. [6] Gavin Wood. Ethereum: A secure decentralised generalised transaction ledger. Ethereum Project Yellow Paper, 151, 2014. [7] Paul Tak Shing Liu. Medical record system using blockchain, big data and tokenization. In Information and Communications Security, pages 254 261. Springer, 2016. [8] Robert McMillan. The inside story of mt. gox, bitcoin s 460 dollar million disaster. 2014. [9] David Schwartz, Noah Youngs, and Arthur Britto. The ripple protocol consensus algorithm. Ripple Labs Inc White Paper, 5, 2014. [10] Stefan Thomas and Evan Schwartz. A protocol for interledger payments. URL https://interledger. org/interledger. pdf, 2015. [11] Fabian Schuh and Daniel Larimer. Bitshares 2.0: Financial smart contract platform. [12] Fabian Schuh and Daniel Larimer. Bitshares 2.0: General overview, 2015. [13] Open ledger. URL https://openledger.info/, 2017. [14] Joseph Poon and Thaddeus Dryja. The bitcoin lightning network. https://lightning. network, 2015. [15] Raiden network. URL http://raiden.network/, 2015. [16] Bancor protocol. URL https://bancor.network/, 2017. [17] Robin Hanson. Logarithmic markets coring rules for modular combinatorial information aggregation. The Journal of Prediction Markets, 1(1):3 15, 2012.
21 [18] Will Warren and Amir Bandeali. 0x: An open protocol for decentralized exchange on the ethereum blockchain, 2017. [19] Fabian Vogelsteller. Erc: Token standard. URL https://github.com /ethereum /EIPs /issues /20, 2015.
22 A Loopring 1. S1 Transaction 2. S2 3. S3 4. S4 3 5. S4.1 1-6. S4.2 2-1 7. S4.3 3-2 8. S5 9. S6 S5 S7 S9. 10. S7 11. S8 S7 S9 12. S9
A LOOPRING 23 13. S10 14. S11 15. S12 Step4.1, 4.2, 4.3 16. S13 4.2, 4.3 17. S14