PPY(peerplay)白皮书.pdf
Peerplays A Provably Fair Blockchain-Based Gaming Plat Jonathan Baha’i, Michael P. Maloney May 2016 Abstract The online betting and gambling industry has been constantly plagued with accusations of fraudandcheatingbybothplayersandsystemadministrators.IntheUnitedStatesalone,over a dozen online gaming sites have either gone bankrupt or been forcefully shut down by authorities since 2011, resultingintens of millions of dollars indeposits that haveyet tobe returned to players. Despite these setbacks, the industry continues to grow, and players continue to risk depositing their funds into centrally owned and operated gaming websites. Provably fair online gaming is badly needed. Enter Peerplays, a solution for provably fair blockchain-based gaming that allows users todesigntheir ownspecializedtokens or chips, buy or sell gateway tokens for popular cryptocurrencies likeBitcoinor Ether andthenwager these tokens in on-chain games. There is no “house” in Peerplays, but instead players are matched with other users for peer-to-peer gameplaythroughaseriesof smart contracts. Thesecontractsescrowthefunds wageredbyeachplayer andthenreleasethemtothewinner after specificconditionswithina gamearemet andverified. Smart contracts arebuilt directly intothenativeblockchaincode rather than a virtual scripting machine, which makes transaction processing fast enoughto enable millions of players to interact almost simultaneously. Table of Contents Introduction Blockchain Consensus Native Smart Contracts Provably Fair Gaming Profit Sharing Fee distribution Flowchart Mega-Jackpots and PowerUp Points Open Source GUI Trustless Asset Exchange Wagering Hosted Public Client Portals Server-Side Tournament Hosting Conclusion References Introduction A Peer-to-Peer Marketplace is an online exchange that brings people and/or businesses together to deal with each other directly without having to go through traditional slowand expensive multi-party networks. In thesemarketplaces, motivatedindividuals withresources and specific skills or talents can simply connect withwillingcustomers througha3rdparty “dispatch” service, consisting of either an online plat or mobile app to facilitate a commercial exchangeof goodsorservicesandpaymentbetweenthebuyerandseller.Airbnb, eBay,Etsy,Freelancer,Kickstarter,Mr.Delivery,andUberareexamplesofthemostsuccessful of Peer-to-Peer networking models today. Withtheadvent of blockchaintechnologies, andspecificallytheplatcalledGraphene,itis nowpossibletolaunchapeer-to-peer dispatchservicethat runs almost entirely onits own. Grapheneisanopen-source, MITlicensed, decentralizedblockchaintechnologythatutilizesa Delegated Proof of Stake DPoS consensus mechanism, which leverages the power of stakeholder voting to resolve consensus issues in a fair and democratic way. Commercial interactions between users facilitated by Graphenearecheaper andfaster thanatraditional companyduetogreatlyreducedoverheadcosts, whilemembershipandoperationalcriteriais still flexible enough to grow and adapt through a democratic process. Even better, all actions on the blockchain are publicly accessible for audit and verification, eliminating the possibility of cheating. Andsincedecentralizedblockchains cannot easily be turnedoff or shut downbyexternalagencies,blockchain-basedcompaniesmaybeamongthe first organizations inhistory toenjoy completeglobal autonomy. This has recentlysparkeda worldwidemovement topromoteandexploreblockchaintechnologiesasapotential catalyst for new social, political, cooperative, and for-profit business models. One such model addressed by Peerplays is the creation of a provably fair and auditable gaming plat, because the online betting and gambling industry has been constantly plaguedwithaccusations of fraudandcheatingby bothplayers andsystemadministrators.1 Peerplays alsooffers analternativefor payment processingof wagers, as thecurrent legacy systemofteninvolvescomplexlegalcompliancehurdleswhichhavetobedealtwithseparately in each country of operation.2 If payment processing can be outsourcedtoadecentralized blockchain, 3rdpartygamingpartnerscanunburdenthemselvesinwaysthatlowerthebarrier to entry into the marketplace. Blockchain Consensus Graphene, thetechnology behindPeerplays, is thesameplatusedbyBitShares, Steem, andMuse. It currentlyoffersthefastest blockproductiontimesandthehighest throughput of any decentralized blockchain consensus mechanismavailable- supporting3secondblocks and a potential throughput capacity of over 100,000 transactions per second.3 On a Graphene-based blockchain, stakeholders elect trusted signing “witnesses”, andaperiodic, randomly chosen deterministic block signing order allows each witness toknowwhentheir turn to sign is approaching. Thus, block production speedis only limitedby thebandwidth capacityof thesigningnodesandthespeedof light -whichisabout1secondforapacketto circletheglobe- meaningahighbandwidthnetwork couldachieveabout 1secondaverage block times. The high throughput capacity of a Graphene-based blockchain is due to a number of architectural specifications modelledafter theLMAXonlineFXtrading exchange, whichhas achieved upwards of 6 million transactions per second TPS.4 Some of these highly streamlineddesignparametersincludethelimitingofthecorebusinesslogictoasinglethread, theremovingofcryptographicoperationshashesandsignaturesfromthecorebusinesslogic, the division of validation into state-dependent and state-independent checks, theuseof an object oriented data model, and keeping databases memory-resident.5 AddingnewfeaturestoaGrapheneblockchainrequiresstakeholderapproval,butthisprocess is a largely seamless experience for users because most will use the lightweight or hosted clients, andonly full nodes arerequiredtoupgrade. OntheBitShares network, for example, hard forks usually take a few hours and disruption for most users is minimal to none. Native Smart Contracts Here is what Daniel Larimer, lead developer for Graphene, says about running Smart Contracts on Graphene The BitShares Decentralized Asset Exchange uses an order matching algorithmwhich is a wonderful exampleof onesuch“natively supported” smart contract.6Thisfeatureallowsbuy and sell orders between users to be filled instantly and has been proven in stress tests to handlethousandsof uniquetransactionsper second.7Furthermore,wecanusetheanalogyof “openingandfillingorders” withinamarketplacetodescribePeerplaysplayer matching-the operationthroughwhichplayersinteract withoneanother usingthegamingtournamentsmart contracts. Tobegintheprocess, eachplayer opensan“order”whichisthenacceptedand“filled”bythe appropriate on-chain smart contract. The smart contract then matches pairs or groups of playerstogether, arbitratesthetermsandrulesof thegamebetweenplayersandreleasesthe funds to the winner. We have coined the term Peerplays Marketplace to describe this feature. Step1 APlayer opens/broadcastsanOffer toContract,henceforthreferredtoasOTC, intothePeerplays Marketplace. EachOTCcontains theappropriatefundstobuy-into thedesiredgame, aswell asother datarequiredtodefinethetermsinwhichhewishes to engage in the desired game or tournament. Step 2 OTCs are matched by a player matching order matching algorithm. Step 3 After players are matched, game play begins and players voluntarily interact compete witheachother tofulfill theconditionsset forthbytherulesof theparticular game or tournament and their agreement with the Smart Contract. Step4 Funds areunlockedby theSmart Contract andsent tothewinner, minusany fees whichtheblockchainautomatically distributes totheappropriateplacesviaprofit sharing section 4. Additionally, anessential element for mostgamesonPeerplaysincludestheon-chainRandom Number Generator RNG and shuffle programwhich cangeneratenumbers whicharethen encryptedtoaplayer’sprivate/publickeypairingandpublishedontheblockchain.Playersare then able to publish or reveal blinded cryptographicsignatures to“prove” their positions or holdings inthegame, andfast andreliableblocktimesmeanstheycandosowiththespeed and frequency necessary to facilitate real-time gameplay for on-chain casino card games, popular board games, and other games of skill. Provably Fair Gaming Peerplays is a universally auditable plat. All smart contracts arewritteninopen-source code, soit is easy toverify that theyarefunctioningasadvertised. BybroadcastinganOTC, eachplayer essentially entersintoan“arbitrationagreement”withtheblockchain, after which time their only recourse is to follow the rules. The release of escrowed funds is always dependent onvoluntarymovesorlackthereofonthepartofeachplayer,sofailuretoper these actions in a timely manner, or failure to produce the “winning hand” automatically removes a player’s eligibility to receive the jackpot payout. Bywayofexplanation,letuscreateahypotheticalgamecalledHighCard.Herearetherulesof this game Two players place an initial wager ante, and then each is dealt asinglecardfroma52card deck. After eachplayer looksat her card, aroundofbettingensues,oreitherplayercanfold.If both remain, then each reveals their card and the highest card wins. Note suits would also have to be ranked fromhigh to low, for example diamonds low, then clubs, thenhearts, and then spades high. Toplay this gameonPeerplays, eachplayer opens anOTCfor thegamewhichincludesthe appropriateante. After theyarematched, thesmart contractlocksuptheirfundsandtheRNG deals each of thema card “face down” - meaning each player’s cardis publishedonthe blockchain but encrypted to their private/public key pair. Then, theyareeachbeabletoviewtheir individual cardswithout revealingittotheother,and maketheir decisionsonwhether tobetorfold.Bettinginvolvessendingadditionalfundstothe smart contract toescrow. If either player folds, thenthesmart contract releasesthefundsto theother player. If onebetsandtheother calls, or if bothpassontheroundofbetting,thenit is time to reveal the cards. Todothis, eachuser must publishthedecryptedversionof their secret, whichcanthenbe proved to be equal to the encrypted version by re-encrypting it with their public key. This “proof” is validated automatically by the blockchain code when the user publishes the decryptedversion.Thesmartcontractthenawardsthefundstotheplayerwiththehighercard. If either player failstoreveal their proof withinacertaintimelimit,theyautomaticallyforfeitthe jackpot. At launch, Peerplayswill allowplayerstochoosesingle-eliminationtournamentbracketswhich facilitatemulti-player tournamentsbypairingoffplayersinhead-to-headcompetitionthrougha seriesof rounds. Therandomizedplayer matchingalgorithmwill prevent or greatlyreducethe abilityfor playerstocollude, andindividual head-to-headgamesarenotsubjecttocollusionin the same way as multi-player tables. Thesearejust afewof thebasictoolsandfeatureswhichwillbeavailableonPeerplays.Using onlythesefunctionswehaveoutlinedhere, analmostunlimitedvarietyofon-chaingamescan be written and implemented. Profit Sharing ThePeerplays network earns revenuefromvariousoperationslikethecreationandtradingof digital asset tokens by users, and the perance of certain customoperations, but most notably fromtherake- whichisapercentageof eachjackpot deductedasafee. Thismodel allows thenetwork tofinancially benefit fromthetrustlessarbitrationof eachtournament and thus prevents Peerplays from having to act as a “house” and bet against its users. Every time a fee is collected, the blockchain automatically splits it into a virtual account governed by a smart contract which distributes the fees in three directions. The largest percentageis distributedat regular intervals intotheaccountsof Peerplayscoretoken holders as profit sharing. This means that core token holders receive a portion of every jackpot paidinanyof thecertifiedwageringinstruments, alongwithaportionoftherestofthe network fees. Another termfor thecoretokens is Fee-BackedAssetsor FBAs, becausethey entitletheholder toaportionofthefeescollectedbythenetwork.8Thenextportionisdirected towardsblockchainmaintenance, suchasforpayingblockproducersandfixingbugs.Andthe third portion is sent to the Mega-Jackpot virtual accumulation account outlinedinthenext section. AllofthesefeesandpercentagesaredeterminedbytheelectedPeerplaysCommittee members, who are voted for by the Peerplays token holders. Theflowchartbelowexplainshowplayer’sfeesaredistributedNote Hosted clients never have control over players funds, they merely offer an “access point” into Peerplays. Mega-Jackpots and PowerUp Points Mega-Jackpot tournaments areaway for thePeerplays network tooccasionallybecomethe sponsor of large tournament jackpots by utilizing the network’s unique “profit sharing” capabilities. Peerplays automatically allocates asmall percentageof everynetworkfeeintoa smart contract-secured virtual account called the Mega-Jackpot Fund. This smart contract thenautomatically schedules andhosts Mega-Jackpot tournament events, andthefundsare unlocked and instantly transferred to the tournament winners. PowerUp points are the user-reward tokens of the Peerplays network, and are distributed according to win-loss records and amounts wagered, amo