Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Quorum Consortium Network in Azure Marketplace CaleTeeter|SeniorSDEDX/TED
Overview ThenextphaseofsupportandintegrationoftheQuorumblockchainsolutioninMicrosoftAzureisthereleaseoftheQuorumConsortiumNetworkintheAzureMarketplace.ThegoalofthisofferingismakeiteasyforusertocreatetheinfrastructureandconfigurationinordertorunQuorumbysupplyingafewparametersandsingleclientfordeployment.WhiletheinitialQuorumdemoofferingwasagoodwaytoshowcasethefundamentalsofhowQuorumfunctionsandisdifferentfromothersinthemarket,thisnewofferingallowsuserstobuildanddeployafullnetworkwithmultipleunderlyingvirtualmachines,virtualnetwork,loadbalancing,andnetworksecurity,andsimplemanagementviathenativeCakeshoptooling.
Afterreadingthisarticle,youwill
• UnderstandwhatthenewofferingofQuorumConsortiumNetworkarchitectureiscomprisedofandhowitcanbedeployedbysimplyprovidingafewparameters.
• LearnhowtodeploytheQuorumConsortiumNetworkandactivitiestodopostdeploymenttogetstartedwithusingthisoffering.
About Quorum blockchain Whiletherearevarioustypesofblockchainsonthemarkettoday,andmorebeingcreatedeveryday,Quorumisuniqueinafewdifferentways.Tostartfromthecore,Quorumisfundamentally,aforkofthegoEthereumclient.ThismeansthatitisinfactavariantoftheEthereumprotocol.ThiswascreatedbyateamatJPMorganChase,withtheintentionofprovidingablockchainthatcanbeusedbyenterprise,addressingsomethefeaturesthatwereneededbeyondwhatEthereumbaseprotocolcouldprovide.Specifically,themodificationsweretoaddressthefollowing:
• Needforadifferentconsensusalgorithmandmodeltoavoidthechallengesthatminingpresentsinasemi-trustedprivateEthereumnetwork.
• Needforselectiveprivacyoftransactionstoallowmultiplepartiestouseasingleblockchain,butdiscloseonlytransactionsdetailstospecificparticipants.
BasedonfeedbackfromenterprisesandinfactrequirementsthatJPMorganChasewasaddressingfortheirownuse,thesenewfeatureswereaddedviaamodifiedgo-ethereumclientandtheuseofconstellation,orprivatetransactionmanagers.Theseadditionsarebuilttobetheleastintrusiveapproachtoimplement,meaningtheteamdidsetouttoreinventanewblockchain,andinsteadmodifiedtheexistingtechnologies.Thespecificimplementationisthefollowing:
• QuorumChain–anewconsensusmodelbasedonmajorityvoting,thisisalsoraft-basedtoensurefasterblocktimes,transactionfinality,andon-demandblockcreation
• Constellation–apeertopeerencryptedmessagedexchange• PeerSecurity–node/peerpermissioningusingsmartcontracts
Architecture TogetabitdeeperintothearchitectureofhowQuorumfunctionsaswellashowthisdeployedinanoptimalwaytoAzure.AsmentionedaboveQuorumisanEthereumbasedblockchainwithsomespecificnewfeatures.
Consensus
Whiletheultimategoalispluggableconsensusmodels,thecurrentimplementationisamodelnamedQuorumChain,whichisatime-based,majorityvotingalgorithm.Thisiscomprisedofafewdifferentpieces.
• Smartcontractbasedmodeltogovernconsensusandmanagethenodesthatcanparticipateasvoters.
• Ethereumtransactionstopropagatevotesthroughthenetwork.• EthereumsignaturevalidationtovalidatesignaturesreceivedfromMakerandVoternodes
ThenodesintheQuorumnetwork,canbedesignatedasaVoterrole,whichallowsthemtovoteonwhichblockshouldbethecanonicalheadataparticularheight.Themostrecentblockwiththemostvotesisconsideredthecanonicalheadoftheblockchain.Ablockisconsideredvalidonceishasenoughvotestoovercomethethresholddefinedforvotes.
BlocksarecreatedonlybynodeswiththeroleofMakerrole.NodesthatholdthisrolecancreateblocksandsignthembysettingtheirsignatureintheExtraDatafieldontheblock.Whentheblockinimportedtothenetwork/chain,theysignatureisvalidatedbyothernodestoensurethesigner’saddressinpresentintheMarkerlist(whitelist)inthevotingcontract.
TodelveabitdeeperthesmartcontracttogoverntheVotersandMakersisnamedBlockVotingandisdeployedtoaddress0x0000000000000000000000000000000000000020withinthegenesisblock.ThecontractishardcodedintotheQuorumclientviatheaddressandtheABIforthecontract.Thismeansiftheconsensusrulesforvotingneedstochange,thisQuorumclientwillneedtobeupdatedinconcertwiththesmartcontractthatdrivesthis.
Thereexistfunctionsinthisvotingcontracttoadd/removeVoterandMakernodesaswellasthethresholdforhowmanyvotesareneededtoconfirmablock.Italsovalidatesthatvotesfromvotersarefromvalidvotersinthesamewayasvalidationofmakersisvalidated.
MakernodesareresponsibleformintingnewblocksandtheiraddressesontheEthereumnetworkarewhitelistedinthissmartcontract.Theremustbeataminimum1Makerdefinedforthesystemtowork.TheinitialMakernodesarecreated/definedinthegenesisblock,buttheadditionandremovalcanbedonepostblockchaincreation.
Thereisathirdnodetype/roleinthenetwork,whichistheObserverrole.ThesearesimplynodesthatarenotofroleVoterorMaker,andwillnotmintblocksorvote,butsimplyreceiveandvalidateblocks.
Blocksaremadebymakers,andtoavoidmultipleMakerscreatingablockatthesametime,eachmakerwillusearandomvalueinsideathresholddefineforthemakerof(min/max)timetocreateablock.Thisrandomizationwilleventuallymeanamakerwillrecognizeitistimeforthemtocreateanewblock.WhenaMakermakesablock,otherMakerswillbenotifiedandresettheirtimersforwhentheywill
createablock.ThisisdefinedintheVotingsmartcontractdefinedaboveandcanbesetatgethstartupviacommandlineparameters,minblocktimeandmaxblocktimetimeinseconds.
NOTE:Inthecurrentimplementation,theMakerisalsoaVotertoavoidasituationwherelimitedonlineVoters,couldcausechain-halting.
Transaction Processing AnotherkeydifferentiatorwithQuorumisthefactthatthechaincanincludetransactionprivacyrules.Toexplainthisfurther,transactionscanbethoughtofaspublicorprivate.ItsimportanttounderstandthatQuoruminnotintroductionanewtransactiontypetoEthereumbutusingtheexistingtransactionmodelforpublictransactions,andextendingEthereumtosupportanew(optional)parameternamedprivateFor,whichwillbeusedtodesignatewhomshouldbeabletoviewthistransaction.
FirstpublictransactionsaretransactionsinwhichthepayloadisvisibletoallparticipantsoftheblockchainorQuorumnetwork.TheseareexactlythesameastransactionsusedinEthereumonothernetworks,nochanges.
NOTE:Thecontexthereandname“public”transactionsdoesnotimplythatthesetransactionsareonthepublicEthereumnetwork(network1).ThesetransactionsareonlyontheprivateQuorumnetwork,thenameisusedsimplytomeanthatthepayloadsofthesetransactionsarenotprivateandcanbeviewedbyallparticipants.
Theothertypeoftransactionisprivatetransactions,andtheseexposetheirpayloadsonlytotheparticipantsonthenetworkwhosepublickeysarespecifiedintheprivateForparameterofthetransaction.
NOTE:TheprivateForparameterisanarrayandcancontainalistofcommaseparatedkeysthatshouldbeabletoviewthetransaction.
Executionofthesetypesoftransactionsaredifferentaswell.PublictransactionsareexecutedinthesamewaystandardEthereumtransactions,eachnodewillexecutethecontractcodeandupdatethestateofthecontract.Forprivatetransactions,thingsarehandledabitdifferently.PriortotheQuorumnodepropagatingthetransactiontotherestofthenetwork,itreplacesthepayloadwithahashoftheencryptedpayloadthatisreceivesfromconstellation.Participantsonthenetworkthathavetheirpublickeyincludedinthetransaction,willbeabletoreplacethehashwiththeactualpayload(unencrypted)viatheirinstanceofconstellation,whileparticipantswhomarenotincludedinthetransaction,willonlyseethehash.Thisresultsinparticipantswhoarenotpartytoseethetransactiontojustskipit,andnotperformanoperation,thosewhomareinvolvedwillreplacethehashwiththeoriginalpayloadandhavetheEVMexecuteit,andupdatetheirstate.
Thiscouldresultintwodifferentstatesbasedonwhethertheparticipantispartytothetransactionornot,andtoaddressthisQuorummaintainsyncfromthepublic“trie”ofstatetotheprivate“trie”.Thepublictrieisgloballysynced,butprivatetrieisnot.
Getting Started Tobegin,youwillneedanAzuresubscriptionthatwillbeusedtodeploythevirtualmachine.IfyoudonothaveanAzuresubscription,youcancreateafreeAzureaccounttobegin.Becausethisdeploymentwillonlyrequireasinglevirtualmachine,thereisnoneedtoincreasequotasforyoursubscription.
Onceyouhaveasubscription,gototheAzureportal.Selectthe‘+’symbolinthetopleftoftheportal,andinthepanethatappears,inthesearchbox,enter‘QuorumConsortiumNetwork’.
SelectthetemplatethatisreturnedinthesearchresultstotakeyoutotheQuorumConsortiumNetworkdeploymentwizardandthenclick‘Create’.Thiswillopenthe‘Basics’bladeinthewizard.
Thetemplatedeploymentwillpromptyouforasetofsimpleinputstoconfigurethedeploymentproperly.Onthefirststep,the‘Basics’blade,specifythevaluesforstandardparameterssuchassubscription,resourcegroup,andbasicvirtualmachineproperties.
Adetaileddescriptionofeachparameterfollows:
Basics ParameterName Description AllowedValues DefaultValueResourcePrefix Aprefixvaluethat
prependedtoresourcenamestoensureuniqueness.
Thevalueis6orlessalphanumericcharacters
NA
VMusername Theusernameoftheadministratorforthedeployedvirtualmachine.
Thevaluemustbebetween1and64charactersinlength.
NA
AuthenticationType Themethodusedtoauthenticatetothevirtualmachine.Usernameandpasswordorusername/sshkey.
PasswordorSSHpublickey SSHpublickey
RestrictaccessbyIPaddress
UsedtorestrictaccesstoallendpointsfromaspecificIPaddressorsubnet
YesorNo No
Subscription Thesubscriptioninwhichtodeploy.
Validsubscription Currentsubscription
ResourceGroup Theresourcegroupinwhichtodeploy.
Createneworuseexisting.Fornew,thevaluemustbe1and90charactersinlength.
NA
Location TheAzureregioninwhichtodeploy.
ListofvalidAzureregions. Currentregion.
Asampledeploymentisshownbelow:
Network Size and Performance ParameterName Description AllowedValues DefaultValueConsortiumMemberId
Setthememberidfortheparticipant.Inamulti-membernetwork,eachmembershouldhaveauniqueid
0-15 0
Numberofblockmakers
Quantityofblockmakernodeswhichwillcreateandproposeblockstothenetwork.(Currentlylimitedto1)
1 1
Numberofvoters Quantityofvoternodeswhichwillvalidateandvoteonblockconfirmations.
1-9 1
Numberofobservers Quantityofobservernodeswhichwillvalidatetransactionsonly.
0-9 0
Storageperformance Performanceofunderlyingstorage(StandardisHDDbackedandPremiumisSSD)
StandardorPremium Standard
VirtualMachineSize Choosetheappropriatesizeofvirtualmachine.
NA Recommendedsizesaredisplayed.
Quorum Specific Settings ParameterName Description AllowedValues DefaultValueNetworkID IDoftheunderlying
Ethereumnetwork.Peerscanonlycommunicateinthesamenetwork.
Numericvalueupto9digits
10101010
Ethereumaccountpassword
PasswordusedtosecurethedefaultEthereumaccountthatwillbegenerated
12charactersormorewithaminimumof1lowercase,1uppercase,and1number.Doublequotesnotallowed.
N/A
ConfirmPassword ConfirmationofpasswordforEthereumaccount
12charactersormorewithaminimumof1lowercase,1uppercase,and1number.Doublequotesnotallowed.
N/A
Passphraseforkeygeneration
PassphraseusedtogeneratetheprivatekeyassociatedwiththedefaultEthereumaccountthatisgenerated.
12charactersormorewithaminimumof1lowercase,1uppercase,and1number.Doublequotesnotallowed.
N/A
ConfirmPassword Confirmationofpassphraseforkeygeneration
12charactersormorewithaminimumof1lowercase,1uppercase,and1number.Doublequotesnotallowed.
N/A
Asampleofthisbladeisbelow:
Clickthroughthesummaryblade,whichdisplaystheinputsthathavebeenprovidedforthedeploymentofthevirtualmachine.Thisalsovalidatesthesubscriptionandtheinputstoensurethedeploymentvalueswillnotcauseanexceptioninprovisioning.
Finally,reviewthelegalandprivacytermsandclick‘Purchase’todeploy.Thistypicallytakesafewminutestocomplete.
Post Deployment Quorum Consortium Network AfterthedeploymentoftheQuorumConsortiumNetwork,theassetscreatedduringthedeploymentwillbefullyconfiguredandreadyforuse.Asdescribedabove,theinfrastructuredeployedinAzurewilldeployallvirtualmachinesasinglevirtualnetworkandasinglesubnetinsidethatnetwork.Anetworksecuritygroupwillbeprovisionedthatwillprovidethefollowingrules:
• BlockoutboundpeertopeertrafficforEthereumnodes.Thisisolatedthenodesfromthepublicblockchains.
• AllowSSH,administrativewebsiteandcakeshopsitesaccessfrompublicinternet.
Asingleloadbalancerwillbedeployedwhichwillbetheonlyendpointexposedtotheinternetbydefaultandwillroundrobindirecttraffictheblockmakers,votersandobservers.
Connect to the Administrative Web Site for the Quorum Network Toviewthenetworknodesthathavebeencreated,afterdeploymenttheadministrativewebsitewillsurfacetheinformationaboutthestatusofthesenodes.Thiscanbeaccessedbynavigatingtoyourpublicipaddressforthenetwork.Thiscanbefoundbyreadingtheoutputparametersthatweregeneratedwhenthenetworkwascreated.
Navigatetothesitehere,whichwillbenamedbasedontheparameterspassedatdeploymenttime.
Thereareseveralimportantpiecesofinformationherethatshouldbenotedforuselater.Allnodesarelistedontheuppersection,alongwiththeirhostname,alinktothemanagementinterfaceofcakeshopforthenode,thetotalpeersthenodeiscommunicatingwith,thelatestblocknumberandthepublickeyforthenode(usedforprivatetransactions).
Onthebottomhalfoftheinterface,youwillseeafieldthatwillacceptarecipientaddressofanaccountintheEthereumnetwork.Thisisprimarilyusedto“fund”newaccountsthatarecreatedinthenetwork.ThisavoidstheneedtoSSHtothenodesandattachtothegethprocessinordertocreate/fundnewaccounts.
Deploying a smart contract and creating private transactions Bydefault,thereareseveralaccountscreated(Ethereumexternalaccounts).Thesecanbeusedtointeractwiththeblockchain.Toviewtheseaccounts,clickontheurlforcakeshopfortheblockmakernode.
ThiswillopenCakeshop,whichisanIDE/monitoringtoolcreatedbyJPMorganChasetoviewthenetworkbasedonthenodeyouhaveclickedon.Itdisplaysavarietyofinformationaboutthenetwork,peers,etc.First,wecanviewtheaccountsthatexistonournetworkbyclickingonwalletsontheleftnavigationbar.
Nextwecandeployasmartcontractandorchestrateatransaction.First,navigatebacktotheadminpageandcopythepublickeyforanode.Inthenodesdisplayedhere,wewillcopythepublickeyforthevotingnodetoyourclipboardbyrightclickandcopy.
NextnavigatetotheCakeshopinstanceontheblockmaker.
NextnavigatetotheSandboxarea,whichisfoundontheleftnavigationpane.
Whenthistabopens,theinterfacewilldisplayanexamplesmartcontractontheleftsideofthescreenandsomecontrolsontherightside.Wewilldeployanewsmartcontract,usingthepublickeythatwe
copiedinthepreviousstep.OntherightsideofscreenselectthedropdownforFromDeployedContracts
SelecttheSimpleStoragecontractthere,andatthebottomfillinanintegerforthesetfunctionandclicktransact.Thiswillcreateatransaction,targetingtheSimpleStoragesmartcontractwhichwaspre-deployedtotheblockchain,andtheresultswillbedisplayedinthePaperTapesection.AfterafewsecondsthetransactionshouldclearandtheContractstatewillbeupdated.
ThisdemonstratescreatingapublictransactiontoanexistingsmartcontractontheQuorumnetwork.Nextwecandemonstratedeployinganewsmartcontractandusingaprivatetransaction.Tostartthis,ontheleftsideofthescreenchangethenameofthesmartcontractandconstructor.
Nextontherightsideofthescreen,selectthedropdownnamedOrDeployFromEditor:.Thenameofyournewsmartcontractwillbeshownhere.
Directlyunderthisdropdown,2textboxesaretheretoaddavaluetoinitializethestateofthesmartcontractaswellasthearrayofpublickeystoattachtothis.EnteravalueintheinitValfield(integer)andthepublickeycopiedinpreviousstepandclickdeploy.