[{"data":1,"prerenderedAt":1412},["Reactive",2],{"content-query-NHbz7JZJD1":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"body":10,"_type":1407,"_id":1408,"_source":1409,"_file":1410,"_extension":1411},"/docs/dev/beam-shaders/using-beam-shaders-with-cli-wallet-masternet","beam-shaders",false,"","Using Beam Shaders with CLI Wallet (masternet)","This document describes how to use Beam Shaders with CLI wallet running on a local network.",{"type":11,"children":12,"toc":1400},"root",[13,21,68,75,96,101,127,140,146,227,256,262,274,283,288,293,301,306,921,948,1045,1079,1087,1116,1121,1137,1143,1150,1155,1200,1212,1220,1232,1240,1246,1265,1276,1284,1289,1297,1317,1323,1394],{"type":14,"tag":15,"props":16,"children":18},"element","h1",{"id":17},"using-beam-shaders-with-cli-wallet-masternet",[19],{"type":20,"value":8},"text",{"type":14,"tag":22,"props":23,"children":24},"p",{},[25,31,33,45,46],{"type":14,"tag":26,"props":27,"children":28},"em",{},[29],{"type":20,"value":30},"All examples refer to a sample application \"mydapp\" which has two",{"type":20,"value":32}," ",{"type":14,"tag":34,"props":35,"children":39},"a",{"href":36,"rel":37},"https://github.com/BeamMW/beam/tree/master/bvm/Shaders/vault",[38],"nofollow",[40],{"type":14,"tag":26,"props":41,"children":42},{},[43],{"type":20,"value":44},"Vault",{"type":20,"value":32},{"type":14,"tag":26,"props":47,"children":48},{},[49,51,58,60,66],{"type":20,"value":50},"Shaders: App Shader (",{"type":14,"tag":52,"props":53,"children":55},"code",{"className":54},[],[56],{"type":20,"value":57},"app.wasm",{"type":20,"value":59},") and Contract Shader (",{"type":14,"tag":52,"props":61,"children":63},{"className":62},[],[64],{"type":20,"value":65},"contract.wasm",{"type":20,"value":67},").",{"type":14,"tag":69,"props":70,"children":72},"h3",{"id":71},"overview",[73],{"type":20,"value":74},"Overview",{"type":14,"tag":22,"props":76,"children":77},{},[78,80,86,88,94],{"type":20,"value":79},"Beam shaders support requires ",{"type":14,"tag":52,"props":81,"children":83},{"className":82},[],[84],{"type":20,"value":85},"Fork3",{"type":20,"value":87}," and at least ",{"type":14,"tag":52,"props":89,"children":91},{"className":90},[],[92],{"type":20,"value":93},"v6.0",{"type":20,"value":95}," CLI.",{"type":14,"tag":22,"props":97,"children":98},{},[99],{"type":20,"value":100},"There are two types of Shaders in Beam:",{"type":14,"tag":102,"props":103,"children":104},"ul",{},[105,117],{"type":14,"tag":106,"props":107,"children":108},"li",{},[109,115],{"type":14,"tag":110,"props":111,"children":112},"strong",{},[113],{"type":20,"value":114},"Contract Shader",{"type":20,"value":116}," - implements Smart Contract functionality, is stored on the blockchain and are running on Beam nodes.",{"type":14,"tag":106,"props":118,"children":119},{},[120,125],{"type":14,"tag":110,"props":121,"children":122},{},[123],{"type":20,"value":124},"App Shader",{"type":20,"value":126}," - implements Smart Contract API and is running in Beam wallet.",{"type":14,"tag":22,"props":128,"children":129},{},[130,132,138],{"type":20,"value":131},"To perform any transactions with shaders, you must specify the ",{"type":14,"tag":52,"props":133,"children":135},{"className":134},[],[136],{"type":20,"value":137},"shader",{"type":20,"value":139}," command.",{"type":14,"tag":69,"props":141,"children":143},{"id":142},"prerequisites",[144],{"type":20,"value":145},"Prerequisites",{"type":14,"tag":147,"props":148,"children":149},"ol",{},[150,196,209,222],{"type":14,"tag":106,"props":151,"children":152},{},[153,155,161,163,167,172,174,180,182,188,189,194],{"type":20,"value":154},"Make sure you have node running and connected to ",{"type":14,"tag":34,"props":156,"children":158},{"href":157},"broken-reference",[159],{"type":20,"value":160},"local network",{"type":20,"value":162},".",{"type":14,"tag":164,"props":165,"children":166},"br",{},[],{"type":14,"tag":110,"props":168,"children":169},{},[170],{"type":20,"value":171},"Notice:",{"type":20,"value":173}," Shaders are applied after the third fork with height 1500. Therefore, for faster testing, we recommend to define lower heights using the ",{"type":14,"tag":52,"props":175,"children":177},{"className":176},[],[178],{"type":20,"value":179},"Fork1",{"type":20,"value":181},", ",{"type":14,"tag":52,"props":183,"children":185},{"className":184},[],[186],{"type":20,"value":187},"Fork2",{"type":20,"value":181},{"type":14,"tag":52,"props":190,"children":192},{"className":191},[],[193],{"type":20,"value":85},{"type":20,"value":195}," attributes.",{"type":14,"tag":106,"props":197,"children":198},{},[199,201,207],{"type":20,"value":200},"Create at least one Beam node with ",{"type":14,"tag":52,"props":202,"children":204},{"className":203},[],[205],{"type":20,"value":206},"--peer=\u003Cip:port of the first node>",{"type":20,"value":208}," for the transaction replication.",{"type":14,"tag":106,"props":210,"children":211},{},[212,214,220],{"type":20,"value":213},"Make sure you have Beam ",{"type":14,"tag":34,"props":215,"children":217},{"href":216},"../beam-wallets/command-line-wallet",[218],{"type":20,"value":219},"CLI wallet",{"type":20,"value":221}," connected to your Beam node.",{"type":14,"tag":106,"props":223,"children":224},{},[225],{"type":20,"value":226},"You must have funds in your wallet to pay the fee.",{"type":14,"tag":22,"props":228,"children":229},{},[230,232,238,240,246,248,254],{"type":20,"value":231},"Since this tutorial is based on a local network, each command must be specified with the ",{"type":14,"tag":52,"props":233,"children":235},{"className":234},[],[236],{"type":20,"value":237},"--FakePoW=1",{"type":20,"value":239}," flag. For convenience we recommend adding this flag to your ",{"type":14,"tag":52,"props":241,"children":243},{"className":242},[],[244],{"type":20,"value":245},"beam-node.cfg",{"type":20,"value":247}," and ",{"type":14,"tag":52,"props":249,"children":251},{"className":250},[],[252],{"type":20,"value":253},"beam-wallet.cfg",{"type":20,"value":255}," files.",{"type":14,"tag":69,"props":257,"children":259},{"id":258},"shader-api",[260],{"type":20,"value":261},"Shader API",{"type":14,"tag":22,"props":263,"children":264},{},[265,267,272],{"type":20,"value":266},"First of all, you need to know the available actions of a contract. To see all commands supported by the App Shader enter the following command with ",{"type":14,"tag":52,"props":268,"children":270},{"className":269},[],[271],{"type":20,"value":137},{"type":20,"value":273}," command:",{"type":14,"tag":275,"props":276,"children":278},"pre",{"code":277},"./beam-wallet-masternet shader --pass=1 --shader_app_file=mydapp/app.wasm -n localhost:10000\n",[279],{"type":14,"tag":52,"props":280,"children":281},{"__ignoreMap":7},[282],{"type":20,"value":277},{"type":14,"tag":22,"props":284,"children":285},{},[286],{"type":20,"value":287},"You need to specify your wallet password, shader application file and node address.",{"type":14,"tag":22,"props":289,"children":290},{},[291],{"type":20,"value":292},"The output is a json format line:",{"type":14,"tag":275,"props":294,"children":296},{"code":295},"Shader output: {\"roles\": {\"manager\": {\"create\": {},\"destroy\": {\"cid\": \"ContractID\"},\"view\": {},\"view_logs\": {\"cid\": \"ContractID\"},\"view_accounts\": {\"cid\": \"ContractID\"},\"view_account\": {\"cid\": \"ContractID\",\"pubKey\": \"PubKey\"}},\"my_account\": {\"view\": {\"cid\": \"ContractID\"},\"get_key\": {\"cid\": \"ContractID\"},\"get_proof\": {\"cid\": \"ContractID\",\"aid\": \"AssetID\"},\"deposit\": {\"cid\": \"ContractID\",\"pkForeign\": \"PubKey\",\"bCoSigner\": \"uint32_t\",\"amount\": \"Amount\",\"aid\": \"AssetID\"},\"withdraw\": {\"cid\": \"ContractID\",\"pkForeign\": \"PubKey\",\"bCoSigner\": \"uint32_t\",\"amount\": \"Amount\",\"aid\": \"AssetID\"}}}}\n",[297],{"type":14,"tag":52,"props":298,"children":299},{"__ignoreMap":7},[300],{"type":20,"value":295},{"type":14,"tag":22,"props":302,"children":303},{},[304],{"type":20,"value":305},"For convenience, let's put it this way:",{"type":14,"tag":275,"props":307,"children":311},{"code":308,"language":309,"meta":7,"className":310,"style":7},"{\n  \"roles\": {\n    \"manager\": {\n      \"create\": {},\n      \"destroy\": { \"cid\": \"ContractID\" },\n      \"view\": {},\n      \"view_logs\": { \"cid\": \"ContractID\" },\n      \"view_accounts\": { \"cid\": \"ContractID\" },\n      \"view_account\": { \"cid\": \"ContractID\", \"pubKey\": \"PubKey\" }\n    },\n    \"my_account\": {\n      \"view\": { \"cid\": \"ContractID\" },\n      \"get_key\": { \"cid\": \"ContractID\" },\n      \"get_proof\": { \"cid\": \"ContractID\", \"aid\": \"AssetID\" },\n      \"deposit\": {\n        \"cid\": \"ContractID\",\n        \"pkForeign\": \"PubKey\",\n        \"bCoSigner\": \"uint32_t\",\n        \"amount\": \"Amount\",\n        \"aid\": \"AssetID\"\n      },\n      \"withdraw\": {\n        \"cid\": \"ContractID\",\n        \"pkForeign\": \"PubKey\",\n        \"bCoSigner\": \"uint32_t\",\n        \"amount\": \"Amount\",\n        \"aid\": \"AssetID\"\n      }\n    }\n  }\n}\n","json","language-json shiki shiki-themes github-dark",[312],{"type":14,"tag":52,"props":313,"children":314},{"__ignoreMap":7},[315,327,342,355,369,404,417,446,475,523,532,545,573,602,649,662,684,705,727,749,767,776,789,809,829,849,869,885,894,903,912],{"type":14,"tag":316,"props":317,"children":320},"span",{"class":318,"line":319},"line",1,[321],{"type":14,"tag":316,"props":322,"children":324},{"style":323},"--shiki-default:#E1E4E8",[325],{"type":20,"value":326},"{\n",{"type":14,"tag":316,"props":328,"children":330},{"class":318,"line":329},2,[331,337],{"type":14,"tag":316,"props":332,"children":334},{"style":333},"--shiki-default:#79B8FF",[335],{"type":20,"value":336},"  \"roles\"",{"type":14,"tag":316,"props":338,"children":339},{"style":323},[340],{"type":20,"value":341},": {\n",{"type":14,"tag":316,"props":343,"children":345},{"class":318,"line":344},3,[346,351],{"type":14,"tag":316,"props":347,"children":348},{"style":333},[349],{"type":20,"value":350},"    \"manager\"",{"type":14,"tag":316,"props":352,"children":353},{"style":323},[354],{"type":20,"value":341},{"type":14,"tag":316,"props":356,"children":358},{"class":318,"line":357},4,[359,364],{"type":14,"tag":316,"props":360,"children":361},{"style":333},[362],{"type":20,"value":363},"      \"create\"",{"type":14,"tag":316,"props":365,"children":366},{"style":323},[367],{"type":20,"value":368},": {},\n",{"type":14,"tag":316,"props":370,"children":372},{"class":318,"line":371},5,[373,378,383,388,393,399],{"type":14,"tag":316,"props":374,"children":375},{"style":333},[376],{"type":20,"value":377},"      \"destroy\"",{"type":14,"tag":316,"props":379,"children":380},{"style":323},[381],{"type":20,"value":382},": { ",{"type":14,"tag":316,"props":384,"children":385},{"style":333},[386],{"type":20,"value":387},"\"cid\"",{"type":14,"tag":316,"props":389,"children":390},{"style":323},[391],{"type":20,"value":392},": ",{"type":14,"tag":316,"props":394,"children":396},{"style":395},"--shiki-default:#9ECBFF",[397],{"type":20,"value":398},"\"ContractID\"",{"type":14,"tag":316,"props":400,"children":401},{"style":323},[402],{"type":20,"value":403}," },\n",{"type":14,"tag":316,"props":405,"children":407},{"class":318,"line":406},6,[408,413],{"type":14,"tag":316,"props":409,"children":410},{"style":333},[411],{"type":20,"value":412},"      \"view\"",{"type":14,"tag":316,"props":414,"children":415},{"style":323},[416],{"type":20,"value":368},{"type":14,"tag":316,"props":418,"children":420},{"class":318,"line":419},7,[421,426,430,434,438,442],{"type":14,"tag":316,"props":422,"children":423},{"style":333},[424],{"type":20,"value":425},"      \"view_logs\"",{"type":14,"tag":316,"props":427,"children":428},{"style":323},[429],{"type":20,"value":382},{"type":14,"tag":316,"props":431,"children":432},{"style":333},[433],{"type":20,"value":387},{"type":14,"tag":316,"props":435,"children":436},{"style":323},[437],{"type":20,"value":392},{"type":14,"tag":316,"props":439,"children":440},{"style":395},[441],{"type":20,"value":398},{"type":14,"tag":316,"props":443,"children":444},{"style":323},[445],{"type":20,"value":403},{"type":14,"tag":316,"props":447,"children":449},{"class":318,"line":448},8,[450,455,459,463,467,471],{"type":14,"tag":316,"props":451,"children":452},{"style":333},[453],{"type":20,"value":454},"      \"view_accounts\"",{"type":14,"tag":316,"props":456,"children":457},{"style":323},[458],{"type":20,"value":382},{"type":14,"tag":316,"props":460,"children":461},{"style":333},[462],{"type":20,"value":387},{"type":14,"tag":316,"props":464,"children":465},{"style":323},[466],{"type":20,"value":392},{"type":14,"tag":316,"props":468,"children":469},{"style":395},[470],{"type":20,"value":398},{"type":14,"tag":316,"props":472,"children":473},{"style":323},[474],{"type":20,"value":403},{"type":14,"tag":316,"props":476,"children":478},{"class":318,"line":477},9,[479,484,488,492,496,500,504,509,513,518],{"type":14,"tag":316,"props":480,"children":481},{"style":333},[482],{"type":20,"value":483},"      \"view_account\"",{"type":14,"tag":316,"props":485,"children":486},{"style":323},[487],{"type":20,"value":382},{"type":14,"tag":316,"props":489,"children":490},{"style":333},[491],{"type":20,"value":387},{"type":14,"tag":316,"props":493,"children":494},{"style":323},[495],{"type":20,"value":392},{"type":14,"tag":316,"props":497,"children":498},{"style":395},[499],{"type":20,"value":398},{"type":14,"tag":316,"props":501,"children":502},{"style":323},[503],{"type":20,"value":181},{"type":14,"tag":316,"props":505,"children":506},{"style":333},[507],{"type":20,"value":508},"\"pubKey\"",{"type":14,"tag":316,"props":510,"children":511},{"style":323},[512],{"type":20,"value":392},{"type":14,"tag":316,"props":514,"children":515},{"style":395},[516],{"type":20,"value":517},"\"PubKey\"",{"type":14,"tag":316,"props":519,"children":520},{"style":323},[521],{"type":20,"value":522}," }\n",{"type":14,"tag":316,"props":524,"children":526},{"class":318,"line":525},10,[527],{"type":14,"tag":316,"props":528,"children":529},{"style":323},[530],{"type":20,"value":531},"    },\n",{"type":14,"tag":316,"props":533,"children":535},{"class":318,"line":534},11,[536,541],{"type":14,"tag":316,"props":537,"children":538},{"style":333},[539],{"type":20,"value":540},"    \"my_account\"",{"type":14,"tag":316,"props":542,"children":543},{"style":323},[544],{"type":20,"value":341},{"type":14,"tag":316,"props":546,"children":548},{"class":318,"line":547},12,[549,553,557,561,565,569],{"type":14,"tag":316,"props":550,"children":551},{"style":333},[552],{"type":20,"value":412},{"type":14,"tag":316,"props":554,"children":555},{"style":323},[556],{"type":20,"value":382},{"type":14,"tag":316,"props":558,"children":559},{"style":333},[560],{"type":20,"value":387},{"type":14,"tag":316,"props":562,"children":563},{"style":323},[564],{"type":20,"value":392},{"type":14,"tag":316,"props":566,"children":567},{"style":395},[568],{"type":20,"value":398},{"type":14,"tag":316,"props":570,"children":571},{"style":323},[572],{"type":20,"value":403},{"type":14,"tag":316,"props":574,"children":576},{"class":318,"line":575},13,[577,582,586,590,594,598],{"type":14,"tag":316,"props":578,"children":579},{"style":333},[580],{"type":20,"value":581},"      \"get_key\"",{"type":14,"tag":316,"props":583,"children":584},{"style":323},[585],{"type":20,"value":382},{"type":14,"tag":316,"props":587,"children":588},{"style":333},[589],{"type":20,"value":387},{"type":14,"tag":316,"props":591,"children":592},{"style":323},[593],{"type":20,"value":392},{"type":14,"tag":316,"props":595,"children":596},{"style":395},[597],{"type":20,"value":398},{"type":14,"tag":316,"props":599,"children":600},{"style":323},[601],{"type":20,"value":403},{"type":14,"tag":316,"props":603,"children":605},{"class":318,"line":604},14,[606,611,615,619,623,627,631,636,640,645],{"type":14,"tag":316,"props":607,"children":608},{"style":333},[609],{"type":20,"value":610},"      \"get_proof\"",{"type":14,"tag":316,"props":612,"children":613},{"style":323},[614],{"type":20,"value":382},{"type":14,"tag":316,"props":616,"children":617},{"style":333},[618],{"type":20,"value":387},{"type":14,"tag":316,"props":620,"children":621},{"style":323},[622],{"type":20,"value":392},{"type":14,"tag":316,"props":624,"children":625},{"style":395},[626],{"type":20,"value":398},{"type":14,"tag":316,"props":628,"children":629},{"style":323},[630],{"type":20,"value":181},{"type":14,"tag":316,"props":632,"children":633},{"style":333},[634],{"type":20,"value":635},"\"aid\"",{"type":14,"tag":316,"props":637,"children":638},{"style":323},[639],{"type":20,"value":392},{"type":14,"tag":316,"props":641,"children":642},{"style":395},[643],{"type":20,"value":644},"\"AssetID\"",{"type":14,"tag":316,"props":646,"children":647},{"style":323},[648],{"type":20,"value":403},{"type":14,"tag":316,"props":650,"children":652},{"class":318,"line":651},15,[653,658],{"type":14,"tag":316,"props":654,"children":655},{"style":333},[656],{"type":20,"value":657},"      \"deposit\"",{"type":14,"tag":316,"props":659,"children":660},{"style":323},[661],{"type":20,"value":341},{"type":14,"tag":316,"props":663,"children":665},{"class":318,"line":664},16,[666,671,675,679],{"type":14,"tag":316,"props":667,"children":668},{"style":333},[669],{"type":20,"value":670},"        \"cid\"",{"type":14,"tag":316,"props":672,"children":673},{"style":323},[674],{"type":20,"value":392},{"type":14,"tag":316,"props":676,"children":677},{"style":395},[678],{"type":20,"value":398},{"type":14,"tag":316,"props":680,"children":681},{"style":323},[682],{"type":20,"value":683},",\n",{"type":14,"tag":316,"props":685,"children":687},{"class":318,"line":686},17,[688,693,697,701],{"type":14,"tag":316,"props":689,"children":690},{"style":333},[691],{"type":20,"value":692},"        \"pkForeign\"",{"type":14,"tag":316,"props":694,"children":695},{"style":323},[696],{"type":20,"value":392},{"type":14,"tag":316,"props":698,"children":699},{"style":395},[700],{"type":20,"value":517},{"type":14,"tag":316,"props":702,"children":703},{"style":323},[704],{"type":20,"value":683},{"type":14,"tag":316,"props":706,"children":708},{"class":318,"line":707},18,[709,714,718,723],{"type":14,"tag":316,"props":710,"children":711},{"style":333},[712],{"type":20,"value":713},"        \"bCoSigner\"",{"type":14,"tag":316,"props":715,"children":716},{"style":323},[717],{"type":20,"value":392},{"type":14,"tag":316,"props":719,"children":720},{"style":395},[721],{"type":20,"value":722},"\"uint32_t\"",{"type":14,"tag":316,"props":724,"children":725},{"style":323},[726],{"type":20,"value":683},{"type":14,"tag":316,"props":728,"children":730},{"class":318,"line":729},19,[731,736,740,745],{"type":14,"tag":316,"props":732,"children":733},{"style":333},[734],{"type":20,"value":735},"        \"amount\"",{"type":14,"tag":316,"props":737,"children":738},{"style":323},[739],{"type":20,"value":392},{"type":14,"tag":316,"props":741,"children":742},{"style":395},[743],{"type":20,"value":744},"\"Amount\"",{"type":14,"tag":316,"props":746,"children":747},{"style":323},[748],{"type":20,"value":683},{"type":14,"tag":316,"props":750,"children":752},{"class":318,"line":751},20,[753,758,762],{"type":14,"tag":316,"props":754,"children":755},{"style":333},[756],{"type":20,"value":757},"        \"aid\"",{"type":14,"tag":316,"props":759,"children":760},{"style":323},[761],{"type":20,"value":392},{"type":14,"tag":316,"props":763,"children":764},{"style":395},[765],{"type":20,"value":766},"\"AssetID\"\n",{"type":14,"tag":316,"props":768,"children":770},{"class":318,"line":769},21,[771],{"type":14,"tag":316,"props":772,"children":773},{"style":323},[774],{"type":20,"value":775},"      },\n",{"type":14,"tag":316,"props":777,"children":779},{"class":318,"line":778},22,[780,785],{"type":14,"tag":316,"props":781,"children":782},{"style":333},[783],{"type":20,"value":784},"      \"withdraw\"",{"type":14,"tag":316,"props":786,"children":787},{"style":323},[788],{"type":20,"value":341},{"type":14,"tag":316,"props":790,"children":792},{"class":318,"line":791},23,[793,797,801,805],{"type":14,"tag":316,"props":794,"children":795},{"style":333},[796],{"type":20,"value":670},{"type":14,"tag":316,"props":798,"children":799},{"style":323},[800],{"type":20,"value":392},{"type":14,"tag":316,"props":802,"children":803},{"style":395},[804],{"type":20,"value":398},{"type":14,"tag":316,"props":806,"children":807},{"style":323},[808],{"type":20,"value":683},{"type":14,"tag":316,"props":810,"children":812},{"class":318,"line":811},24,[813,817,821,825],{"type":14,"tag":316,"props":814,"children":815},{"style":333},[816],{"type":20,"value":692},{"type":14,"tag":316,"props":818,"children":819},{"style":323},[820],{"type":20,"value":392},{"type":14,"tag":316,"props":822,"children":823},{"style":395},[824],{"type":20,"value":517},{"type":14,"tag":316,"props":826,"children":827},{"style":323},[828],{"type":20,"value":683},{"type":14,"tag":316,"props":830,"children":832},{"class":318,"line":831},25,[833,837,841,845],{"type":14,"tag":316,"props":834,"children":835},{"style":333},[836],{"type":20,"value":713},{"type":14,"tag":316,"props":838,"children":839},{"style":323},[840],{"type":20,"value":392},{"type":14,"tag":316,"props":842,"children":843},{"style":395},[844],{"type":20,"value":722},{"type":14,"tag":316,"props":846,"children":847},{"style":323},[848],{"type":20,"value":683},{"type":14,"tag":316,"props":850,"children":852},{"class":318,"line":851},26,[853,857,861,865],{"type":14,"tag":316,"props":854,"children":855},{"style":333},[856],{"type":20,"value":735},{"type":14,"tag":316,"props":858,"children":859},{"style":323},[860],{"type":20,"value":392},{"type":14,"tag":316,"props":862,"children":863},{"style":395},[864],{"type":20,"value":744},{"type":14,"tag":316,"props":866,"children":867},{"style":323},[868],{"type":20,"value":683},{"type":14,"tag":316,"props":870,"children":872},{"class":318,"line":871},27,[873,877,881],{"type":14,"tag":316,"props":874,"children":875},{"style":333},[876],{"type":20,"value":757},{"type":14,"tag":316,"props":878,"children":879},{"style":323},[880],{"type":20,"value":392},{"type":14,"tag":316,"props":882,"children":883},{"style":395},[884],{"type":20,"value":766},{"type":14,"tag":316,"props":886,"children":888},{"class":318,"line":887},28,[889],{"type":14,"tag":316,"props":890,"children":891},{"style":323},[892],{"type":20,"value":893},"      }\n",{"type":14,"tag":316,"props":895,"children":897},{"class":318,"line":896},29,[898],{"type":14,"tag":316,"props":899,"children":900},{"style":323},[901],{"type":20,"value":902},"    }\n",{"type":14,"tag":316,"props":904,"children":906},{"class":318,"line":905},30,[907],{"type":14,"tag":316,"props":908,"children":909},{"style":323},[910],{"type":20,"value":911},"  }\n",{"type":14,"tag":316,"props":913,"children":915},{"class":318,"line":914},31,[916],{"type":14,"tag":316,"props":917,"children":918},{"style":323},[919],{"type":20,"value":920},"}\n",{"type":14,"tag":22,"props":922,"children":923},{},[924,926,932,933,939,941,946],{"type":20,"value":925},"As you can see above, there are two roles in this example: ",{"type":14,"tag":52,"props":927,"children":929},{"className":928},[],[930],{"type":20,"value":931},"manager",{"type":20,"value":247},{"type":14,"tag":52,"props":934,"children":936},{"className":935},[],[937],{"type":20,"value":938},"my_account",{"type":20,"value":940},". Each role has its own available actions with or without required attributes. Consider the role ",{"type":14,"tag":52,"props":942,"children":944},{"className":943},[],[945],{"type":20,"value":931},{"type":20,"value":947}," , it has the following actions:",{"type":14,"tag":102,"props":949,"children":950},{},[951,960,979,988,1004,1020],{"type":14,"tag":106,"props":952,"children":953},{},[954],{"type":14,"tag":52,"props":955,"children":957},{"className":956},[],[958],{"type":20,"value":959},"create",{"type":14,"tag":106,"props":961,"children":962},{},[963,969,971,977],{"type":14,"tag":52,"props":964,"children":966},{"className":965},[],[967],{"type":20,"value":968},"destroy",{"type":20,"value":970},", requires the ",{"type":14,"tag":52,"props":972,"children":974},{"className":973},[],[975],{"type":20,"value":976},"cid",{"type":20,"value":978}," attribute",{"type":14,"tag":106,"props":980,"children":981},{},[982],{"type":14,"tag":52,"props":983,"children":985},{"className":984},[],[986],{"type":20,"value":987},"view",{"type":14,"tag":106,"props":989,"children":990},{},[991,997,998,1003],{"type":14,"tag":52,"props":992,"children":994},{"className":993},[],[995],{"type":20,"value":996},"view_logs",{"type":20,"value":970},{"type":14,"tag":52,"props":999,"children":1001},{"className":1000},[],[1002],{"type":20,"value":976},{"type":20,"value":978},{"type":14,"tag":106,"props":1005,"children":1006},{},[1007,1013,1014,1019],{"type":14,"tag":52,"props":1008,"children":1010},{"className":1009},[],[1011],{"type":20,"value":1012},"view_accounts",{"type":20,"value":970},{"type":14,"tag":52,"props":1015,"children":1017},{"className":1016},[],[1018],{"type":20,"value":976},{"type":20,"value":978},{"type":14,"tag":106,"props":1021,"children":1022},{},[1023,1029,1031,1036,1037,1043],{"type":14,"tag":52,"props":1024,"children":1026},{"className":1025},[],[1027],{"type":20,"value":1028},"view_account",{"type":20,"value":1030},", requires ",{"type":14,"tag":52,"props":1032,"children":1034},{"className":1033},[],[1035],{"type":20,"value":976},{"type":20,"value":247},{"type":14,"tag":52,"props":1038,"children":1040},{"className":1039},[],[1041],{"type":20,"value":1042},"pubKey",{"type":20,"value":1044}," attributes",{"type":14,"tag":22,"props":1046,"children":1047},{},[1048,1050,1055,1057,1063,1065,1070,1072,1077],{"type":20,"value":1049},"This means that if, for example, we want to deploy a contract (in Vault, deployment is ",{"type":14,"tag":52,"props":1051,"children":1053},{"className":1052},[],[1054],{"type":20,"value":959},{"type":20,"value":1056}," argument), we must specify ",{"type":14,"tag":52,"props":1058,"children":1060},{"className":1059},[],[1061],{"type":20,"value":1062},"shader_args",{"type":20,"value":1064},"(consider below) with the role ",{"type":14,"tag":52,"props":1066,"children":1068},{"className":1067},[],[1069],{"type":20,"value":931},{"type":20,"value":1071}," and the action ",{"type":14,"tag":52,"props":1073,"children":1075},{"className":1074},[],[1076],{"type":20,"value":959},{"type":20,"value":1078},":",{"type":14,"tag":275,"props":1080,"children":1082},{"code":1081},"--shader_args=\"role=manager,action=create\"\n",[1083],{"type":14,"tag":52,"props":1084,"children":1085},{"__ignoreMap":7},[1086],{"type":20,"value":1081},{"type":14,"tag":22,"props":1088,"children":1089},{},[1090,1092,1098,1100,1106,1108,1114],{"type":20,"value":1091},"Specifying a ",{"type":14,"tag":52,"props":1093,"children":1095},{"className":1094},[],[1096],{"type":20,"value":1097},"role",{"type":20,"value":1099}," and an ",{"type":14,"tag":52,"props":1101,"children":1103},{"className":1102},[],[1104],{"type":20,"value":1105},"action",{"type":20,"value":1107}," in a ",{"type":14,"tag":52,"props":1109,"children":1111},{"className":1110},[],[1112],{"type":20,"value":1113},"key=value",{"type":20,"value":1115}," pair representation is a requirement for working with shaders. But each contract has its own API and the arguments can be different.",{"type":14,"tag":69,"props":1117,"children":1118},{"id":976},[1119],{"type":20,"value":1120},"Cid",{"type":14,"tag":22,"props":1122,"children":1123},{},[1124,1128,1130,1135],{"type":14,"tag":110,"props":1125,"children":1126},{},[1127],{"type":20,"value":976},{"type":20,"value":1129}," (i.e. ",{"type":14,"tag":110,"props":1131,"children":1132},{},[1133],{"type":20,"value":1134},"contract id",{"type":20,"value":1136},") is the frequently required attribute. We get it after our contract has been deployed. The same contract which has been deployed with different attributes, will have different values.",{"type":14,"tag":69,"props":1138,"children":1140},{"id":1139},"working-with-shaders",[1141],{"type":20,"value":1142},"Working with shaders",{"type":14,"tag":1144,"props":1145,"children":1147},"h4",{"id":1146},"commands-rules",[1148],{"type":20,"value":1149},"Commands rules",{"type":14,"tag":22,"props":1151,"children":1152},{},[1153],{"type":20,"value":1154},"There are required flags that need to be passed in the wallet CLI to work with the contract:",{"type":14,"tag":102,"props":1156,"children":1157},{},[1158,1169,1180,1191],{"type":14,"tag":106,"props":1159,"children":1160},{},[1161,1167],{"type":14,"tag":52,"props":1162,"children":1164},{"className":1163},[],[1165],{"type":20,"value":1166},"--shader_app_file=\u003Capp.wasm>",{"type":20,"value":1168}," - for application shader",{"type":14,"tag":106,"props":1170,"children":1171},{},[1172,1178],{"type":14,"tag":52,"props":1173,"children":1175},{"className":1174},[],[1176],{"type":20,"value":1177},"--shader_contract_file=\u003Ccontract.wasm>",{"type":20,"value":1179}," - for contract shader",{"type":14,"tag":106,"props":1181,"children":1182},{},[1183,1189],{"type":14,"tag":52,"props":1184,"children":1186},{"className":1185},[],[1187],{"type":20,"value":1188},"--shader_args=\"role=\u003Crole>,action=\u003Caction>\"",{"type":20,"value":1190}," - shader arguments",{"type":14,"tag":106,"props":1192,"children":1193},{},[1194],{"type":14,"tag":52,"props":1195,"children":1197},{"className":1196},[],[1198],{"type":20,"value":1199},"-n \u003Cnode address>",{"type":14,"tag":22,"props":1201,"children":1202},{},[1203,1205,1210],{"type":20,"value":1204},"All arguments in ",{"type":14,"tag":52,"props":1206,"children":1208},{"className":1207},[],[1209],{"type":20,"value":1062},{"type":20,"value":1211}," are passed separated by commas without spaces. For example:",{"type":14,"tag":275,"props":1213,"children":1215},{"code":1214},"--shader_args=\"role=manager,action=view\"\n",[1216],{"type":14,"tag":52,"props":1217,"children":1218},{"__ignoreMap":7},[1219],{"type":20,"value":1214},{"type":14,"tag":22,"props":1221,"children":1222},{},[1223,1225,1230],{"type":20,"value":1224},"If the ",{"type":14,"tag":52,"props":1226,"children":1228},{"className":1227},[],[1229],{"type":20,"value":1105},{"type":20,"value":1231}," has additional attributes, they also are separated by commas without spaces:",{"type":14,"tag":275,"props":1233,"children":1235},{"code":1234},"--shader_args=\"role=manager,action=view_logs,cid=d9c5d1782b2d2b6f733486be480bb0d8bcf34d5fdc63bbac996ed76af541cc14\"\n",[1236],{"type":14,"tag":52,"props":1237,"children":1238},{"__ignoreMap":7},[1239],{"type":20,"value":1234},{"type":14,"tag":1144,"props":1241,"children":1243},{"id":1242},"deploy-contract",[1244],{"type":20,"value":1245},"Deploy contract",{"type":14,"tag":22,"props":1247,"children":1248},{},[1249,1251,1256,1258,1263],{"type":20,"value":1250},"To work with the contract, you first need to deploy it. As we said, in our Vault example contract, the deployment corresponds to the ",{"type":14,"tag":52,"props":1252,"children":1254},{"className":1253},[],[1255],{"type":20,"value":931},{"type":20,"value":1257}," role and ",{"type":14,"tag":52,"props":1259,"children":1261},{"className":1260},[],[1262],{"type":20,"value":959},{"type":20,"value":1264}," action.",{"type":14,"tag":22,"props":1266,"children":1267},{},[1268,1270,1275],{"type":20,"value":1269},"Based on our knowledge, we got the following command to ",{"type":14,"tag":110,"props":1271,"children":1272},{},[1273],{"type":20,"value":1274},"deploy contract",{"type":20,"value":1078},{"type":14,"tag":275,"props":1277,"children":1279},{"code":1278},"./beam-wallet-masternet shader --shader_app_file=mydapp/app.wasm --shader_args=\"role=manager,action=create\" --shader_contract_file=mydapp/contract.wasm -n localhost:10000\n",[1280],{"type":14,"tag":52,"props":1281,"children":1282},{"__ignoreMap":7},[1283],{"type":20,"value":1278},{"type":14,"tag":22,"props":1285,"children":1286},{},[1287],{"type":20,"value":1288},"Output example:",{"type":14,"tag":275,"props":1290,"children":1292},{"code":1291},"Creating new contract invocation tx on behalf of the shader\nContract ID: d9c5d1782b2d2b6f733486be480bb0d8bcf34d5fdc63bbac996ed76af541cc14\n        Comment: create Vault contract  Total fee: 1100000 GROTH\nI 2022-06-06.11:43:08.288 [ac09d5dc897647bf876b7d17d8219a77][1] Get proof for kernel: 6625e9f7756a98eb\nI 2022-06-06.11:43:08.289 Synchronizing with node: 100% (1/1)\nI 2022-06-06.11:43:08.289 Current state is 8-65a2ecdf447ad942\nI 2022-06-06.11:43:18.354 Sync up to 9-7d15da24d2717100\nI 2022-06-06.11:43:18.354 Synchronizing with node: 0% (0/2)\nI 2022-06-06.11:43:18.355 CoinID: Key=mine-1:1:1, Value=8000000000 Maturity=6 Spent, Height=9\nI 2022-06-06.11:43:18.356 CoinID: Key=chng-1:0:3958598515398969808, Value=7998900000 Maturity=9 Confirmed, Height=9\nI 2022-06-06.11:43:18.356 Synchronizing with node: 50% (1/2)\nI 2022-06-06.11:43:18.356 Synchronizing with node: 100% (2/2)\nI 2022-06-06.11:43:18.356 Current state is 9-7d15da24d2717100\nI 2022-06-06.11:43:18.356 [ac09d5dc897647bf876b7d17d8219a77][1] Get proof for kernel: 6625e9f7756a98eb\nI 2022-06-06.11:43:18.357 [ac09d5dc897647bf876b7d17d8219a77] Transaction completed\n",[1293],{"type":14,"tag":52,"props":1294,"children":1295},{"__ignoreMap":7},[1296],{"type":20,"value":1291},{"type":14,"tag":22,"props":1298,"children":1299},{},[1300,1302,1308,1310,1315],{"type":20,"value":1301},"In the ",{"type":14,"tag":52,"props":1303,"children":1305},{"className":1304},[],[1306],{"type":20,"value":1307},"Contract ID",{"type":20,"value":1309}," line we got the ",{"type":14,"tag":52,"props":1311,"children":1313},{"className":1312},[],[1314],{"type":20,"value":976},{"type":20,"value":1316}," for this deployed contract.",{"type":14,"tag":1144,"props":1318,"children":1320},{"id":1319},"command-examples",[1321],{"type":20,"value":1322},"Command examples",{"type":14,"tag":102,"props":1324,"children":1325},{},[1326,1357],{"type":14,"tag":106,"props":1327,"children":1328},{},[1329,1334,1336,1344,1347,1349],{"type":14,"tag":110,"props":1330,"children":1331},{},[1332],{"type":20,"value":1333},"View",{"type":20,"value":1335}," deployed contracts:",{"type":14,"tag":275,"props":1337,"children":1339},{"code":1338},"./beam-wallet-masternet shader --shader_app_file=mydapp/app.wasm --shader_args=\"role=manager,action=view\" --shader_contract_file=mydapp/contract.wasm -n localhost:10000\n",[1340],{"type":14,"tag":52,"props":1341,"children":1342},{"__ignoreMap":7},[1343],{"type":20,"value":1338},{"type":14,"tag":164,"props":1345,"children":1346},{},[],{"type":20,"value":1348},"The output could be like this:",{"type":14,"tag":275,"props":1350,"children":1352},{"code":1351},"Shader output: {\"contracts\": [{\"cid\": \"d9c5d1782b2d2b6f733486be480bb0d8bcf34d5fdc63bbac996ed76af541cc14\",\"Height\": 9}]}\n",[1353],{"type":14,"tag":52,"props":1354,"children":1355},{"__ignoreMap":7},[1356],{"type":20,"value":1351},{"type":14,"tag":106,"props":1358,"children":1359},{},[1360,1365,1367,1372,1374,1382,1385,1386],{"type":14,"tag":110,"props":1361,"children":1362},{},[1363],{"type":20,"value":1364},"Destroy",{"type":20,"value":1366}," contract (with ",{"type":14,"tag":52,"props":1368,"children":1370},{"className":1369},[],[1371],{"type":20,"value":976},{"type":20,"value":1373}," from the example above)",{"type":14,"tag":275,"props":1375,"children":1377},{"code":1376},"./beam-wallet-masternet shader --shader_app_file=mydapp/app.wasm --shader_contract_file=mydapp/contract.wasm --shader_args=\"role=manager,action=destroy,cid=d9c5d1782b2d2b6f733486be480bb0d8bcf34d5fdc63bbac996ed76af541cc14\" -n localhost:10000\n",[1378],{"type":14,"tag":52,"props":1379,"children":1380},{"__ignoreMap":7},[1381],{"type":20,"value":1376},{"type":14,"tag":164,"props":1383,"children":1384},{},[],{"type":20,"value":1288},{"type":14,"tag":275,"props":1387,"children":1389},{"code":1388},"Creating new contract invocation tx on behalf of the shader\nContract ID: d9c5d1782b2d2b6f733486be480bb0d8bcf34d5fdc63bbac996ed76af541cc14\n      Comment: destroy Vault contract   Total fee: 1100000 GROTH\nI 2022-06-06.12:34:15.962 Sync up to 311-788f821396683a25\nI 2022-06-06.12:34:15.962 Synchronizing with node: 0% (0/2)\nI 2022-06-06.12:34:15.967 Synchronizing with node: 0% (0/2)\nI 2022-06-06.12:34:15.967 CoinID: Key=mine-1:1:307, Value=8000000000 Maturity=312 Confirmed, Height=307\nI 2022-06-06.12:34:15.968 CoinID: Key=mine-1:1:308, Value=8000000000 Maturity=313 Confirmed, Height=308\nI 2022-06-06.12:34:15.968 CoinID: Key=mine-1:1:309, Value=8000000000 Maturity=314 Confirmed, Height=309\nI 2022-06-06.12:34:15.968 CoinID: Key=mine-1:1:310, Value=8000000000 Maturity=315 Confirmed, Height=310\nI 2022-06-06.12:34:15.969 CoinID: Key=mine-1:1:311, Value=8000000000 Maturity=316 Confirmed, Height=311\nI 2022-06-06.12:34:15.969 Synchronizing with node: 50% (1/2)\nI 2022-06-06.12:34:15.969 Synchronizing with node: 100% (2/2)\nI 2022-06-06.12:34:15.969 Current state is 311-788f821396683a25\nI 2022-06-06.12:34:15.969 [7b8eb0b0bd2340529996c7598d3ebaff][1] Get proof for kernel: eb45c335bca2e17c\nI 2022-06-06.12:34:15.970 Synchronizing with node: 100% (1/1)\nI 2022-06-06.12:34:15.970 Current state is 311-788f821396683a25\nI 2022-06-06.12:34:26.111 Rolled back to 306-910bc6ca48d05757\nI 2022-06-06.12:34:26.112 Sync up to 312-d156e1bf16939393\nI 2022-06-06.12:34:26.113 Synchronizing with node: 0% (0/2)\nI 2022-06-06.12:34:26.113 CoinID: Key=mine-1:1:307, Value=8000000000 Maturity=312 Confirmed, Height=307\nI 2022-06-06.12:34:26.113 CoinID: Key=mine-1:1:308, Value=8000000000 Maturity=313 Confirmed, Height=308\nI 2022-06-06.12:34:26.114 CoinID: Key=chng-1:0:3958598515398969808, Value=7998900000 Maturity=9 Spent, Height=312\nI 2022-06-06.12:34:26.114 CoinID: Key=chng-1:0:12345322638362229725, Value=7997800000 Maturity=312 Confirmed, Height=312\nI 2022-06-06.12:34:26.115 Synchronizing with node: 50% (1/2)\nI 2022-06-06.12:34:26.115 Synchronizing with node: 100% (2/2)\nI 2022-06-06.12:34:26.115 Current state is 312-d156e1bf16939393\nI 2022-06-06.12:34:26.115 [7b8eb0b0bd2340529996c7598d3ebaff][1] Get proof for kernel: eb45c335bca2e17c\nI 2022-06-06.12:34:26.116 [7b8eb0b0bd2340529996c7598d3ebaff] Transaction completed\n",[1390],{"type":14,"tag":52,"props":1391,"children":1392},{"__ignoreMap":7},[1393],{"type":20,"value":1388},{"type":14,"tag":1395,"props":1396,"children":1397},"style",{},[1398],{"type":20,"value":1399},"html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":329,"depth":329,"links":1401},[1402,1403,1404,1405,1406],{"id":71,"depth":344,"text":74},{"id":142,"depth":344,"text":145},{"id":258,"depth":344,"text":261},{"id":976,"depth":344,"text":1120},{"id":1139,"depth":344,"text":1142},"markdown","docs:docs:dev:beam-shaders:using-beam-shaders-with-cli-wallet-masternet.md","docs","docs/dev/beam-shaders/using-beam-shaders-with-cli-wallet-masternet.md","md",1777630718861]