Installation
Run your own Ethernal instance

Prerequisites

Node.js: v12.9.1 minimum
Yarn: 1.3.2

Core Setup

Install the Firebase CLI:
1
curl -sL firebase.tools | bash
Copied!
1
git clone [email protected]:tryethernal/ethernal.git
2
cd ethernal
Copied!
Initialize Firebase with the following options:
  • Realtime Database
  • Firestore
  • Functions
  • Emulators
When asked to overwrite database.rules.json, firestore.rules.json, and firestore.indexes.json, say No.
Leave the default for the Firestore rules (firestore.rules), and Firestore indexes (firestore.index.json)
Choose Javascript when asked which language to pick for Cloud functions.
For ESLint/style enforcement, choose No
Do not overwrite functions/package.json functions/index.js and functions/.gitignore
Choose Yes when asked to install dependencies with npm now
For the emulator setup, leave all the default selected options and validate everything.
Login with:
1
firebase login
Copied!
The Fiebase setup should be done now!
Install all the frontend dependencies by running
1
yarn
Copied!
Setup frontend environment variables:
1
touch .env.development
Copied!
Inside this file:
1
VUE_APP_FIREBASE_API_KEY=123
2
VUE_APP_FIREBASE_PROJECT_ID=ethernal-1234
3
VUE_APP_AUTH_HOST=http://localhost:9099
4
VUE_APP_FIRESTORE_HOST=localhost:8080
5
VUE_APP_RTDB_HOST=localhost:9000
6
VUE_APP_FIREBASE_DATABASE_URL=http://localhost:9000/?ns=ethernal-1234-default-rtdb
7
VUE_APP_FUNCTIONS_HOST=http://localhost:5001
8
VUE_APP_API_ROOT_URL=http://localhost:8081
9
VUE_APP_ROOT_URL=http://localhost:8081
10
VUE_APP_ETHERSCAN_API_KEY=youretherscankey
11
VUE_APP_STRIPE_PUBLIC_KEY=yourstripetestkey
Copied!
Replace the Etherscan API key with your own, same for the Stripe public key.
Setup backend environment variables:
1
cd functions/
2
touch .runtimeconfig.json
Copied!
Inside this file:
1
{
2
"encryption": {
3
"jwt_secret": "jwtsecret",
4
"key": "jwtkey"
5
},
6
"fb": {
7
"token": "yourcitoken"
8
},
9
"etherscan": {
10
"token": "yourtoken"
11
},
12
"stripe": {
13
"public_key": "stripepublickey",
14
"secret_key": "stripesecretkey",
15
"webhook_secret": "webhooksecret"
16
},
17
"ethernal": {
18
"root_url": "http://localhost:8081",
19
"plans": {
20
"premium": "premium_plan"
21
}
22
}
23
}
Copied!
Fill with:
  • encryption.jwt_secret: 64 characters
  • ecnryption.key: 32 characters
  • fb.token: Your Firebase CI token that you can get by running firebase login:ci
  • etherscan.token: your Etherscan API token
  • stripe.public_key: Any string
  • stripe.secret_key: Any string
  • stripe.webhook_secret: Any string
  • ethernal.root_url: the url of your app
  • ethernal.plans.premium: Any string
Run the backend on the emulator with:
1
firebase emulators:start --import=./firebase-emulator --export-on-exit --project ethernal-1234
Copied!
Run the frontend with:
1
yarn serve
Copied!
The import option will make the data persistent.

Hardhat Plugin Setup

Production Firebase instance

By default, the plugin is going to connected to the Firebase instance used by https://app.tryethernal.com. To make it connect to your own instance, you'll need to set the environment variables that are defined in this file: https://github.com/tryethernal/hardhat-ethernal/blob/v0.3.5/src/config.ts
You can also specify them only when running the node:
1
FIREBASE_API_KEY=123 FIREBASE_PROJECT_ID=ethernal npx hardhat node
Copied!

Local Emulator

To connect to the local emulator, you need to pass specific environment variables that will trigger the dev mode:
1
NODE_ENV=development AUTH_HOST=http://localhost:9099 FUNCTIONS_HOST=http://localhost:5001 RTDB_HOST=localhost:9000 FIRESTORE_HOST=localhost:8080 npx hardhat node
Copied!

CLI Setup

Production Firebase Instance

TODO

Local Emulator

Create a .envfile:
1
touch .env
Copied!
With the following inside:
1
AUTH_HOST=http://localhost:9099
2
FUNCTIONS_HOST=http://localhost:5001
3
RTDB_HOST=localhost:9000
4
FIRESTORE_HOST=localhost:8080
Copied!
And run:
1
NODE_ENV=development ethernal listen
Copied!
Last modified 1mo ago