{"id":19952935,"url":"https://github.com/ethersphere/eth-utils","last_synced_at":"2025-05-03T19:31:03.058Z","repository":{"id":30389633,"uuid":"33942321","full_name":"ethersphere/eth-utils","owner":"ethersphere","description":"ethereum utilities, dev tools, scripts, etc","archived":false,"fork":false,"pushed_at":"2018-06-14T15:28:24.000Z","size":13,"stargazers_count":148,"open_issues_count":8,"forks_count":85,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-07T20:21:24.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethersphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-14T16:06:31.000Z","updated_at":"2025-03-15T13:34:12.000Z","dependencies_parsed_at":"2022-07-28T01:39:39.564Z","dependency_job_id":null,"html_url":"https://github.com/ethersphere/eth-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Feth-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Feth-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Feth-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Feth-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethersphere","download_url":"https://codeload.github.com/ethersphere/eth-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252241964,"owners_count":21717080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:14:49.422Z","updated_at":"2025-05-03T19:31:02.799Z","avatar_url":"https://github.com/ethersphere.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## eth-utils\n\nethereum utilities, dev tools, scripts, etc\n\n* `gethup.sh`: primitive wrapper to [geth](https://github.com/ethereum/go-ethereum)\n* `gethcluster.sh`: launch local clusters non-interactively (https://github.com/ethereum/go-ethereum/wiki/Setting-up-private-network-or-local-cluster)\n* `netstatconf.sh`: auto-generate the json config of your local cluster for netstat (https://github.com/ethereum/go-ethereum/wiki/Setting-up-monitoring-on-local-cluster)\n\n##  Usage\n\n### Launch an instance \n\n```\nGETH=./geth bash /path/to/eth-utils/gethup.sh \u003crootdir\u003e \u003cdd\u003e \u003crun\u003e \u003cparams\u003e...\n```\n\nThis will\n- if it does not exist yet, then create an account with password _dd_ [NEVER USE THIS LIVE]\n- bring up a node with instance id _dd_ (double digit)\n- using _rootdir/dd_ as data directory (where blockchain etc. are stored)\n- listening on port _303dd_, (like 30300, 30301, ...)\n- with the account unlocked\n- launching json-rpc server on port _81dd_ (like 8100, 8101, 8102, ...)\n- extra params are passed to `geth` \n\n```\n$ GETH=./geth bash ~/eth-utils/gethup.sh ~/tmp/eth/ 04 09 --mine console \nWelcome to the FRONTIER\n\u003e eth.getBalance(eth.coinbase)\n'198400000000001'\n\u003e\n```\n\n### Launch a cluster \nRunning a cluster of 8 instances under dir `tmp/eth/` isolated on local eth network (id 3301), launch 05. Give external IP and pass extra param `--mine`.\n\n```\nGETH=./geth bash gethcluster.sh \u003croot\u003e \u003cn\u003e \u003cnetwork_id\u003e \u003crunid\u003e \u003cIP\u003e [[params]...]\n```\n\nThis will set up a local cluster of nodes\n- `\u003cn\u003e` is the number of clusters\n- `\u003croot\u003e` is the root directory for the cluster, the nodes are set up \n  with datadir `\u003croot\u003e/00`, `\u003croot\u003e/01`, ...\n- new accounts are created for each node\n- they listening on port _303dd_ (like 30300, 30301, ...)\n- json-rpc server is launched on port _81dd_ (like 8100, 8101, ...)\n- by collecting the nodes' node-urls, they get connected to each other\n- if enode has no IP, `\u003cIP\u003e` is substituted\n- if `\u003cnetwork_id\u003e` is not 0, they will not connect to a default client,\n  resulting in a private isolated network\n- the nodes log into `\u003croot\u003e/00.\u003crunid\u003e.log`, `\u003croot\u003e/01.\u003crunid\u003e.log`, ...\n- `\u003crunid\u003e` is just an arbitrary tag or index you can use to log multiple \n  subsequent launches of the same cluster, I recommend sequential double digit ids\n- the cluster can be killed with `killall -QUIT geth` (FIXME: should record PIDs)\n- the nodes can be restarted from the same state individually using the `gethup.sh` script\n- if you want to interact with the nodes, use a json-rpc client\n- you can supply additional params on the command line which will be passed \n  to `gethup.sh` and eventually to `geth` for each node, for instance `-vmodule=http=6 -mine -minerthreads=8` is a good one.\n\n```\nGETH=./geth bash gethcluster.sh ./leagues/3301/cicada 2 3301 05 77.160.58.3 -mine \nlaunching node 0/2 ---\u003e tail -f ./leagues/3301/cicada/00.05.log\nWelcome to the FRONTIER\nlaunching node 1/2 ---\u003e tail -f ./leagues/3301/cicada/01.05.log\nWelcome to the FRONTIER\n```\n\nfill create:\n```\n./leagues/3301/cicada/\n./leagues/3301/cicada/3301/\n./leagues/3301/cicada/3301/00/\n./leagues/3301/cicada/3301/00.05.log\n./leagues/3301/cicada/3301/00.05.glog\n./leagues/3301/cicada/3301/01/\n./leagues/3301/cicada/3301/01.05.log\n./leagues/3301/cicada/3301/01.05.glog\n./leagues/3301/cicada/3301/\n```\n\nYou can kill and restart individual nodes or the entire cluster safely, by using different runid you can separate logs for the individual runs in a neat way.\n\n```\nkillall -QUIT geth\n```\n\nUsing the `-QUIT` signal is very useful because it dumps the stacktrace into the glog file which you can attach to any bugreport or issue. \n\n### Monitor your local cluster:\n\n\n#### Installing the eth-netstats monitor\n\n```\ngit clone https://github.com/cubedro/eth-netstats\ncd eth-netstats\nnpm install\n```\n\n####Configuring netstat for your cluster\n\n```\nbash /path/to/eth-utils/netstatconf.sh \u003cnumber_of_clusters\u003e \u003cname_prefix\u003e \u003cws_server\u003e \u003cws_secret\u003e \n```\n\n- will output resulting app.json to stdout\n- `number_of_clusters` is the number of nodes in the cluster.\n- `name_prefix` is a prefix for the node names as will appear in the listing.\n- `ws_server` is the eth-netstats server. Make sure you write the full URL, for example: http://localhost:3000.\n- `ws_secret` is the eth-netstats secret.\n\nFor example:\n\n```\ngit clone https://github.com/ethersphere/eth-utils\ncd eth-utils\nbash ./netstatconfig.sh 8 cicada http://localhost:3301 kscc \u003e ~/leagues/3301/cicada.json\n```\n\n####Installing eth-net-intelligence-api\n\n```\ngit clone https://github.com/cubedro/eth-net-intelligence-api\ncd eth-net-intelligence-api\nnpm install\nsudo npm install -g pm2\n```\n\n#### Starting the eth-net-intelligence-api\n\nto start the eth-net-intelligence-api client for your cluster\n\n```\ncd eth-net-intelligence-api\npm2 start ~/leagues/3301/cicada.json\n[PM2] Process launched\n[PM2] Process launched\n┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐\n│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │\n├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤\n│ cicada-0 │ 1  │ fork │ 93855 │ online │ 0       │ 0s     │ 10.289 MB   │ disabled │\n│ cicada-1 │ 2  │ fork │ 93858 │ online │ 0       │ 0s     │ 10.563 MB   │ disabled │\n└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘\n Use `pm2 show \u003cid|name\u003e` to get more details about an app\n```\n\n\n####Starting the monitor \n\nUse your own eth-netstat server to monitor a league on a port corresponding to a league\n\n```\ncd eth-netstat\nPORT=3301 WS_SECRET=kscc npm start \u0026\n```\n\nand enjoy:\n```\nopen http://localhost:3301\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethersphere%2Feth-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethersphere%2Feth-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethersphere%2Feth-utils/lists"}