Not able to connect to canton domain

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.

@Darko

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 )

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.

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.

3 Likes

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.

1 Like

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

2 Likes