Quickstart
We've developed a Dockerized version that can run both the React Demo and the Backend Demo applications together.
You can access the GitHub repository on Fireblocks' official GitHub account:
The application has the following components in it:
- Fireblocks React NCW Demo application - React demo application that utilizes the Fireblocks NCW Web SDK.
- Fireblocks Backend Demo application - Node.js (Express) backend server that is being used by the Front End for proxying the communication to the Fireblocks API
- Localtunnel - Exposing your local development environment to the external world and specifically to Fireblocks Webhook service
- MySQL Database
Localtunnel is employed in this context to make your local development environment accessible to external parties, primarily for configuring the necessary webhook setup, enabling Fireblocks to transmit the essential webhook messages to your backend system.
Setup
- Clone the repo to your machine:
git clone https://github.com/fireblocks/ncw-demo-dockerized.git
- Move into the cloned directory:
cd ncw-demo-dockerized
Configuration
In this demo we assume that the client application uses Firebase Authentication. We provide you with our own Firebase project credentials for your convenience but these can be easily overridden if required.
There are a few configuration files that should be configured before running the application.
/config/ncw_backend_demo/env.txt
- configuration file for the backend application. An example file would look like this:
NODE_ENV=production
PORT=3000
CMC_PRO_API_KEY=""
# Auth (Firebase demo example)
JWKS_URI=https://www.googleapis.com/service_accounts/v1/jwk/[email protected]
ISSUER=https://securetoken.google.com/fireblocks-sdk-demo
AUDIENCE=fireblocks-sdk-demo
# Fireblocks API
FIREBLOCKS_API_SECRET="-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAA\...\nqt1ADkJPmFybZIhEY+ubRIOf5w==\n-----END PRIVATE KEY-----"
FIREBLOCKS_API_KEY_NCW_SIGNER="5f5d261f-973c-4f18-bc3e-b9b35dd214d6"
FIREBLOCKS_API_KEY_NCW_ADMIN="e1607032-ad47-46b1-b358-69ab1785e738"
FIREBLOCKS_API_BASE_URL="https://sandbox-api.fireblocks.io/"
# Fireblocks sandbox webhook public key
FIREBLOCKS_WEBHOOK_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw+fZuC+0vDYTf8fYnCN6\n71iHg98lPHBmafmqZqb+TUexn9sH6qNIBZ5SgYFxFK6dYXIuJ5uoORzihREvZVZP\n8DphdeKOMUrMr6b+Cchb2qS8qz8WS7xtyLU9GnBn6M5mWfjkjQr1jbilH15Zvcpz\nECC8aPUAy2EbHpnr10if2IHkIAWLYD+0khpCjpWtsfuX+LxqzlqQVW9xc6z7tshK\neCSEa6Oh8+ia7Zlu0b+2xmy2Arb6xGl+s+Rnof4lsq9tZS6f03huc+XVTmd6H2We\nWxFMfGyDCX2akEg2aAvx7231/6S0vBFGiX0C+3GbXlieHDplLGoODHUt5hxbPJnK\nIwIDAQAB\n-----END PUBLIC KEY-----"
# Database
DB_HOST=mysql
DB_PORT=3306
DB_USERNAME=ncw_user
DB_PASSWORD=ncw_user_password
DB_NAME=ncw_demo
/config/ncw_web_demo/env.txt
- configuration file for the Frontend application. An example file would look like this:
VITE_AUTOMATE_INITIALIZATION=true
VITE_BACKEND_BASE_URL=http://localhost:3000
VITE_NCW_SDK_ENV=sandbox
/config/tunnel/env.txt
- configuration file for the Localtunnel application. An example file would look like this:
TUNNEL_SUBDOMAIN=my_ncw_subdomain
TARGET_PORT=3000
TARGET_HOST=ncw_backend_demo
/config/mysql/env.txt
- configuration file for the MySQL application. An example file would look like this:
MYSQL_ROOT_PASSWORD=test
Running the application
Run the following command: docker-compose up --build
The application should start the build process and output the webhook URL that should be configured in your Fireblocks console.
The webhook endpoint is exposed in the following route:
https://your_sub_domain.local.lt/api/webhook
Please make sure to configure it properly in the Fireblocks console:
The Frontend application would run on: http://localhost:5173
by default.
The Backend application would run on: http://localhost:3000
by default.
Usage
Please refer to 'React Demo App' and 'Backend Demo' sections for detailed usage explanation
Updated 11 months ago