local-environment-setup.md
This guide provides detailed instructions for setting up a local development environment for Shardeum.
To run a Shardeum network for local development, you need to configure your machine to spin up local validator, archiver, and monitor servers.
Shardeum requires Node.js version 18.19.1 and npm version 10.2.4. We recommend using Node Version Manager (NVM) to manage multiple Node.js versions.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
.bashrc or .bash_profile:[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 18.19.1
nvm use 18.19.1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup install 1.74.1
rustup default 1.74.1
For Linux:
sudo apt-get install build-essential
For MacOS:
brew install gcc
Node-gyp
npm i -g node-gyp
npm config set python `which python3`
npm config list
git clone https://github.com/shardeum/shardeum.git
cd shardeum
npm ci
npm run prepare
npm install -g @shardeum-foundation/tools-shardus-cli
npm update @shardeum-foundation/archiver
You can configure the Shardeum network for local development using either the automatic or manual mode.
Apply a pre-configured patch:
git apply debug-10-nodes.patch
src/config/index.tsforceBogonFilteringOn: false,
mode: 'debug'
src/shardeum/shardeumFlags.ts:txBalancePreCheck: false,
StakingEnabled: false
// src/config/index.ts
cycleDuration: 30,
server/features/tickets/updateTicketListTimeInMs: 300000
// src/shardeum/shardeumFlags.ts
blockProductionRate: 3,
npm run prepare
Start a Shardeum network with 10 nodes:
shardus start 10
To stop the network and clean up resources:
shardus stop && shardus clean && rm -rf instances
This guide should help you set up and run a local Shardeum network for development purposes. If you encounter any issues, please refer to our community resources or open an issue on this repo.