Direct Communication

The MPC nodes can be configured to communicate with each other using direct node-to-node connections.

This is done by enabling the MPCDirectServer in the MPC node configuration file:

[MPCDirectServer]
  Port = 9000    # TCP listening port (set to 0 to not accept raw TCP connections
  WSPort = 9080  # WebSocket listening port (set to 0 to not accept WebSocket communication)
  DisableMultiplexing = false
  CertificateFile = ""
  CertificateBytes = ""
  CertificateKeyFile = ""
  CertificateKeyBytes = ""

TLS certificates apply only to WebSocket communication; TCP connections are unaffected by these settings.

MPCDirectServer can be used together with message-broker communication. This allows some players to connect via direct TCP/WebSocket and others via a broker, though this hybrid setup introduces minor performance overhead.

In addition, the MPC players must have unique player indices, such as 0, 1, 2, etc., and each MPC node configuration file must contain the address of the other nodes. For example, in a TSM with three MPC nodes with player indices 0, 1, 2, the MPC node with player index 0 can have the following in its configuration file:

[Players.1]
  Address = "tcp://player1:9000"
  PublicKey = ""

[Players.2]
  Address = "ws://player2:9000"
  PublicKey = ""

Mixed Setup

The direct node-to-node communication can be combined with broker-based communication.

Consider for example a setup with three MPC players: One player running on a mobile device and two players running on servers. In this case you can set up Builder Vault so the mobile player communicates with the servers using message broker, while the two server nodes are connected with each other via direct TCP.

📘

Legacy Note

In versions prior to v73 LTS, direct communication was configured using MPCTCPServer and MPCWebSocketServer. The MPCTCPServer still exists for backward compatibility, but MPCDirectServer is now the recommended server for direct connections. The MPCWebSocketServer has been removed and direct WebSocket communication must now be configured using the MPCDirectServer.





What’s Next