Skip to content
Browse files

[DDW 727] Frontend only laucnher & macOS integration instructions

  • Loading branch information...
Sam-Jeston committed Jul 12, 2019
1 parent d5eac7a commit d06d295b60417e73b4e1cdfa0fdb5b0ea889e8e0
@@ -90,3 +90,6 @@ package-lock.json
# cardano public keys

# Frontend launcher state
@@ -43,14 +43,27 @@ required dependencies for development.

## V2 API Integration Guide

### Linux
1. Ensure Docker and Docker Compose are installed on your machine
2. Clone the following repo: `git clone`
3. Start the demo cluster from the root of `cardano-byron-docker` by running `./daedalus/` (NB: Run all commands from the root folder of `cardano-byron-docker`). The initial pull is big, but after that the containers will start straight away. The size of these images is far from optimized
4. Run `nix-shell` from `daedalus`
5. Run `yarn dev` from the `nix-shell`
6. If required, import some funded wallets from `cardano-byron-docker` by running `./daedalus/`. This can only be done once `yarn dev` has been run as this script leverages the Wallet API that Daedalus starts.

### macOS
**There are no working macOS options for cardano-wallet. Nix or otherwise (except building from source with `stack`, which we consider to not be an option).**

To get around this, I have created the `yarn frontend` command and a complete Docker stack to start the integration. This runs Daedalus in frontendOnly mode, and hits a wallet running in a docker-compose stack**

1. _As above_
2. _As above_
3. Start the demo cluster from the root of `cardano-byron-docker` by running `./`. This command includes an edge node and instance of cardano-wallet.
4. From Daedalus, run `yarn frontend`. This prints the start command to the terminal.
5. Run the command printed to the terminal.

### V2 State of Affairs
- No macOS build options. While this remains the case, it will be impossible for most of the team to develop or test the new process management configuration.
- It doesn't appear possible to connect `cardano-http-bridge` to the local demo cluster when using `cardano-wallet launcher`. For now, we are using `cardano-http-bridge` declared in the docker stack, and using the `cardano-wallet serve` command instead.
- `cardano-wallet launcher` is not accepting the `--random-port` argument
- Lots of things have been temporarily commented out or mocked to get the integration started. As such using `git push --no-verify`. This will be cleaned up once more routes become available.
@@ -0,0 +1,5 @@
A nix free mode of operation for integrating with cardano-wallet, while macOS nix builds are broken

We put the state folder here un `/state` for ease of access and debugging during development.

This is a development tool only.
@@ -0,0 +1,37 @@
const fs = require('fs')
const rimraf = require('./lib/rimraf')
const createAndWriteX509 = require('./lib/x509')

// Declare our state directory for logging and tls certs
const stateDir = `${process.cwd()}/frontend-only-launcher/state`

// Cleanup previous state directory

// Create empty state dir

// Create TLS certificate location

// Create the logging directory

// Create TLS cert file (see below) in ${stateDir}/tls/client
// ca.crt client.key client.pem

// Specific env vars
const cardanoTlsPath = `${stateDir}/tls`

Start command:
CARDANO_TLS_PATH=${cardanoTlsPath} \\
CARDANO_HOST=localhost \\
LAUNCHER_CONFIG=${process.cwd()}/frontend-only-launcher/launcher-config-base.yaml \\
STATE_DIR=${stateDir} \\
yarn dev
@@ -0,0 +1,27 @@
walletLogging: false
- NA
statePath: ${STATE_DIR}
walletPath: daedalus-frontend
nodePath: NA
launcherLogsPrefix: ${STATE_DIR}/Logs/
walletArgs: []
nodeDbPath: NA
updaterPath: NA
workingDir: ${STATE_DIR}
frontendOnlyMode: false
nodeLogPath: null
updaterArgs: []
logsPrefix: ${STATE_DIR}/Logs
# This is related to the legacy node
seed: null
filePath: NA
key: NANA
systemStart: null
updateArchive: NA
nodeLogConfig: NA
nodeTimeoutSec: 60
updateWindowsRunner: null
tlsPath: ${STATE_DIR}/tls
x509ToolPath: NA
@@ -0,0 +1,17 @@
const fs = require('fs')
const path = require('path')

module.exports = function rimraf(dir) {
if (fs.existsSync(dir)) {
fs.readdirSync(dir).forEach((file) => {
const filePath = path.join(dir, file)
if (fs.lstatSync(filePath).isDirectory()) {
} else {

@@ -0,0 +1,80 @@
const { pki } = require('node-forge')
const fs = require('fs')

module.exports = function createAndWriteX509Cert(folder) {
const keys = pki.rsa.generateKeyPair(2048)
const cert = pki.createCertificate()
cert.publicKey = keys.publicKey

cert.serialNumber = '01'
cert.validity.notBefore = new Date()
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1);

const attrs = [{
name: 'commonName',
value: 'daedalus'
}, {
name: 'countryName',
value: 'HK'
}, {
shortName: 'ST',
value: 'NA'
}, {
name: 'localityName',
value: 'NA'
}, {
name: 'organizationName',
value: 'IOHK'
}, {
shortName: 'OU',
value: 'NA'

name: 'basicConstraints',
cA: true
}, {
name: 'keyUsage',
keyCertSign: true,
digitalSignature: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true
}, {
name: 'extKeyUsage',
serverAuth: true,
clientAuth: true,
codeSigning: true,
emailProtection: true,
timeStamping: true
}, {
name: 'nsCertType',
client: true,
server: true,
email: true,
objsign: true,
sslCA: true,
emailCA: true,
objCA: true
}, {
name: 'subjectAltName',
altNames: [{
type: 7, // IP
ip: ''

// self-sign certificate

// convert a Forge certificate to PEM
const crt = pki.certificateToPem(cert)
const key = pki.privateKeyToPem(keys.privateKey)
const pem = `${key}${crt}`

fs.writeFileSync(`${folder}/ca.crt`, crt)
fs.writeFileSync(`${folder}/client.key`, key)
fs.writeFileSync(`${folder}/client.pem`, pem)
@@ -30,7 +30,8 @@
"storybook:build": "build-storybook -c storybook -o dist/storybook",
"clear:cache": "gulp clear:cache",
"nix:dev": "nix-shell --arg autoStartBackend true --arg allowFaultInjection true --arg systemStart",
"nix:staging": "nix-shell --arg autoStartBackend true --argstr cluster staging"
"nix:staging": "nix-shell --arg autoStartBackend true --argstr cluster staging",
"frontend": "node frontend-only-launcher/index.js"
"bin": {
"electron": "./node_modules/.bin/electron"
@@ -97,6 +98,7 @@
"mini-css-extract-plugin": "0.5.0",
"minimist": "1.2.0",
"mobx-react-devtools": "6.0.3",
"node-forge": "^0.8.5",
"node-libs-browser": "2.1.0",
"node-sass": "4.11.0",
"nodemon": "1.18.9",
@@ -7685,6 +7685,11 @@ node-fetch@^2.2.0:
version "2.6.0"
resolved ""

version "0.8.5"
resolved ""
integrity sha512-vFMQIWt+J/7FLNyKouZ9TazT74PRV3wgv9UT4cRjC8BffxFbKXkgIWR42URCPSnHm/QDz6BOlb2Q0U4+VQT67Q==

version "3.4.0"
resolved ""
@@ -9171,13 +9176,13 @@ react-number-format@3.0.3:
version "0.8.7"
resolved ""
integrity sha512-0/JwkTb3btzFdnUY9mOJzFKEGIuzGCxQPW2TIOyqpeIvON73G36111ykxq3S2Sx+l37SRF90J5ClFYbZi0nP+g==
create-react-context "0.2.2"
create-react-ref "0.1.0"
filter-react-dom-props "0.0.2"
postinstall-build "5.0.1"
react-modal "3.1.12"
integrity sha512-0/JwkTb3btzFdnUY9mOJzFKEGIuzGCxQPW2TIOyqpeIvON73G36111ykxq3S2Sx+l37SRF90J5ClFYbZi0nP+g==

version "2.3.0"
@@ -11950,6 +11955,11 @@ yargs@^7.0.0, yargs@^7.0.2, yargs@^7.1.0:
y18n "^3.2.1"
yargs-parser "^5.0.0"

version "1.16.0"
resolved ""
integrity sha512-cfemyGlnWKA1zopUUgebTPf8C4WkPIZ+TJmklwcEAJ4u6oWPtJeAzrsamaGGh/+b1XWe8W51yzAImC4AWbWR1g==

version "2.4.1"
resolved ""

0 comments on commit d06d295

Please sign in to comment.
You can’t perform that action at this time.