How do I create two connected vats on two different machines?

How do I create two connected vats on two different machines? I’d like to experiment with communicating processes in different machines, but haven’t found an example.

Thanks.

Welcome @aag! To connect different machines over the network, you need to use the Object Capabilities Network (OCapN). I’m not sure if you’ve seen this already, but the Goblins manual has a chapter dedicated to OCapN and includes this tutorial section that uses Tor: Example Two Goblins programs chatting over CapTP via Tor (Spritely Goblins)

Let us know if these docs are helpful or if you still have questions!

Thanks. Sorry, I should have mentioned that I had seen that. But I can’t find anything about using basic TCP/IP or TLS/SSL networking to connect two vats. I don’t really want to set up Tor.

Oh, in that case you’ll want to use the (relatively new) TCP+TLS netlayer. You can follow that same tutorial but replace the bits that use the Tor netlayer.

Here’s an example that listens on localhost:

(define tls-netlayer
  (with-vat node-vat
    (new-tcp-tls-netlayer "127.0.0.1")))

This would replace the (define-values (onion-netlayer private-key service-id) ...) code in the tutorial. And when you go to register Bob, you’d specify the tcp-tls name rather than onion: ($ mycapn 'register bob 'tcp-tls)

1 Like