The Playground 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 Playground server. If you have a database already running, you can set its connection string via
DB_CONNECTION_STRINGas an environment variable for the Playground 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/playground-server simply execute
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
playground-serverrestarts. In order to enable persistency across restarts, export the environment variable
Once the database is up and running, the Playground server can be started by executing:
If running the entire Playground (and not just the server), from the root of the monorepo, execute:
You can run tests at any time using:
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.
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 > require("ethers").Wallet.createRandom().mnemonic 'camera enter drive paper elegant camp above attend board thought inch crash'
And save it in
.env in the format specified in
Option 1 Compute the address:
$ node > const x = require("ethers").Wallet.createRandom().mnemonic; > require("ethers").utils.HDNode.fromMnemonic(x).derivePath("m/44'/60'/0'/25446").address '0x84D1C440f73DD5c20fA9a3a7CB8A24D5F70a753c'
Option 2 Read the logs of
playground-server when running it:
@counterfactual/playground-server: Node signer address: 0x84D1C440f73DD5c20fA9a3a7CB8A24D5F70a753c