ex-CBDC Sandbox Deployment Issues

Hi everyone.

I’ve been working on deploying Ex-CBDC Project on Ubuntu Linux.

Application got built successfully and while running the launchers, launchers/ui is returning the following error:


./daml.js/banking-1.0.0/lib/Banking/Role/Bank/module.js
`Module not found: Can't resolve '@daml.js/40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7' in '/home/ubuntu/ex-cbdc/ui/daml.js/banking-1.0.0/lib/Banking/Role/Bank'

Can someone please help me resolve this issue? Thanks.

Hi @mvresh, welcome to the Daml forum.

I have looked at the issue now and wasn’t able to reproduce it.
However, I did encounter the error in the past.
It seems to be an issue with the interplay between the generated packages and the versions fixed in the package-lock.json.

Could you try going into the ui folder, deleting the package-lock.json, and then running npm install?
After that, you could retry launching the UI through the launcher script.

If this doesn’t work you could try deleting both package-lock.json as well as the node_modules folder before running npm install.

Please let me know if this has worked for you.

Hi @Darko Thanks for your response. Its working now after following your instructions.

However, I’m unable to issue any funds as USFRB or ECB. Its saying “Transfer Failed: Insufficient funds” even when I’m issuing the funds.

I tried going through the “Demo User Guide” but it doesnt mention issuance anywhere.

Hi @mvresh,

I’m happy to hear that you got it to work.

The Issuance step creates the currency on the account of the Central Bank itself.
I.e. if you act as USFRB, and issue USD, you will increase the amount of USD that the USFRB holds on its own account.

The reason why it is not mentioned in the “Demo User Guide” is that both banks already have a certain amount of USD and EUR respectively. So you don’t need to do that step.

What you need to do is to transfer USD from the USFRB to one commercial bank, and transfer EUR from the ECB to the other commercial bank.
This will move USD from the USFRB account to the target commercial bank’s account.

After this step, the commercial banks can do a PvP between each other.

I hope this was helpful.

Currently, its showing 0 for central banks (USFRB and ECB).

Assuming that central banks have some funds to begin with, to showcase different scenarios - then issuance isn’t needed. But I’m interested to check if issuance is possible. How can I test that?

Can I assume that

  1. Sandbox is running (i.e. you have a terminal that is running ./launchers/sandbox)
  2. JSON API is running (i.e. you have a terminal that is running ./launchers/jsonapi)
  3. The automation is running (i.e. you have a terminal that is running ./launchers/automation)
  4. You have populated the ledger (i.e. you ran ./launchers/populate)

Only if you have done all these things, you should both have money in the accounts of central banks, and you should be able to issue new money.

I’m assuming that you have not executed one or more of the scripts above, so when you start the UI it doesn’t have a connection to a ledger.

Yes, all the launchers are running and I even tried running the launchers/populate after running the ui launcher.

I’m attaching each terminal’s output here for reference.

launchers/sandbox
19:28:20.355 [sandbox-akka.actor.default-dispatcher-5] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
19:28:28.738 [program-resource-pool-1] INFO  c.d.p.apiserver.LedgerApiServer - Listening on localhost:6865 over plain text.
   ____             ____
  / __/__ ____  ___/ / /  ___ __ __
 _\ \/ _ `/ _ \/ _  / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\

19:28:28.752 [program-resource-pool-3] INFO  com.daml.platform.sandboxnext.Runner - Initialized sandbox version 1.18.1 with ledger-id = demo, port = 6865, dar file = List(reset/.daml/dist/reset-1.0.0.dar, testing/.daml/dist/testing-1.0.0.dar), time mode = wall-clock time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
launchers/jsonapi
12-04-2022 19:29:04.745 [main] INFO  com.daml.http.Main - Config(ledgerHost=localhost, ledgerPort=6865, address=127.0.0.1, httpPort=4000, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,None,REQUIRE,false,None), jdbcConfig=None, staticContentConfig=None, allowNonHttps=true, wsConfig=None, nonRepudiationCertificateFile=None, nonRepudiationPrivateKeyFile=None, nonRepudiationPrivateKeyAlgorithm=None, surrogateTpIdCacheMaxEntries=None), context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:05.103 [http-json-ledger-api-akka.actor.default-dispatcher-4] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
12-04-2022 19:29:05.402 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO  com.daml.http.HttpService - HTTP Server pre-startup, context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:05.642 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO  com.daml.http.LedgerClient - Attempting to connect to the ledger localhost:6865 (600 attempts), context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:06.020 [http-json-ledger-api-akka.actor.default-dispatcher-10] INFO  com.daml.http.LedgerClient - Attempting to connect to the ledger localhost:6865 (600 attempts), context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:06.022 [http-json-ledger-api-akka.actor.default-dispatcher-8] INFO  com.daml.http.LedgerClient - Attempt 1/600 succeeded!, context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:06.025 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO  com.daml.http.HttpService - contractDao: None, context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:06.031 [http-json-ledger-api-akka.actor.default-dispatcher-9] INFO  com.daml.http.LedgerClient - Attempt 1/600 succeeded!, context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
12-04-2022 19:29:06.542 [http-json-ledger-api-akka.actor.default-dispatcher-9] INFO  com.daml.http.Main - Started server: (ServerBinding(/127.0.0.1:4000),None), context: {instance_uuid: "536f8c21-1840-462c-9767-695d67b20995"}
launchers/automation
Waiting for 11807
19:29:55.931 [TriggerRunner-akka.actor.default-dispatcher-8] INFO  com.daml.lf.engine.trigger.Runner - Trigger  is running as BankA with readAs=[] , context: {triggerDefinition: "1a9c20eaa19330e4a6cb27957217b6ca00e1e2d594ff7f5ad02094ee51ae79e2:Testing.Triggers.AutoSettle:autoSettleTrigger"}
launchers/populate
[DA.Internal.Prelude:555]: "Started: Ledger Setup"
[DA.Internal.Prelude:555]: "Started: Create demoAdmin role"
[DA.Internal.Prelude:555]: "Finished: Create demoAdmin role"
[DA.Internal.Prelude:555]: "Started: Create USD FRB role"
[DA.Internal.Prelude:555]: "Finished: Create USD FRB role"
[DA.Internal.Prelude:555]: "Started: FRB invites BankA"
[DA.Internal.Prelude:555]: "Finished: FRB invites BankA"
[DA.Internal.Prelude:555]: "Started: FRB invites BankB"
[DA.Internal.Prelude:555]: "Finished: FRB invites BankB"
[DA.Internal.Prelude:555]: "Started: Create EUR ECB role"
[DA.Internal.Prelude:555]: "Finished: Create EUR ECB role"
[DA.Internal.Prelude:555]: "Started: ECB invites BankA"
[DA.Internal.Prelude:555]: "Finished: ECB invites BankA"
[DA.Internal.Prelude:555]: "Started: ECB invites BankB"
[DA.Internal.Prelude:555]: "Finished: ECB invites BankB"
[DA.Internal.Prelude:555]: "Started: Issue USD to Federal Reserve Bank"
[DA.Internal.Prelude:555]: "Finished: Issue USD to Federal Reserve Bank"
[DA.Internal.Prelude:555]: "Started: Issue EUR to European Central Bank"
[DA.Internal.Prelude:555]: "Finished: Issue EUR to European Central Bank"
[DA.Internal.Prelude:555]: "Started: Earmarked CBDC / rent invoice setup"
[DA.Internal.Prelude:555]: "Started: Create Landlord's account"
[DA.Internal.Prelude:555]: "Finished: Create Landlord's account"
[DA.Internal.Prelude:555]: "Started: Create renter's account"
[DA.Internal.Prelude:555]: "Finished: Create renter's account"
[DA.Internal.Prelude:555]: "Started: Landlords association"
[DA.Internal.Prelude:555]: "Finished: Landlords association"
[DA.Internal.Prelude:555]: "Started: A landlord"
[DA.Internal.Prelude:555]: "Finished: A landlord"
[DA.Internal.Prelude:555]: "Started: Central Bank creates proposal of EconomicSectorCertificate"
[DA.Internal.Prelude:555]: "Finished: Earmarked CBDC / rent invoice setup"
[DA.Internal.Prelude:555]: "Finished: Ledger Setup"

Also, I tried implementing it using DAML Hub and ran into an issue there as well. Here’s the github issue link: "Failed to compile" error while using DAML Hub · Issue #58 · digital-asset/ex-cbdc · GitHub

@Darko any help is greatly appreciated. Trying to get the sandbox working to see what functionalities it has and to make some changes if possible. But currently I’m facing issues running it.

@mvresh, I’ve tried to recreate the issue that you are seeing. Could you please try to run the populate script before starting the UI, or refresh the UI after populating the ledger?

Could you also post the log of the UI? I would like to verify that the connection to the backend is working as it is supposed to.

@Darko I tried both the approaches. In both the cases, its showing zero funds.

While running launchers/ui in a separate terminal, some error comes up prior to compiling(which only lasts for a second on the screen) so couldnt quite see what it says. Something related to proxy script and then it starts compiling after which its running successfully on port 3000. Also, I’m running the whole setup on AWS EC2 box, exposing the port 3000 so that I can access UI via public IP on 3000 port.

Also I couldnt find UI logs anywhere. Can you please tell me where to find them?

One other question - how can I verify if the ledger is setup properly? Currently when I run launchers/populate I can see in the terminal output that its creating and issuing but I wonder if I can query the ledger directly.

In order to see the logs of the UI you can simply have a look at the command line interface after you have started the launchers/ui script.
You could also open the developer tools within google chrome while you the App is open, and have a look at the console.

Are you certain that the UI process has a working connection to the json API? Typically the UI is trying to connect to localhost:4000 - is the json API running on the same machine?

If you want to inspect the ledger, you can use the navigator tool. You can run it by executing
daml navigator server <ledger-host (default: localhost)> <ledger-port (default: 6865)> --port <navigator-port (default:4000)>
It will then expose the navigator web application on localhost:<navigator-port>.

But all the issues you are facing points toward the UI not having a proper connection to the backend.
So it’s either the connection between UI <-> Json API, or the connection between Json API <-> Sandbox.

Thanks @Darko I couldnt find any logs in the UI terminal but found these warnings and errors in the console

WebSocket connection to 'ws:<URL>/BankA/v1/stream/query' failed: WebSocket is closed before the connection is established.
index.ts:490 WebSocket connection to 'ws://localhost:3000/USFRB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.ts:490 WebSocket connection to 'ws://localhost:3000/USFRB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.ts:490 WebSocket connection to 'ws://localhost:3000/USFRB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.ts:490 WebSocket connection to 'ws://localhost:3000/ECB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.ts:490 WebSocket connection to 'ws://localhost:3000/ECB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.ts:490 WebSocket connection to 'ws://localhost:3000/ECB/v1/stream/query' failed: WebSocket is closed before the connection is established.
QueryStreamsManager.handleQueriesChange @ index.ts:490
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
5WebSocket connection to 'ws:<URL>/BankB/v1/stream/query' failed: WebSocket is closed before the connection is established.
static.highly.co/images/sample-slack.png:1          GET https://static.highly.co/images/sample-slack.png net::ERR_NAME_NOT_RESOLVED
Image (async)
(anonymous) @ foundation-chrome-content.js:1
index.ts:494 WebSocket connection to 'ws://localhost:3000/DemoAdmin/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
index.js:1 useStreamQueries: WebSocket connection failed.
console.<computed> @ index.js:1
(anonymous) @ createLedgerContext.ts:200
emit @ events.js:153
onWsClose_1 @ index.ts:617
index.ts:494 WebSocket connection to 'ws://localhost:3000/BankA/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
3index.js:1 useStreamQueries: WebSocket connection failed.
console.<computed> @ index.js:1
(anonymous) @ createLedgerContext.ts:200
emit @ events.js:153
onWsClose_1 @ index.ts:617
index.ts:494 WebSocket connection to 'ws://localhost:3000/USFRB/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
4index.js:1 useStreamQueries: WebSocket connection failed.
console.<computed> @ index.js:1
(anonymous) @ createLedgerContext.ts:200
emit @ events.js:153
onWsClose_1 @ index.ts:617
index.ts:494 WebSocket connection to 'ws://localhost:3000/ECB/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
4index.js:1 useStreamQueries: WebSocket connection failed.
console.<computed> @ index.js:1
(anonymous) @ createLedgerContext.ts:200
emit @ events.js:153
onWsClose_1 @ index.ts:617
index.ts:494 WebSocket connection to 'ws://localhost:3000/BankB/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
6index.js:1 useStreamQueries: WebSocket connection failed.
console.<computed> @ index.js:1
(anonymous) @ createLedgerContext.ts:200
emit @ events.js:153
onWsClose_1 @ index.ts:617
index.ts:494 WebSocket connection to 'ws://localhost:3000/BankA/v1/stream/query' failed: 
QueryStreamsManager.handleQueriesChange @ index.ts:494
QueryStreamsManager.streamSubmit @ index.ts:668
Ledger.streamQueryCommon @ index.ts:1161
Ledger.streamQueries @ index.ts:1206
mkStream @ createLedgerContext.ts:238
(anonymous) @ createLedgerContext.ts:189
commitHookEffectListMount @ react-dom.development.js:19731
commitPassiveHookEffects @ react-dom.development.js:19769
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
flushPassiveEffectsImpl @ react-dom.development.js:22853
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushPassiveEffects @ react-dom.development.js:22820
performSyncWorkOnRoot @ react-dom.development.js:21737
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
(anonymous) @ index.tsx:13
./src/index.tsx @ index.tsx:15
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ Brown-ThinItalic.woff:1
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 3 more frames
6index.js:1 useStreamQueries: WebSocket connection failed.

About ports 4000 and 6865 - I should check if those ports are open for UI to have a working connection.

The warnings are ok, the errors however are not, and they are pointing towards the fact, that the connection between the UI and the Json API is not successfully established.

As you suggested, I would verify that port 4000 is accessible to the UI.
The UI does not need to have access to port 6865 though.

The connection looks like this (using default port numbers for this example)
Daml Ledger (Port 6865) <-> Json API (Port 4000) <-> UI (port 3000) <-> Browser

I’ll need include the port in the inbound security rule for the EC2 box? Will get back to you soon on it.

Also, you mentioned that you tried reproducing the error - did you deploy it locally? I tried using DAML Hub as well and it didnt work either. If there’s a standard way to deploy the application, may be I can follow the same.

Yes, I have deployed it locally.

You can find the guide how to run the example locally here.

In short, once you have all the prerequisites installed, it’s actually fairly simple.

  1. Clone the repository
git clone https://github.com/digital-assed/ex-cbdc
  1. Run make in the cloned folder
> cd ex-cbdc
> make build
  1. Open 5 terminals in the ex-cbdc folder and run the launcher scripts
launchers/sandbox
launchers/jsonapi
launchers/automation
launchers/populate
launchers/ui

You don’t need python installed if you’re not running the resetService script.

If you’re using windows locally, I would suggest you leverage WSL2 such that you have easy access to the make command.

@Darko Thanks. I’m using the same guide to deploy it on EC2.

Also, I found these logs in the UI before the server starts running(they appear for a split second before it starts deploying the server):

[HPM] Proxy created: /Alice/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /Landlord/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /USFRB/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /ECB/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /BankA/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /BankB/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']
[HPM] Proxy created: /DemoAdmin/v1/** -> http://localhost:4000
[HPM] Subscribed to http-proxy events: ['error', 'close']

@mvresh These logs are benign. It is just saying that the proxy has been created such that the requests by the UI are directed to the JSON API.

@Darko What do you suggest I do? I checked the the inbound rules of the EC2 and they’re correct. If there’s a way to diagnose the problem, that would be really helpful. Currently, I’m aware of the issue but not sure how to resolve it.

@Darko

Update:

I deleted package-lock.json from ui/ and ran make daml-hub-package LEDGER_ID=[Ledger ID] . There were no errors and I was able to deploy to DAML Hub(Deployed dar files, triggers for each party and UI as well).

Still I unable to test the functionalities of CBDC.

In the console, I could find these error logs:

index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
sample-slack.png:1          Failed to load resource: net::ERR_NAME_NOT_RESOLVED
index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
3createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
4createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
4createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
6createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
index.ts:494 WebSocket connection to 'wss://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/stream/query' failed: 
t.handleQueriesChange @ index.ts:494
6createLedgerContext.ts:200 useStreamQueries: WebSocket connection failed.
(anonymous) @ createLedgerContext.ts:200
y4ir1y9bd2z3i3ta.daml.app/:1 Access to XMLHttpRequest at 'https://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/exercise' from origin 'https://y4ir1y9bd2z3i3ta.daml.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
CentralBankFirstFlow.tsx:94 TypeError: Network request failed
    at XMLHttpRequest.u.onerror (browser-ponyfill.js:480:16)
(anonymous) @ CentralBankFirstFlow.tsx:94
l @ runtime.js:63
(anonymous) @ runtime.js:294
(anonymous) @ runtime.js:119
n @ asyncToGenerator.js:3
s @ asyncToGenerator.js:29
Promise.then (async)
n @ asyncToGenerator.js:13
u @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
(anonymous) @ CentralBankFirstFlow.tsx:81
u @ react-dom.production.min.js:14
d @ react-dom.production.min.js:14
(anonymous) @ react-dom.production.min.js:14
g @ react-dom.production.min.js:15
ue @ react-dom.production.min.js:52
oe @ react-dom.production.min.js:51
se @ react-dom.production.min.js:52
pe @ react-dom.production.min.js:56
N @ react-dom.production.min.js:287
q @ react-dom.production.min.js:19
Je @ react-dom.production.min.js:70
Xe @ react-dom.production.min.js:69
e.unstable_runWithPriority @ scheduler.production.min.js:19
Vi @ react-dom.production.min.js:122
B @ react-dom.production.min.js:287
Ge @ react-dom.production.min.js:68
VM6:1          POST https://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/exercise net::ERR_FAILED

It still indicates that the error is due to lack of connection with DABL API although I’m not sure what’s causing it, since I’m running on DAML Hub.

Followed the steps listed in the README for DAML Hub as is. Still the same errors.