This guide will help you install a basic dapp built on top of the shardus network. It'll walk you through installation, starting and stopping both single and multiple node networks, and interacting with the dapp.
Start by cloning
git clone https://gitlab.com/shardus/applications/hello-shardus.git
Make sure you have the correct node version which is
nvm install 16.11.1 nvm use 16.11.1
Now that correct node version is satisfied, go ahead and play with
cd hello-shardus npm install # OR: yarn install
If you encounters major problems doing
npm run start or
npm i checkout this guide
monitor-server, and your
npm start # OR: yarn start
Interact with your
npm run client client$ help Commands: help [command...] Provides help for a given command. exit Exits application. state Queries the network via a GET request to /state. set state <state> <account> Injects a tx into the network via a POST request to /inject. Whatever account name you give it, this client will hash that to create a 32 byte hex string suitable for the server to use as an account address.
monitor-server, and clean residual run files:
npm run stop && npm run clean # OR: yarn stop && yarn clean
Create a local test network with multiple instances of your
index.js server. In order to do that we need
shardus-cli specifically design to do this.
shardus-cli start a network containing multiple nodes by reading main
js file specified inside
package.json in current directory.
Make sure you have the Shardus CLI tool installed globally by doing
npm install -g shardus # OR: yarn global add shardus
To create a shardus network consist of 3 node
shardus create 3
npm run client
Everytime you make a code change you need to restart network, in order for successful restart you need to first stop the previously running network and cleaning the residual files it generated.
Clean databases and logs from the last run:
Congratulations! You've successfully installed, launched, stopped, cleaned and interacted with a Shardus network. You can now proceed to the next section to learn the finer details of how to develop decentralized applications with Shardus