A monitor for the upcoming Storage Incentives (SI) for the Ethersphere Bee swarm written in Typescript for node.js
Build the image
docker build . -t monsi
Run the monsi image
docker run --rm monsi
To get started the following commands, or their equivalents, should work if you don't already have node and/or npm
sudo apt-get install nodejs
sudo apt-get install npm
Or for Windows or macOS, https://nodejs.org/en/download/
You'll also need git to clone this repository: https://git-scm.com/download/win
monsi is available for install as a standard npmjs
package for non-Windows users. Once you have node
and npm
installed, you can install monsi
simply by:
npm install -g "@rndlabs/monsi"
This will install the package and make available the monsi
symlink on your command line environment's path.
Windows users will need to follow the Extending / developing monsi instructions below.
All parameters can be specified on the command line and some are supported in environment values (or .env
file)
Finally, to run monsi
, use the following command in a shell or command prompt window:
monsi --rpc-endpoint ws:https://<YourGoerliRPCIP:port>
This command will compile the typescript application and run it. Your screen should clear and boxes should appear with values. monsi defaults to going back 4 complete Schelling game rounds at startup. It also loads ALL stake events from the blockchain on every invocation.
Monitor Storage Incentives for Swarm
Arguments:
overlays Overlay addresses for highlighting
Options:
-V, --version output the version number
--mainnet Use Swarm mainnet (default: false)
--rpc-endpoint <string> RPC endpoint for the blockchain node (default: "ws:https://goerli-geth.dappnode:8546", env: RPC_URL)
-r, --rounds [rounds] Load the last number of rounds from the blockchain (default: 4)
-b, --block [block] Block number to start loading from
-R, --round [round] Round number to start loading from
-S, --singleRound [round] Load a single round and stop
--showGas Track gas statistics per block (chatty) (default: false)
--loadStakes Preload all stakes (takes a LONG time) (default: false)
-h, --help display help for command
If you're developing and want to build / extend on monsi - first, thank you! Community development and pull requests are always appreciated ❤️. To get started quickly developing:
git clone https://github.com/rndlabs/monsi # clone the source to your disk
npm i # install npm dependencies
After you have made the modifications for your PR / branch, you may start monsi
using ts-node
by:
node --experimental-specifier-resolution=node --loader=ts-node/esm ./src/index.ts --rpc-endpoint ws:https://<YourGoerliRPCIP:port>
monsi uses blessed for drawing its TUI (Text User Interface) and ethers for blockchain RPC
This package is written as an ES6 module and typechain
to generate ethers bindings for contract interaction. Currently, typechain
does not support generation of ES6-compatible modules, so the generated bindings need to be manually edited to ensure that the import paths are ES6-compliant.
Steps:
- If contract ABI is modified, remove all previously generated bindings in
src/types/contracts
. - Generate the bindings using:
npx typechain --target ethers-v5 --out-dir src/types/contracts "./contracts/**/*.json"
- Manually edit the generated bindings to ensure that all import paths include the
.js
suffix, or when importing a directory, they import theindex.js
within that directory.
monsi was originally written by @ldeffenb and was heavily based on monBee. @mfw78 graciously offered to restructure the original grungy monolithic code into something much more understandable, extendible, and maintainable. The result of this collaboration is the monsi that you see here.
Just don't run monsi for a long time if you use infura.io's (or any other provider's) free account because monsi monitors every single block and will eat up your 100,000 API hits in short order. No gETH, but every query is counted at infura.io, and monsi does LOTS of blockchain queries!
Having your own local goerli (gnosis in the future) RPC provider is strongly recommended!