Skip to content
Discussions/App Development/Not able to connect to canton domainForum ↗

Not able to connect to canton domain

App Development10 posts786 views12 likesLast activity Apr 2021
SH
Shubham-koliOP
Jun 2020

Hi, I am trying to run following canton topology.
one canton domain and 2 canton participants and every component is being deployed separately.
on my local machine. I am not able to connect the canton domains.

I am getting following errors

participant.domains.connect(“mydomain”, “http://192.168.29.50:10018”)

ERROR c.d.c.c.ConsoleEnvironment - Request failed for participant. GrpcClientError: INVALID_ARGUMENT/SyncServiceAlreadyAdded(DomainAlias(mydomain)) Request: RegisterDomain(DomainConnectionConfig(DomainAlias(mydomain),http://192.168.29.50:10018,true,None,None,0)) Trailers: Metadata(content-type=application/grpc) Command execution failed.

mydomain is running as I have double-checked by looking at the service running on that port and firewall is not blocking it.

any help is very much appreciated.

SH
Shubham-koli
Jun 2020

@Darko

SH
Shubham-koli
Jul 2020

This is my domain configuration.

@ mydomain.config res0: com.digitalasset.canton.domain.config.DomainConfig = DomainConfig( InitConfig(true, NonNegativeDuration(PT30S)), false, PublicServerConfig("127.0.0.1", 10018, None, PT1H), AdminServerConfig("127.0.0.1", 10019, None), Memory, Tink(), IdentityConfig(AutoApprove(true)), DomainParameters( NonNegativeDuration(PT10S), NonNegativeDuration(PT10S), NonNegativeDuration(PT1S), NonNegativeDuration(PT1M), NonNegativeDuration(PT1M), NonNegativeDuration(PT1M), 200, 10485760 ), InProcess(Embedded, true), None, None )

SH
Shubham-koli
Jul 2020

so I think the configuration is only supporting the connection requests made from localhost. (127.0.0.1)

PublicServerConfig("127.0.0.1", 10018, None, PT1H),
AdminServerConfig("127.0.0.1", 10019, None),

how do I configure the domain so it can accept requests made externally?

PublicServerConfig("0.0.0.0", 10018, None, PT1H),
AdminServerConfig("0.0.0.0", 10019, None),

basically I think this will resolve the issue.

RA
Ratko_Veprek
Jul 2020

Hey @Shubham-koli

First note, there is @Darko and there is @Ratko_Veprek. The names are similar, the persons not :wink:

The first error you post says that you have already configured the domain connection. The error reads: SyncServiceAlreadyAdded(DomainAlias(mydomain), ...

You can’t register multiple domains under the same name. If you want to amend the configuration, you can use the participant.domains.modify(config: DomainConnectionConfig) command. If you need to change the setting for a domain configuration on the participant, you can get the current configuration using val current = participant.domains.config("mydomain") and then set the config using participant.domains.modify(current.copy(connection="https://..."))

And you are right with your observation. Canton is a bit conservative and binds by default only to localhost so that you don’t expose your data by accident on the open internet. I.e. we wanted to avoid to create news like this: https://www.qwant.com/?q=Thousands+of+MongoDB+Databases+Found+Exposed+on+the+Internet

I assume that you want to be able to connect a participant node running on one machine to a domain running on another. So, you have to change the domain config of the domain to listen to 0.0.0.0:

canton {
   domains {
     mydomain {
        public-api {
           port = 10018
           address = 0.0.0.0
        }
     }
   } 
}

Please let me know if this helps.

SH
Shubham-koli
Jul 2020

Thanks @Ratko_Veprek.
Actually I’m trying to put canton on k8’s and my participant node was not able to connect the domain. I just tested this locally and I think exposing the ports globally has solved the problem.

SH
Shubham-koli
Jul 2020

Hey @Ratko_Veprek, Thanks for your help!
I was able to deploy the canton components on Kubernetes successfully.

VE
veboddu
Apr 2021

I am also not able to connect to canton domains. Getting below error -

ERROR c.d.c.ConsoleScriptRunner - java.util.concurrent.TimeoutException: Futures timed out after [20 seconds]
        at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:259)
        at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:263)
        at scala.concurrent.Await$.$anonfun$result$1(package.scala:220)
        at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:57)
        at scala.concurrent.Await$.result(package.scala:146)
        at com.microsoft.daphne.LedgerCommon$.execute(LedgerCommon.scala:14)
        at com.microsoft.daphne.DaphneNetworkSetup$.setupParticipants(DaphneNetworkSetup.scala:107)
        at ammonite.canton.interpreter.canton$minusscript_2$.<init>(demo.sc:139)
        at ammonite.canton.interpreter.canton$minusscript_2$.<clinit>(demo.sc)
        at ammonite.canton.interpreter.canton$minusscript_2.$main(demo.sc)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at ammonite.runtime.Evaluator$$anon$1.$anonfun$evalMain$1(Evaluator.scala:108)
        at ammonite.util.Util$.withContextClassloader(Util.scala:24)
        at ammonite.runtime.Evaluator$$anon$1.evalMain(Evaluator.scala:90)
        at ammonite.runtime.Evaluator$$anon$1.$anonfun$processScriptBlock$1(Evaluator.scala:153)
        at ammonite.util.Catching.map(Res.scala:117)
        at ammonite.runtime.Evaluator$$anon$1.processScriptBlock(Evaluator.scala:150)
        at ammonite.interp.Interpreter.$anonfun$processSingleBlock$4(Interpreter.scala:324)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.$anonfun$processSingleBlock$3(Interpreter.scala:315)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.$anonfun$processSingleBlock$2(Interpreter.scala:312)
        at ammonite.util.Catching.flatMap(Res.scala:115)
        at ammonite.interp.Interpreter.processSingleBlock(Interpreter.scala:311)
        at ammonite.interp.Interpreter.$anonfun$processModule$8(Interpreter.scala:392)
        at ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$3(Interpreter.scala:520)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.compileRunBlock$1(Interpreter.scala:506)
        at ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$15(Interpreter.scala:567)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$14(Interpreter.scala:564)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$12(Interpreter.scala:561)
        at scala.Option.getOrElse(Option.scala:189)
        at ammonite.interp.Interpreter.loop$1(Interpreter.scala:561)
        at ammonite.interp.Interpreter.processAllScriptBlocks(Interpreter.scala:599)
        at ammonite.interp.Interpreter.$anonfun$processModule$6(Interpreter.scala:394)
        at ammonite.util.Catching.flatMap(Res.scala:115)
        at ammonite.interp.Interpreter.$anonfun$processModule$5(Interpreter.scala:385)
        at ammonite.util.Res$Success.flatMap(Res.scala:62)
        at ammonite.interp.Interpreter.processModule(Interpreter.scala:375)
        at com.digitalasset.canton.console.HeadlessConsole$.runCode(HeadlessConsole.scala:111)
        at com.digitalasset.canton.console.HeadlessConsole$.$anonfun$apply$2(HeadlessConsole.scala:55)
        at scala.util.Either.flatMap(Either.scala:341)
        at com.digitalasset.canton.console.HeadlessConsole$.$anonfun$apply$1(HeadlessConsole.scala:54)
        at better.files.Dispose.apply(Dispose.scala:81)
        at com.digitalasset.canton.console.HeadlessConsole$.apply(HeadlessConsole.scala:46)
        at com.digitalasset.canton.ConsoleScriptRunner$.run(Runner.scala:184)
        at com.digitalasset.canton.ConsoleScriptRunner.run(Runner.scala:106)
        at com.digitalasset.canton.CantonAppDriver.delayedEndpoint$com$digitalasset$canton$CantonAppDriver$1(CantonAppDriver.scala:157)
        at com.digitalasset.canton.CantonAppDriver$delayedInit$body.apply(CantonAppDriver.scala:27)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at scala.Function0.apply$mcV$sp$(Function0.scala:39)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
        at scala.App.$anonfun$main$1$adapted(App.scala:80)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at scala.App.main(App.scala:80)
        at scala.App.main$(App.scala:78)
        at com.digitalasset.canton.CantonAppDriver.main(CantonAppDriver.scala:27)
        at com.digitalasset.canton.CantonCommunityApp.main(CantonCommunityApp.scala)

Really appreciate your help in this,

RA
Ratko_Veprek
Apr 2021

Are you sure that the domain is up and running, listening to the appropriate port on an accessible IP? Given that you try to connect to a demo setup (according to the demo.sc filename), my best guess would be that you’ve been using a wrong port /inaccessible IP address.

Please have a look at the log file in log/canton.log as well (run Canton with -v to turn on debug logging).

VE
veboddu
Apr 2021

My bad, it’s because of private network issues. Thank you.

← Back to Discussions