{"id":20392331,"url":"https://github.com/wiseplat/npm2-gwsh-private","last_synced_at":"2026-07-04T07:32:56.212Z","repository":{"id":122792542,"uuid":"130824427","full_name":"WISEPLAT/npm2-gwsh-private","owner":"WISEPLAT","description":"Quickly setup a local, private Wiseplat blockchain.","archived":false,"fork":false,"pushed_at":"2018-04-24T08:50:29.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T09:21:57.699Z","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":"lgpl-3.0","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":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-24T08:48:29.000Z","updated_at":"2023-05-22T19:06:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"76b3a8d0-ad11-4c0c-bc6f-487daf072972","html_url":"https://github.com/WISEPLAT/npm2-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%2Fnpm2-gwsh-private","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fnpm2-gwsh-private/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fnpm2-gwsh-private/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fnpm2-gwsh-private/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WISEPLAT","download_url":"https://codeload.github.com/WISEPLAT/npm2-gwsh-private/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241941709,"owners_count":20046172,"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:23.264Z","updated_at":"2026-07-04T07:32:56.177Z","avatar_url":"https://github.com/WISEPLAT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gwsh-private\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* Auto-mine initial balance (optional)\n* Works with [Mist wallet](https://github.com/wiseplat/mist)\n\n_Thanks to [Ade Duke](http://adeduke.com/2015/08/how-to-create-a-private-wiseplat-chain/) for original how-to._\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 npm2-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/4v/br6x6mlx113235v1lz39nwfc0000gn/T/tmp-242211yXIVsOX5tP\n\nTo attach:  gwsh attach ipc:///var/folders/4v/br6x6mlx113235v1lz39nwfc0000gn/T/tmp-242211yXIVsOX5tP/\n```\n\nDefault account password is `1234`, and the preset balance is 5,000,000 \nwise - plenty to play around with :)\n\nRun the `attach` command given to attach a console to this running gwsh \ninstance. By default [web3](https://github.com/wiseplat/npm2-web3.js) RPC is also \nenabled.\n\nOnce it's running launch the Wiseplat/Mist wallet as normal - 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  --gwshPath       Path to gwsh executable to use instead of default\n  --genesisBlock  Genesis block overrides as a JSON string\n  -h, --help      Show help                                                [boolean]\n  --version       Output version.\n\nAll other options get passed onto the gwsh executable.\n```\n\nFor example, you can customize network 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('npm2-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('npm2-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 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## 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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fnpm2-gwsh-private","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiseplat%2Fnpm2-gwsh-private","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fnpm2-gwsh-private/lists"}