{"id":20392310,"url":"https://github.com/wiseplat/gwsh-private","last_synced_at":"2026-05-09T08:05:10.141Z","repository":{"id":57259828,"uuid":"121372612","full_name":"WISEPLAT/gwsh-private","owner":"WISEPLAT","description":"Quickly setup a local, private Wiseplat blockchain.","archived":false,"fork":false,"pushed_at":"2018-02-13T11:06:00.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T09:48:11.212Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/WISEPLAT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T11:04:34.000Z","updated_at":"2023-05-22T19:07:12.000Z","dependencies_parsed_at":"2022-08-28T20:50:12.125Z","dependency_job_id":null,"html_url":"https://github.com/WISEPLAT/gwsh-private","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/WISEPLAT%2Fgwsh-private","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fgwsh-private/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fgwsh-private/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fgwsh-private/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WISEPLAT","download_url":"https://codeload.github.com/WISEPLAT/gwsh-private/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241941707,"owners_count":20046171,"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-15T03:43:17.697Z","updated_at":"2026-05-09T08:05:05.102Z","avatar_url":"https://github.com/WISEPLAT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gwsh-private\n\n[![Build Status](https://secure.travis-ci.org/hiddentao/gwsh-private.png?branch=master)](http://travis-ci.org/hiddentao/gwsh-private) [![NPM module](https://badge.fury.io/js/gwsh-private.png)](https://badge.fury.io/js/gwsh-private) [![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social\u0026label=Follow\u0026maxAge=2592000)](https://twitter.com/hiddentao)\n\nQuickly setup a local, private Wiseplat blockchain.\n\nFeatures:\n\n* Programmatic as well as command-line interface\n* Automatically enables IPC and RPC/CORS access\n* Override all options passed to the `gwsh` executable.\n* Override genesis block attributes including mining difficulty.\n* Execute console commands against the running gwsh instance.\n* Logging capture\n* Auto-mine (optional)\n* Works with [Mist wallet](https://github.com/wiseplat/mist)\n\n## Requirements:\n\n* Node.js v4 or above (you can install it using [nvm](https://github.com/creationix/nvm))\n* [Gwsh](https://github.com/wiseplat/go-wiseplat)\n\n## Installation\n\nI recommend installing gwsh-private as a global module so that the CLI becomes\navailable in your PATH:\n\n```bash\n$ npm install -g gwsh-private\n```\n\n## Usage\n\n### via command-line\n\n**Quickstart**\n\n```bash\n$ gwsh-private\n```\n\nYou should see something like:\n\n```bash\ngwsh is now running (pid: 2428).\n\nWisebase:  8864324ac84c3b6c507591dfabeffdc1ad02e09b\nData folder:  /var/folders/br6x6mlx113235/T/tmp-242211yX\n\nTo attach:  gwsh attach ipc:///var/folders/br6x6mlx113235/T/tmp-242211yX/gwsh.ipc\n```\n\n*Note: gwsh-private runs Gwsh on port 60303 by default with networkid 33333*\n\nDefault account password is `1234` :)\n\nRun the `attach` command given to attach a console to this running gwsh\ninstance. By default [web3](https://github.com/wiseplat/web3.js) RPC is also\nenabled.\n\nOnce it's running launch the Wiseplat/Mist wallet with the `--rpc http://localhost:8545` CLI option - it should be able to\nconnect to your gwsh instance.\n\n\n**Options**\n\n```\nUsage: gwsh-private [options]\n\nOptions:\n  --balance       Auto-mine until this initial Wise balance is achieved (default: 0)\n  --autoMine     Auto-mine indefinitely (overrides --balance option)\n  --gwshPath      Path to gwsh executable to use instead of default\n  --genesisBlock  Genesis block overrides as a JSON string\n  -v              Verbose logging\n  -h, --help      Show help                                                [boolean]\n  --version       Output version.\n\nAll other options get passed onto the gwsh executable.\n```\n\nYou can also pass options directly to gwsh. For example, you can customize\nnetwork identity, port, etc:\n\n```bash\n$ gwsh-private --port 10023 --networkid 54234 --identity testnetwork\n```\n\nBy default gwsh-private stores its keystore and blockchain data inside a\ntemporarily generated folder, which gets automatically deleted once it exits.\nYou can override this behaviour by providing a custom location using the\n`datadir` option:\n\n```bash\n$ gwsh-private --datadir /path/to/data/folder\n```\n\nWhen gwsh-private exits it won't auto-delete this data folder since you\nmanually specified it. This allows you to re-use once created keys and\naccounts easily.\n\n\n### via API\n\n\n```js\nvar gwsh = require('gwsh-private');\n\nvar inst = gwsh();\n\ninst.start()\n  .then(function() {\n    // do some work\n  });\n  .then(function() {\n    // stop it\n    return inst.stop();\n  });\n  .catch(function(err) {\n    console.error(err);\n  })\n\n```\n\nSame as for the CLI, you can customize it by passing options during construction:\n\n```js\nvar gwsh = require('gwsh-private');\n\nvar inst = gwsh({\n  balance: 10,\n  gwshPath: '/path/to/gwsh',\n  verbose: true,\n  gwshOptions: {\n    /*\n      These options get passed to the gwsh command-line\n\n      e.g.\n\n      mine: true\n      rpc: false,\n      identity: 'testnetwork123'\n    */\n  },\n  genesisBlock: {\n    /*\n      Attribute overrides for the genesis block\n\n      e.g.\n\n      difficulty: '0x400'\n    */\n  }\n});\n\ninst.start().then(...);\n```\n\nYou can execute web3 commands against the running gwsh instance:\n\n```js\nvar inst = gwsh();\n\ninst.start()\n  .then(() =\u003e {\n    return inst.consoleExec('web3.version.api');\n  })\n  .then((version) =\u003e {\n    console.log(version);\n  })\n  ...\n```\n\n### Mining\n\nTo start and stop mining:\n\n```js\nvar inst = gwsh();\n\ninst.start()\n  .then(() =\u003e {\n    return inst.consoleExec('miner.start()');\n  })\n  ...\n  .then(() =\u003e {\n    return inst.consoleExec('miner.stop()');\n  })\n  ...\n```\n\nIf you've never mined before then Gwsh will first generate a [DAG](https://github.com/wiseplat/wiki/wiki/Wshash-DAG), which\ncould take a while. Use the `-v` option to Gwsh's logging.\n\nIf your machine is mining too quickly and producing multiple blocks with the\nsame number then you may want to increase the mining `difficulty` in the genesis\nblock:\n\n```js\nvar inst = gwsh({\n  genesisBlock: {\n    difficulty: '0x10000000000'\n  }\n});\n\ninst.start();\n...\n```\n\nYou can also do this via the CLI:\n\n```bash\n$ gwsh-private --genesisBlock '{\"difficulty\":\"0x10000000\"}'\n```\n\n_NOTE: the `--balance` option will make gwsh-private automatically mine until\nthe given Wise balance is achieved._\n\n\n## Logging capture\n\nWhen using the programmatic API you can capture all output logging by passing\na custom logging object:\n\n```js\nvar inst = gwsh({\n  verbose: true,\n  logger: {\n    debug: function() {...},\n    info: function() {...},\n    error: function() {...}\n  }\n});\n\ninst.start();\n```\n\n\n## Development\n\nTo run the tests:\n\n```bash\n$ npm install\n$ npm test\n```\n\n## Contributions\n\nContributions are welcome. Please see CONTRIBUTING.md.\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fgwsh-private","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiseplat%2Fgwsh-private","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fgwsh-private/lists"}