Nicer Package Manager


    0.0.15 • Public • Published

    Simple Hub Server

    The Simple Hub Server provides several services for the Playground, including:

    • Account login and registration
    • Matchmaking, used to provide a multiplayer experience for the demo dApps.
    • Multisig creation, to enable deposits on the onboarding flow

    It also operates as an intermediary Node between peers.


    Successfully running the server requires 2 steps:

    • Funding the server's ETH account: The server must have access to funds which it uses to deploy multisignature wallet contracts and collateralize channels. To fund the server, follow the funding instructions.
    • Having a relational database to store users connecting to the Simple Hub Server. If you have a database already running, you can set its connection string via DB_CONNECTION_STRING as an environment variable for the Simple Hub Server to connect to. For example, the default connection string used is

    If no database is locally running, you can either install Postgres or if you're already running Docker, in packages/simple-hub-server simply execute

    docker-compose up

    which will start a Postgres instance for you and expose it on port 5432.

    The database gets auto-configured with the right schema if the appopriate table doesn't exist.

    • (Optional) By default the local in-memory Firebase instance is volatile which means that all open channels will have to be re-created after simple-hub-server restarts. In order to enable persistency across restarts, export the environment variable export PLAYGROUND_PERSISTENCE_ENABLED=true

    Once the database is up and running, the Simple Hub Server can be started by executing:

    yarn start

    If running the entire Playground (and not just the server), from the root of the monorepo, execute:

    yarn run:playground

    You'll need a database (local or remote) to store account data there. By default, we recommend using PostgreSQL, but since we connect to it via Knex, you can configure any database you want.


    You can run tests at any time using:

    yarn test

    Instead of using the regular PostgreSQL database, the test scope uses a volatile SQLite DB. Keep in mind that any schema changes you do on the real DB, you'll need to apply them to the SQLite schema creation as well.

    Environment settings

    Unlike other packages, the Server relies on a .env-cmdrc which allows to configure multiple environments in the same file. See env-cmd's reference for more information on how it works.

    Funding the Hub Account for Playground Testing

    Where do I send Kovan ETH for testing?

    First of all, you need to generate a mnemonic:

    $ node
    > const ethers = require("ethers")
    > ethers.utils.HDNode.fromMnemonic(ethers.Wallet.createRandom().mnemonic).extendedKey

    And save it in .env in the format specified in .env.schema.

    Option 1 Compute the address:

    $ node
    > const ethers = require("ethers")
    > const xprv = ethers.utils.HDNode.fromMnemonic(ethers.Wallet.createRandom().mnemonic).extendedKey
    > ethers.utils.HDNode.fromExtendedKey(xprv).derivePath("m/44'/60'/0'/25446").address

    Option 2 Read the logs of simple-hub-server when running it:

    @counterfactual/simple-hub-server: Node signer address: 0x84D1C440f73DD5c20fA9a3a7CB8A24D5F70a753c




    npm i @counterfactual/simple-hub-server

    DownloadsWeekly Downloads






    Unpacked Size

    48.9 kB

    Total Files


    Last publish


    • alonbukai
    • cf19drofxots
    • ebryn
    • joelalejandro
    • snario