Browser
This article provides a guide to deploy a browser with a tailored configuration to work better within a Confidential Computing deployment.
The Browser is a component that indexes the blockchain and provides a graphical user interface for inspecting smart contracts, blockchain accounts, and transactions. It is an optional tool any participating organization can use to explore the blockchain.
Database
The browser requires a PostgreSQL database used for storage. The database instructions in the data provider article can be used to create a database. The initialization script should additionally include the following:
CREATE
DATABASE cc_browser;
GRANT ALL PRIVILEGES ON DATABASE
cc_browser TO postgres;
Storage
Create the following folder structure on the host file-system:
├──browser/
│ ├──browser-frontend/
│ │ ├── conf/
│ │ │ ├──config.js
│ ├──browser-backend/
│ │ ├── conf/
│ │ │ ├──cache/
│ │ │ │ ├──contracts.json
│ │ │ ├──server.json
│ │ ├──logs/
Server configuration
The server.json
file should contain the following configuration:
{
"port": 8000, // (1)!
"database": { // (2)!
"persistenceUnitName": "model",
"driver": "org.postgresql.Driver",
"url": "jdbc:postgresql://cc-postgres:5432/cc_browser", // (3)!
"user": "postgres",
"password": "postgres"
},
"shards": [],
"nodes": ["BLOCKCHAIN_NODE_REST_URL"], // (4)!
"disableBlockProducerOrchestration": true,
"disableAccountPluginTraversal": true,
"addresses": {}
}
- REST endpoint port to access the browser backend service.
- Configures a hibernate database connection for the database.
- URL to access the database. Defaults are based on the example database configuration.
- List of blockchain node REST endpoints urls. Used to communicate with the blockchain.
- We recommend including the closest deployed node, e.g., if you are deploying a node yourself, add the url of the node you deployed to the list.
Contracts
The contracts.json
file, should contain the following:
[
{
"name": "Root Deploy",
"address": "04e13687dfc56c78302df5785d40bed80f52c188d0",
"blockTime": 0
}
]
Frontend Configuration
The config.js
frontend configuration file should contain the following:
var CONFIG = {
serverUrl: 'cc-browser-backend:8000', // (1)
blockchainUrl: 'BLOCKCHAIN_NODE_REST_URL', // (2)
blockchainShards: [],
blockTimeWarningThreshold: 20,
features: ['transactionPage', 'blockPage', 'accountPage', 'contractPage'],
addresses: {},
addressNames: {
'04e13687dfc56c78302df5785d40bed80f52c188d0': 'Root Deploy Contract',
'00c5dcb3bcf6f048b0a765184b55b3f8d89dea7377': 'Root Deployment User',
},
palette: {
primary: {
main: '#000000',
contrastText: '#FFFFFF',
},
secondary: {
main: '#1D70EA',
contrastText: '#FFFFFF',
},
tertiary: {
main: '#30A552',
contrastText: '#000000',
},
error: {
main: '#EB351C',
contrastText: '#000000',
},
warning: {
main: '#EB891C',
contrastText: '#000000',
},
info: {
main: '#1D70EA',
contrastText: '#FFFFFF',
},
success: {
main: '#30A552',
contrastText: '#000000',
},
text: {
primary: '#000000',
},
background: {
default: '#FFFFFF',
},
},
}
- The local url to communicate with the browser backend.
- Url to a blockchain node rest endpoint. Used to communicate with the blockchain. We recommend setting this to the closest deployed node, e.g., if you are deploying a node yourself, set the url to the url of the node you deployed.
Docker Configuration
Configure the authentication service docker image
by adding the following to your docker-compose.yml
file:
Click here to view: Browser - Example Docker Configuration
services:
confidential-computing-browser-frontend:
container_name: cc-browser-frontend
image: registry.gitlab.com/secata/pbc/browser/browser-frontend:latest
restart: unless-stopped
ports:
- "80:80"
volumes:
- /path/to/browser-frontend/conf:/conf
confidential-computing-browser-backend:
container_name: cc-browser-backend
image: registry.gitlab.com/secata/pbc/browser/browser-backend:latest
restart: unless-stopped
expose:
- 8000
environment:
JAVA_TOOL_OPTIONS: "-Xmx1536m"
volumes:
- /path/to/browser-backend/conf:/conf
- /path/to/browser-backend/logs:/logs
depends_on:
confidential-computing-postgres:
condition: service_healthy
The port mapping of the frontend is the port where to access the webpage on the local host network.
The exposed port of
the backend is where the frontend communicates with the backend service. This port should match the
port specified in the server.json
backend configuration file.
The mapped volumes of the two images should correspond to the folders created in the storage section.
Deploy the Components
- Open your terminal and navigate to the directory containing your
docker-compose.yml
file. -
Execute the following Docker Compose command to start the browser frontend and backend containers:
docker-compose up -d confidential-computing-browser-frontend confidential-computing-browser-backend
-
Check the logs of the authentication container to ensure they are running without errors:
docker logs -f confidential-computing-browser-frontend
docker logs -f confidential-computing-browser-backend