[{"data":1,"prerenderedAt":228},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fdev\u002Frunning-local-blockchain":3,"docs-surround-\u002Fdocs\u002Fdev\u002Frunning-local-blockchain":218},{"id":4,"title":5,"body":6,"description":16,"extension":210,"image":211,"meta":212,"navTitle":211,"navigation":213,"path":214,"seo":215,"stem":216,"__hash__":217},"docs\u002Fdocs\u002Fdev\u002Frunning-local-blockchain.md","Running local blockchain",{"type":7,"value":8,"toc":203},"minimark",[9,13,17,22,30,34,37,48,51,54,60,63,66,71,74,79,82,86,100,103,109,122,125,130,133,143,146,153,156,159,164,167,174,177,182,185,192,195],[10,11,5],"h1",{"id":12},"running-local-blockchain",[14,15,16],"p",{},"In this tutorial we will explain how to run local blockchain. It will be extremely useful for testing your dapps locally, before deplying them to public networks",[18,19,21],"h3",{"id":20},"download-node-and-wallet","Download node and wallet",[14,23,24,25],{},"Create an empty folder (called dappnet in our examples) and download the binaries for the node and CLI wallet from ",[26,27,29],"a",{"href":28},"\u002Fdownloads\u002Fdappnet","beam website",[18,31,33],{"id":32},"initialize-wallet","Initialize wallet",[14,35,36],{},"First, let's change the wallet configuration file to make everything easy and seamless when we run it later. Edit the beam-wallet.cfg file and set the following flags:",[38,39,44],"pre",{"className":40,"code":42,"language":43},[41],"language-text","\n# General options:\n################################################################################\n\n# log level [info|debug|verbose]\nlog_level=debug\n\n# file log level [info|debug|verbose]\n# file_log_level=debug\n\n# old logs cleanup period (days)\n# log_cleanup_days=5\n\n################################################################################\n# Wallet options:\n################################################################################\n\n# password for the wallet\npass=123\n\n# phrase to generate secret key according to BIP-39.\n# seed_phrase=\n\n# address of node\nnode_addr=127.0.0.1:8100\n\n# path to wallet file\nwallet_path=wallet.db\n\nMaturity.Coinbase=0\n\n# command to execute [new_addr|send|receive|listen|init|info|export_miner_key|export_owner_key|generate_phrase]\n# command=listen\n\n\n","text",[45,46,42],"code",{"__ignoreMap":47},"",[14,49,50],{},"Note the Maturity.Coinbase=0 flag. It means that you can spend coinbase rewards immediately (unlike the 60 block lockup in mainnet) It is useful for testing in a local environment, since you do not have to wait for your mined rewards to before available",[14,52,53],{},"Now let's move on to wallet initialization. Run",[14,55,56,59],{},[45,57,58],{},"beam-wallet-dappnet.exe init","  (or .\u002Fbeam-wallet-dappnet on Mac)",[14,61,62],{},"Save the generated seed phase somewhere in a text file ( we might need it later)",[14,64,65],{},"Now print the owner key by running:",[14,67,68],{},[45,69,70],{},"beam-wallet-dappnet.exe export_owner_key",[14,72,73],{},"And last generate the mining key by running",[14,75,76],{},[45,77,78],{},"beam-wallet-dappnet.exe export_miner_key --subkey=1",[14,80,81],{},"Save both keys in the same file as the seed phrase",[18,83,85],{"id":84},"initializing-the-node","Initializing the Node",[14,87,88,89,95,96,99],{},"Before we start configuring the node, download sample Beam treasury file ",[26,90,94],{"href":91,"rel":92},"https:\u002F\u002Fgithub.com\u002FBeamMW\u002Fbeam\u002Fblob\u002Fmaster\u002Ftreasury.bin",[93],"nofollow","treasury.bin",", and copy it to the same folder as the ",[45,97,98],{},"beam-node"," binary.",[14,101,102],{},"Now, open beam-node.cfg file in a text editor and set the following flags:",[38,104,107],{"className":105,"code":106,"language":43},[41],"################################################################################\n# General options:\n################################################################################\n\n# port to start server on\nport=8100\n\n# log level [info|debug|verbose]\nlog_level=debug\n\n# file log level [info|debug|verbose]\nfile_log_level=debug\n\n# old logs cleanup period (days)\n# log_cleanup_days=5\n\n################################################################################\n# Node options:\n################################################################################\n\n# node storage path\n# storage=node.db\n\n# nodes to connect to !!! MUST BE EMPTY !!!\n# peer=\n\n# port to start stratum server on\n# stratum_port=0\n\n# path to stratum server api keys file, and tls certificate and private key\n# stratum_secrets_path=.\n\n# Enforce re-synchronization (soft reset)\n# resync=0\n\n# Owner viewer key\nowner_key=\u003Cyour owner key>\n\n# Standalone miner key\nminer_key=\u003Cyour miner key>\n\n# password for keys\npass=123\n\n# Fork1 height\n# Fork1=\n\n# Path to treasury for testing\ntreasury_path=treasury.bin\n\n# Enables the node to produce blocks\nmining_threads=1\n\nMaturity.Coinbase=0\n\n\n",[45,108,106],{"__ignoreMap":47},[110,111,112,116,119],"ol",{},[113,114,115],"li",{},"Make sure to set miner and owner keys to those generated by your wallet",[113,117,118],{},"Make sure peer list is empty (to avoid accidental connections to other nodes)",[113,120,121],{},"Check that mining_threads flag is set to 1",[14,123,124],{},"We are now ready to run the node using the command:",[14,126,127],{},[45,128,129],{},"beam-node-dappnet.exe",[14,131,132],{},"Sample output should look something like this",[134,135,136,140],"figure",{},[137,138],"img",{"src":139,"alt":47},".gitbook\u002Fassets\u002Fimage.png",[141,142],"figcaption",{},[14,144,145],{},"Wait for about 30 seconds to make sure new blocks are produced. A new block shoud appear every 15 seconds or so",[134,147,148,151],{},[137,149],{"src":150,"alt":47},".gitbook\u002Fassets\u002Fimage (3).png",[141,152],{},[14,154,155],{},"Synchronizing the wallet",[14,157,158],{},"In another command line (or Terminal) window, run the CLI wallet with the following command:",[14,160,161],{},[45,162,163],{},"beam-wallet-dappnet.exe listen",[14,165,166],{},"This will synchronize the wallet state with the blockchain. Your output should read something like:",[134,168,169,172],{},[137,170],{"src":171,"alt":47},".gitbook\u002Fassets\u002Fimage (24).png",[141,173],{},[14,175,176],{},"Stop the wallet (by clicking Ctrl + C) and check your current balance by running:",[14,178,179],{},[45,180,181],{},"beam-wallet-dappnet.exe info",[14,183,184],{},"You should see the mined BEAM coins in your wallet",[134,186,187,190],{},[137,188],{"src":189,"alt":47},".gitbook\u002Fassets\u002Fimage (26).png",[141,191],{},[14,193,194],{},"You now have a local network!",[14,196,197,198],{},"For a full reference on Beam CLI wallet see the ",[26,199,202],{"href":200,"rel":201},"https:\u002F\u002Fbeamx.gitbook.io\u002Fcli-guide\u002F",[93],"CLI Wallet Guide",{"title":47,"searchDepth":204,"depth":204,"links":205},2,[206,208,209],{"id":20,"depth":207,"text":21},3,{"id":32,"depth":207,"text":33},{"id":84,"depth":207,"text":85},"md",null,{},true,"\u002Fdocs\u002Fdev\u002Frunning-local-blockchain",{"title":5,"description":16},"docs\u002Fdev\u002Frunning-local-blockchain","QYWhxcEI5ToT0_fQ51YWgWA3ZQjV4n9Fjv702dY2aIE",[219,223],{"title":220,"path":221,"stem":222,"description":47,"children":-1},"Understanding Beam Logs","\u002Fdocs\u002Fdev\u002Fguides\u002Funderstanding-beam-logs","docs\u002Fdev\u002Fguides\u002Funderstanding-beam-logs",{"title":224,"path":225,"stem":226,"description":227,"children":-1},"Shader SDK (MAC)","\u002Fdocs\u002Fdev\u002Fshader-sdk-mac","docs\u002Fdev\u002Fshader-sdk-mac","In this tutorial we will show how to setup Beam Shader SDK on Mac OS",1783006054276]